public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in sys-fs/gfs/files: gfs-2.0x.rc gfs-1.0x.rc gfs.rc
@ 2008-03-17 17:30 Christian Zoffoli (xmerlin)
  0 siblings, 0 replies; only message in thread
From: Christian Zoffoli (xmerlin) @ 2008-03-17 17:30 UTC (permalink / raw
  To: gentoo-commits

xmerlin     08/03/17 17:30:29

  Added:                gfs-2.0x.rc gfs-1.0x.rc
  Removed:              gfs.rc
  Log:
  Version bump. 1.0x.00 is scheduled to be removed soon.
  (Portage version: 2.1.4.4)

Revision  Changes    Path
1.1                  sys-fs/gfs/files/gfs-2.0x.rc

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/gfs/files/gfs-2.0x.rc?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/gfs/files/gfs-2.0x.rc?rev=1.1&content-type=text/plain

Index: gfs-2.0x.rc
===================================================================
#!/sbin/runscript
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/sys-fs/gfs/files/gfs-2.0x.rc,v 1.1 2008/03/17 17:30:29 xmerlin Exp $

opts="${opts} mountall"

depend() {
	local myneed="cman"
	local devices="$(awk '!/^#/ && $3 == "gfs" && $4 !~ /noauto/ {print $1 }' /etc/fstab)"

	if [ -n "${devices}" ]; then
		local device=""
		for device in ${devices}; do
			if [ -n "$(echo "${device}" | awk '$1 ~ /\/dev\/gnbd/')" ]; then
				myneed="${myneed} gnbd-client"
			else
				if [ -n "$(echo "${device}" | awk '$1 ~ /\/dev\/vg/')" ]; then
					myneed="${myneed} clvmd"
				fi
			fi
		done
	fi

	use dns logger net
	need ${myneed}
}

mount_gfs_filesystems() {
	local remaining=""
	remaining="$(awk '!/^#/ && $3 == "gfs"  { if ($4 !~ "noauto") print $1 }' /etc/fstab)"
	
	if [ -n "${remaining}" ]; then
	
		local device=""
		local remaining_verified=""
		
		for device in ${remaining}; do
			if [ -b ${device} ]; then
				remaining_verified="${remaining_verified} ${device}"
			else
				ewarn "Block device ${device} not found!!"
			fi
		done
		
		if [ -n "${remaining_verified}" ]; then
			einfo "Mounting GFS filesystems"
			device=""
			for device in ${remaining_verified}; do
				local target="$(awk '!/^#/ && $3 == "gfs" && $1 == device { print $2 }' device=${device} /etc/fstab)"
				local mounted="$(awk '$3 == "gfs" && $1 == device { print $2 }' device=${device} /proc/mounts)"
				
				# mount only filesystems not already mounted
				if [ -z "${mounted}" ]; then
					ebegin "--> mounting ${device} on ${target}"
					mount -t gfs ${device} ${target} >/dev/null
					eend $?
				else
					einfo "--> ${device} already mounted on ${target}"
					eend 0
				fi
			done
		else
			einfo "No GFS filesystems to automount"
		fi
	fi
}


umount_gfs_filesystems() {
	local sig retry
	local remaining="$(awk '$3 == "gfs" { print $2 }' /proc/mounts | sort -r)"

	if [ -n "${remaining}" ]
	then
	        sig=
	        retry=3
	        while [ -n "${remaining}" -a "${retry}" -gt 0 ]
	        do
	                if [ "${retry}" -lt 3 ]
			then
	                        ebegin "Unmounting GFS filesystems (retry)"
	                        umount ${remaining} &>/dev/null
	                        eend $? "Failed to unmount GFS filesystems this retry"
	                else
	                        ebegin "Unmounting GFS filesystems"
	                        umount ${remaining} &>/dev/null
	                        eend $? "Failed to unmount GFS filesystems"
	                fi
	                remaining="$(awk '$3 == "gfs" { if ($2 != "/") print $2 }' /proc/mounts | sort -r)"
	                [ -z "${remaining}" ] && break
	                /bin/fuser -k -m ${sig} ${remaining} &>/dev/null
	                sleep 5
	                retry=$((${retry} -1))
	                sig=-9
	        done
	fi
}

load_modules() {
	local module modules
	modules=$1
	
	for module in ${modules}; do
		ebegin "Loading ${module} kernel module"
		modprobe ${module}
		eend $? "Failed to load ${module} kernel module"
	done
}

unload_modules() {
	local module modules
	modules=$1
	
	for module in ${modules}; do
		ebegin "Unloading ${module} kernel module"
		modprobe -r ${module}
		eend $? "Failed to unload ${module} kernel module"
	done
}

load_gfs_modules() {
	local modules
	
	# detect cluster/locking manager cman+dlm or gulm ?
	if [ -d /proc/cluster/config/cman ]; then
		if [ ! -d /proc/cluster/lock_dlm ]; then
			modules="${modules} lock_dlm"
		fi
	else
		if [ ! -d /proc/cluster/lock_gulm ]; then
			modules="${modules} lock_gulm"
		fi
	fi
	if [ ! -f /proc/fs/gfs ]; then
		modules="${modules} gfs"
	fi
	load_modules ${modules}
}

unload_gfs_modules() {
	if [ -f /proc/fs/gfs ]; then
		modules="gfs lock_harness"
	fi
	if [ -d /proc/cluster/lock_dlm ]; then
		modules="${modules} lock_dlm"
	fi
	if [ -d /proc/cluster/lock_gulm ]; then
		modules="${modules} lock_gulm"
	fi
	unload_modules ${modules}
}

mountall() {
	mount_gfs_filesystems
}

start() {
	einfo "Starting gfs cluster:"
	
	if [ ! -f /etc/ntp.conf ] ; then
		eerror "Please create /etc/ntp.conf"
		eerror "Sample conf: /usr/share/ntp/ntp.conf"
		eend 1
	fi
	
	load_gfs_modules
	mount_gfs_filesystems
}

stop() {
	einfo "Stopping gfs cluster:"
	
	umount_gfs_filesystems
	unload_gfs_modules
}




1.1                  sys-fs/gfs/files/gfs-1.0x.rc

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/gfs/files/gfs-1.0x.rc?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/gfs/files/gfs-1.0x.rc?rev=1.1&content-type=text/plain

Index: gfs-1.0x.rc
===================================================================
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/sys-fs/gfs/files/gfs-1.0x.rc,v 1.1 2008/03/17 17:30:29 xmerlin Exp $

opts="${opts} mountall"

depend() {
	local myneed="cluster-manager cluster-locking-manager fenced"
	local devices="$(awk '!/^#/ && $3 == "gfs" && $4 !~ /noauto/ {print $1 }' /etc/fstab)"

	if [ -n "${devices}" ]; then
		local device=""
		for device in ${devices}; do
			if [ -n "$(echo "${device}" | awk '$1 ~ /\/dev\/gnbd/')" ]; then
				myneed="${myneed} gnbd-client"
			else
				if [ -n "$(echo "${device}" | awk '$1 ~ /\/dev\/vg/')" ]; then
					myneed="${myneed} clvmd"
				fi
			fi
		done
	fi

	use dns logger net
	need ${myneed}
	provide cluster
}

mount_gfs_filesystems() {
	local remaining=""
	remaining="$(awk '!/^#/ && $3 == "gfs"  { if ($4 !~ "noauto") print $1 }' /etc/fstab)"
	
	if [ -n "${remaining}" ]; then
	
		local device=""
		local remaining_verified=""
		
		for device in ${remaining}; do
			if [ -b ${device} ]; then
				remaining_verified="${remaining_verified} ${device}"
			else
				ewarn "Block device ${device} not found!!"
			fi
		done
		
		if [ -n "${remaining_verified}" ]; then
			einfo "Mounting GFS filesystems"
			device=""
			for device in ${remaining_verified}; do
				local target="$(awk '!/^#/ && $3 == "gfs" && $1 == device { print $2 }' device=${device} /etc/fstab)"
				local mounted="$(awk '$3 == "gfs" && $1 == device { print $2 }' device=${device} /proc/mounts)"
				
				# mount only filesystems not already mounted
				if [ -z "${mounted}" ]; then
					ebegin "--> mounting ${device} on ${target}"
					mount -t gfs ${device} ${target} >/dev/null
					eend $?
				else
					einfo "--> ${device} already mounted on ${target}"
					eend 0
				fi
			done
		else
			einfo "No GFS filesystems to automount"
		fi
	fi
}


umount_gfs_filesystems() {
	local sig retry
	local remaining="$(awk '$3 == "gfs" { print $2 }' /proc/mounts | sort -r)"

	if [ -n "${remaining}" ]
	then
	        sig=
	        retry=3
	        while [ -n "${remaining}" -a "${retry}" -gt 0 ]
	        do
	                if [ "${retry}" -lt 3 ]
			then
	                        ebegin "Unmounting GFS filesystems (retry)"
	                        umount ${remaining} &>/dev/null
	                        eend $? "Failed to unmount GFS filesystems this retry"
	                else
	                        ebegin "Unmounting GFS filesystems"
	                        umount ${remaining} &>/dev/null
	                        eend $? "Failed to unmount GFS filesystems"
	                fi
	                remaining="$(awk '$3 == "gfs" { if ($2 != "/") print $2 }' /proc/mounts | sort -r)"
	                [ -z "${remaining}" ] && break
	                /bin/fuser -k -m ${sig} ${remaining} &>/dev/null
	                sleep 5
	                retry=$((${retry} -1))
	                sig=-9
	        done
	fi
}

load_modules() {
	local module modules
	modules=$1
	
	for module in ${modules}; do
		ebegin "Loading ${module} kernel module"
		modprobe ${module}
		eend $? "Failed to load ${module} kernel module"
	done
}

unload_modules() {
	local module modules
	modules=$1
	
	for module in ${modules}; do
		ebegin "Unloading ${module} kernel module"
		modprobe -r ${module}
		eend $? "Failed to unload ${module} kernel module"
	done
}

load_gfs_modules() {
	local modules
	
	# detect cluster/locking manager cman+dlm or gulm ?
	if [ -d /proc/cluster/config/cman ]; then
		if [ ! -d /proc/cluster/lock_dlm ]; then
			modules="${modules} lock_dlm"
		fi
	else
		if [ ! -d /proc/cluster/lock_gulm ]; then
			modules="${modules} lock_gulm"
		fi
	fi
	if [ ! -f /proc/fs/gfs ]; then
		modules="${modules} gfs"
	fi
	load_modules ${modules}
}

unload_gfs_modules() {
	if [ -f /proc/fs/gfs ]; then
		modules="gfs lock_harness"
	fi
	if [ -d /proc/cluster/lock_dlm ]; then
		modules="${modules} lock_dlm"
	fi
	if [ -d /proc/cluster/lock_gulm ]; then
		modules="${modules} lock_gulm"
	fi
	unload_modules ${modules}
}

mountall() {
	mount_gfs_filesystems
}

start() {
	einfo "Starting gfs cluster:"
	
	if [ ! -f /etc/ntp.conf ] ; then
		eerror "Please create /etc/ntp.conf"
		eerror "Sample conf: /usr/share/ntp/ntp.conf"
		eend 1
	fi
	
	load_gfs_modules
	mount_gfs_filesystems
}

stop() {
	einfo "Stopping gfs cluster:"
	
	umount_gfs_filesystems
	unload_gfs_modules
}




-- 
gentoo-commits@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-17 17:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-17 17:30 [gentoo-commits] gentoo-x86 commit in sys-fs/gfs/files: gfs-2.0x.rc gfs-1.0x.rc gfs.rc Christian Zoffoli (xmerlin)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox