diff options
author | Leonardo Arena <rnalrd@gmail.com> | 2011-07-19 07:46:04 +0000 |
---|---|---|
committer | Leonardo Arena <rnalrd@gmail.com> | 2011-07-19 07:46:11 +0000 |
commit | 0c53e0863ee9dfa2e70ad356569008d790c92318 (patch) | |
tree | 52f7a6b2988c8d3ff67c624a760007f247a50314 /testing/ocfs2-tools | |
parent | 2e233632679fa37afa55f4fc20ce248cfb24cd53 (diff) | |
download | aports-0c53e0863ee9dfa2e70ad356569008d790c92318.tar.bz2 aports-0c53e0863ee9dfa2e70ad356569008d790c92318.tar.xz |
testing/ocfs2-tools: init.d added
Diffstat (limited to 'testing/ocfs2-tools')
-rw-r--r-- | testing/ocfs2-tools/APKBUILD | 14 | ||||
-rw-r--r-- | testing/ocfs2-tools/ocfs2-tools.confd | 6 | ||||
-rw-r--r-- | testing/ocfs2-tools/ocfs2-tools.initd | 100 |
3 files changed, 115 insertions, 5 deletions
diff --git a/testing/ocfs2-tools/APKBUILD b/testing/ocfs2-tools/APKBUILD index 9f9624da30..653918006a 100644 --- a/testing/ocfs2-tools/APKBUILD +++ b/testing/ocfs2-tools/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Leonardo Arena <rnalrd@alpinelinux.org> pkgname=ocfs2-tools pkgver=1.4.4 -pkgrel=0 +pkgrel=1 pkgdesc="Oracle Cluster File System 2 utilities" url="http://oss.oracle.com/projects/ocfs2-tools" arch="all" @@ -14,7 +14,9 @@ install= subpackages="$pkgname-dev $pkgname-doc" source="http://oss.oracle.com/projects/ocfs2-tools/dist/files/source/v1.4/$pkgname-$pkgver.tar.gz gcc45-ftbfs.patch - build.patch" + build.patch + $pkgname.initd + $pkgname.confd" _builddir="$srcdir"/$pkgname-$pkgver @@ -49,10 +51,12 @@ package() { make DESTDIR="$pkgdir" install # remove the 2 lines below (and this) if there is no init.d script - # install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname - # install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname + install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname } md5sums="f7ae245e8baa499aa56d7af25a7885d5 ocfs2-tools-1.4.4.tar.gz 5dba18ca5596b1de0f2eeb30f5ed1656 gcc45-ftbfs.patch -c938040f0e77a4bb23e952c8f99b6cc5 build.patch" +c938040f0e77a4bb23e952c8f99b6cc5 build.patch +5bc9de63e86fe8bd50c9c782e4a10076 ocfs2-tools.initd +5c8e7b397fec3df784963eb55028cc8e ocfs2-tools.confd" diff --git a/testing/ocfs2-tools/ocfs2-tools.confd b/testing/ocfs2-tools/ocfs2-tools.confd new file mode 100644 index 0000000000..29b236dec6 --- /dev/null +++ b/testing/ocfs2-tools/ocfs2-tools.confd @@ -0,0 +1,6 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/ocfs2-tools/files/Attic/ocfs2.conf,v 1.2 2009/10/08 09:03:35 flameeyes dead $ + +# Put your cluster names here, separated by space, ie. +# OCFS2_CLUSTER="cluster1 admincluster cluster2" diff --git a/testing/ocfs2-tools/ocfs2-tools.initd b/testing/ocfs2-tools/ocfs2-tools.initd new file mode 100644 index 0000000000..32abd47e48 --- /dev/null +++ b/testing/ocfs2-tools/ocfs2-tools.initd @@ -0,0 +1,100 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/ocfs2-tools/files/Attic/ocfs2.init,v 1.2 2009/10/08 09:03:35 flameeyes dead $ + +depend() { + need net localmount + before netmount +} + +check_modules() { + local MODULES="ocfs2_dlmfs ocfs2 ocfs2_dlm ocfs2_nodemanager configfs" + local MODULE + local MODPROBE="modprobe -l" + local retval=0 + + for MODULE in ${MODULES}; do + if [ -z "`${MODPROBE} ${MODULE}`" ] ; then + retval=1 + fi + done + if [ ${retval} -eq 1 ] ; then + ewarn "One or more required modules are not loaded." + ewarn "Make sure you have " + ewarn " - placed ocfs, dlmfs and configfs into /etc/modules.autoload.d/kernel-2.6" + ewarn "For a (in)complete documentation, read /usr/share/doc/ocfs-<version>/INSTALL.GENTOO.gz" + fi + return ${retval} +} + +check_pseudofs() { + local retval=0 + local HASMOUNT="mount -l -t" + if [ -z "`${HASMOUNT} configfs`" ] ; then + retval=1 + fi + if [ -z "`${HASMOUNT} ocfs2_dlmfs`" ] ; then + retval=1 + fi + + if [ ${retval} -eq 1 ]; then + ewarn "One or more pseudo-filesystes are not mounted." + ewarn "Make sure you have following lines in your /etc/fstab:" + ewarn "none /config configfs defaults 0 0" + ewarn "none /dlm ocfs2_dlmfs defaults 0 0" + ewarn "For a (in)complete documentation, read /usr/share/doc/ocfs-<version>/INSTALL.GENTOO.gz" + fi + return ${retval} +} + + + +start() { + check_modules || return $? + check_pseudofs || return $? + + einfo "Starting OCFS2 cluster" + for cluster in ${OCFS2_CLUSTER}; do + ebegin " - ${cluster}" + /sbin/o2cb_ctl -H -n ${cluster} -t cluster -a online=yes >/dev/null 2>&1 + eend $? + done +} + +stop() { + # Shamelesly stolen from netmount + local ret + ebegin "Unmounting OCFS2 filesystems" + [ -z "$(umount -art ocfs2 2>&1)" ] + ret=$? + eend ${ret} "Failed to simply unmount filesystems" + [ ${ret} -eq 0 ] && return 0 + + declare -a siglist=( "TERM" "KILL" "KILL" ) + local retry=0 + local remaining="go" + + while [ -n "${remaining}" -a ${retry} -lt 3 ] + do + remaining="$(awk '$3 ~ /'ocfs2'/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" + IFS=$'\n' + set -- ${remaining//\\040/ } + unset IFS + [ -z "${remaining}" ] && break + + ebegin $'\t'"Unmounting ocfs2 filesystems (retry #$((retry+1)))" + /bin/fuser -k -${siglist[$((retry++))]} -m "$@" &>/dev/null + sleep 5 + umount "$@" &>/dev/null + eend $? $'\t'"Failed to unmount filesystems" + done + + + einfo "Stopping OCFS2 cluster" + for cluster in ${OCFS_CLUSTERS}; do + ebegin " - ${cluster}" + /sbin/o2cb_ctl -H -n ${cluster} -t cluster -a online=no >/dev/null 2>&1 + eend $? + done +} |