From: Dietmar Maurer Date: Mon, 23 Jul 2012 12:21:57 +0000 (+0200) Subject: new init.d script, now scans /var/lib/sheepdog/disk[0-9]/startup X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=07e2d38ce8ffcea6f39fd1e51541f914d05138a5;p=pve-sheepdog.git new init.d script, now scans /var/lib/sheepdog/disk[0-9]/startup revert previous commit (new option -i) --- diff --git a/Makefile b/Makefile index c9dccaa..bb551e2 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ RELEASE=2.1 PACKAGE=pve-sheepdog -PKGREL=5 +PKGREL=6 SDVER=0.4.0 DEB=${PACKAGE}_${SDVER}-${PKGREL}_amd64.deb diff --git a/debian/changelog b/debian/changelog index 755ea1d..7a4be51 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +pve-sheepdog (0.4.0-6) unstable; urgency=low + + * new init.d script, now scans /var/lib/sheepdog/disk[0-9]/startup + + -- Proxmox Support Team Mon, 23 Jul 2012 14:21:41 +0200 + pve-sheepdog (0.4.0-5) unstable; urgency=low * introduce new sheep -i option to prevent users from using wrong diff --git a/debian/patches/series b/debian/patches/series index 09dd53f..a2688ed 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,4 +1,3 @@ disable-test-suite.patch do-not-install-generic-init-script.patch simplify-log-rotation.patch -new-option-i-to-initialize-storage-directory.patch diff --git a/debian/pve-sheepdog.sheepdog.default b/debian/pve-sheepdog.sheepdog.default index 8909f56..c66a001 100644 --- a/debian/pve-sheepdog.sheepdog.default +++ b/debian/pve-sheepdog.sheepdog.default @@ -1,16 +1,6 @@ # Defaults for pve-sheepdog initscript # sourced by /etc/init.d/pve-sheepdog -# installed at /etc/default/pve-sheepdog by the maintainer scripts # start sheepdog at boot [yes|no] START=yes -# -# This is a POSIX shell fragment -# - -#SHEEPDOG_START_SEQUENCE="_1 _2" -#SHEEPDOG_DEAMON_ARGS_1="-p 7000 -v 32 -z 1" -#SHEEPDOG_DEAMON_ARGS_2="-p 7001 -v 32 -z 1" -#SHEEPDOG_PATH_1="/var/lib/sheepdog/disc1" -#SHEEPDOG_PATH_2="/var/lib/sheepdog/disc2" diff --git a/debian/pve-sheepdog.sheepdog.init.d b/debian/pve-sheepdog.sheepdog.init.d index 85ad343..386f639 100644 --- a/debian/pve-sheepdog.sheepdog.init.d +++ b/debian/pve-sheepdog.sheepdog.init.d @@ -21,10 +21,11 @@ SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed [ -x $DAEMON ] || exit 0 -# Defaults -SHEEPDOG_START_SEQUENCE="_1" -SHEEPDOG_DEAMON_ARGS_1="" -SHEEPDOG_PATH_1="/var/lib/sheepdog/disc1" +DISKLIST=$(echo /var/lib/sheepdog/disc[0123456789]) +RDISKLIST= +for dir in ${DISKLIST}; do + RDISKLIST="${dir} ${RDISKLIST}" +done # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME @@ -47,16 +48,20 @@ do_start() # 1 if daemon was already running # 2 if daemon could not be started - for SHEEP in $SHEEPDOG_START_SEQUENCE; do - eval DAEMON_ARGS=\$SHEEPDOG_DEAMON_ARGS$SHEEP - eval SHEEPDOG_PATH=\$SHEEPDOG_PATH$SHEEP - eval PIDFILE=/var/run/$NAME$SHEEP.pid + for dir in ${DISKLIST}; do + test -f "${dir}/startup" || continue + DAEMON_ARGS=$(head -n1 "${dir}/startup"); + DISKID=${dir##/var/lib/sheepdog/disc} + PIDFILE="$dir/sheep.pid" + DAEMON_ARGS="${DAEMON_ARGS} --pidfile ${PIDFILE}" + if ! test "$(echo ${DAEMON_ARGS}|grep -c '\-p ')" -eq 1 ; then + DAEMON_ARGS="${DAEMON_ARGS} -p $((7000 + ${DISKID}))" + fi - mkdir -p $SHEEPDOG_PATH + status_of_proc -p ${PIDFILE} $DAEMON "$NAME" >/dev/null && continue - status_of_proc -p ${PIDFILE} $DAEMON "$NAME" >/dev/null && continue - - start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec $DAEMON -- --pidfile ${PIDFILE} $DAEMON_ARGS $SHEEPDOG_PATH || return 2 + start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec $DAEMON -- $DAEMON_ARGS ${dir} || return 2 + sleep 1 done return 0 @@ -74,11 +79,11 @@ do_stop() # other if a failure occurred RETVAL=0 - for SHEEP in $SHEEPDOG_START_SEQUENCE; do - eval DAEMON_ARGS=\$SHEEPDOG_DEAMON_ARGS$SHEEP - eval SHEEPDOG_PATH=\$SHEEPDOG_PATH$SHEEP - eval PIDFILE=/var/run/$NAME$SHEEP.pid - start-stop-daemon --stop --oknodo --retry=TERM/20/KILL/5 --quiet --pidfile ${PIDFILE} --exec $DAEMON || RETVAL=2 + for dir in ${RDISKLIST}; do + test -f "${dir}/startup" || continue + PIDFILE="$dir/sheep.pid" + start-stop-daemon --stop --oknodo --retry=TERM/20/KILL/5 --quiet --pidfile ${PIDFILE} --exec $DAEMON || RETVAL=2 + sleep 1 done return "$RETVAL" @@ -104,11 +109,10 @@ case "$1" in ;; status) RETVAL=0 - for SHEEP in $SHEEPDOG_START_SEQUENCE; do - eval DAEMON_ARGS=\$SHEEPDOG_DEAMON_ARGS$SHEEP - eval SHEEPDOG_PATH=\$SHEEPDOG_PATH$SHEEP - eval PIDFILE=/var/run/$NAME$SHEEP.pid - status_of_proc -p ${PIDFILE} $DAEMON "$NAME${SHEEP}" || RETVAL=1 + for dir in ${DISKLIST}; do + test -f "${dir}/startup" || continue + PIDFILE="$dir/sheep.pid" + status_of_proc -p ${PIDFILE} $DAEMON "$NAME ${dir}" || RETVAL=1 done exit $RETVAL ;; diff --git a/sheepdog-0.4.0.tar.gz b/sheepdog-0.4.0.tar.gz index 0e4c835..0fb6ae1 100644 Binary files a/sheepdog-0.4.0.tar.gz and b/sheepdog-0.4.0.tar.gz differ