Author: qboosh Date: Wed Mar 7 18:05:02 2012 GMT Module: packages Tag: HEAD ---- Log message: - added init-pld patch to PLDify init scripts
---- Files affected: packages/sanlock: sanlock.spec (1.3 -> 1.4) , sanlock-init-pld.patch (NONE -> 1.1) (NEW) ---- Diffs: ================================================================ Index: packages/sanlock/sanlock.spec diff -u packages/sanlock/sanlock.spec:1.3 packages/sanlock/sanlock.spec:1.4 --- packages/sanlock/sanlock.spec:1.3 Tue Mar 6 21:13:43 2012 +++ packages/sanlock/sanlock.spec Wed Mar 7 19:04:57 2012 @@ -1,22 +1,24 @@ # $Revision$, $Date$ -# TODO: fix & PLDify init scripts (currently bash scripts with /bin/sh shebang) +# TODO: systemd support (there are init.d/*.service, but they refer to unknown /lib/systemd/systemd-sanlock) Summary: Shared storage lock manager Summary(pl.UTF-8): Zarządca blokad dla współdzielonego składowania danych Name: sanlock Version: 2.0 -Release: 0.1 +Release: 1 License: LGPL v2+ (libsanlock_client, libwdmd), GPL v2 (libsanlock, utilities) Group: Networking Source0: https://fedorahosted.org/releases/s/a/sanlock/%{name}-%{version}.tar.gz # Source0-md5: 46fcb4be2aea8e5515d1f8ee86c68e13 Patch0: %{name}-link.patch +Patch1: %{name}-init-pld.patch URL: https://fedorahosted.org/sanlock/ BuildRequires: gcc >= 5:3.4 BuildRequires: libaio-devel BuildRequires: libblkid-devel BuildRequires: libuuid-devel BuildRequires: python-devel -BuildRequires: rpmbuild(macros) >= 1.202 +BuildRequires: rpmbuild(macros) >= 1.228 +Requires(post,preun): /sbin/chkconfig Requires(postun): /usr/sbin/groupdel Requires(postun): /usr/sbin/userdel Requires(pre): /bin/id @@ -24,6 +26,8 @@ Requires(pre): /usr/sbin/groupadd Requires(pre): /usr/sbin/useradd Requires: %{name}-libs = %{version}-%{release} +Provides: group(sanlock) +Provides: user(sanlock) BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) %description @@ -70,6 +74,7 @@ %prep %setup -q %patch0 -p1 +%patch1 -p1 %build export CFLAGS="%{rpmcflags}" @@ -120,6 +125,20 @@ %groupadd -g 279 sanlock %useradd -u 279 -g 279 -d /usr/share/empty -s /bin/false -c 'SANlock user' sanlock +%post +/sbin/chkconfig --add sanlock +/sbin/chkconfig --add wdmd +%service sanlock restart +%service wdmd restart + +%preun +if [ "$1" = "0" ]; then + %service -q sanlock stop + %service -q wdmd stop + /sbin/chkconfig --del sanlock + /sbin/chkconfig --del wdmd +fi + %postun if [ "$1" = "0" ]; then %userremove sanlock @@ -170,6 +189,9 @@ All persons listed below can be reached at <cvs_login>@pld-linux.org $Log$ +Revision 1.4 2012/03/07 18:04:57 qboosh +- added init-pld patch to PLDify init scripts + Revision 1.3 2012/03/06 20:13:43 qboosh - handle sanlock user/group ================================================================ Index: packages/sanlock/sanlock-init-pld.patch diff -u /dev/null packages/sanlock/sanlock-init-pld.patch:1.1 --- /dev/null Wed Mar 7 19:05:02 2012 +++ packages/sanlock/sanlock-init-pld.patch Wed Mar 7 19:04:57 2012 @@ -0,0 +1,244 @@ +--- sanlock-2.0/init.d/sanlock.orig 2012-03-02 22:13:24.000000000 +0100 ++++ sanlock-2.0/init.d/sanlock 2012-03-07 18:27:31.785530424 +0100 +@@ -31,27 +31,24 @@ + [ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + + start() { +- [ -x $exec ] || exit 5 +- +- if [ ! -d /var/run/$prog ]; then +- install -d -o $SANLOCKUSER -g $SANLOCKUSER -m 775 /var/run/$prog +- [ -x /sbin/restorecon ] && restorecon /var/run/$prog ++ # Check if the service is already running? ++ if [ -f /var/lock/subsys/sanlock ]; then ++ msg_already_running "sanlock" ++ return + fi +- +- echo -n $"Starting $prog: " ++ msg_starting "sanlock" + daemon --user=$SANLOCKUSER $prog daemon $SANLOCKOPTS +- retval=$? +- echo +- [ $retval -eq 0 ] +- return $retval ++ RETVAL=$? ++ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sanlock + } + + stop() { +- echo -n $"Stopping $prog: " +- killproc -p $lockfile $prog -TERM +- retval=$? +- echo +- [ $retval -eq 0 ] ++ if [ ! -f /var/lock/subsys/sanlock ]; then ++ msg_not_running "sanlock" ++ return ++ fi ++ killproc --pidfile $lockfile $prog ++ rm -f /var/lock/subsys/sanlock + } + + wait_for_stop() { +@@ -60,53 +57,45 @@ + done + } + +-restart() { ++condrestart() { ++ if [ ! -f /var/lock/subsys/sanlock ]; then ++ msg_not_running "sanlock" ++ RETVAL=$1 ++ return ++ fi + stop + wait_for_stop + start + } + +-reload() { +- restart +-} +- +-rh_status() { +- status $prog +-} +- +-rh_status_q() { +- rh_status >/dev/null 2>&1 ++restart() { ++ stop ++ wait_for_stop ++ start + } + + case "$1" in + start) +- rh_status_q && exit 0 +- $1 ++ start + ;; + stop) +- rh_status_q || exit 0 +- $1 ++ stop + ;; + restart) +- $1 ++ restart + ;; +- reload) +- rh_status_q || exit 7 +- $1 ++ try-restart) ++ condrestart 0 + ;; + force-reload) +- force_reload ++ condrestart 7 + ;; + status) +- rh_status +- ;; +- condrestart|try-restart) +- rh_status_q || exit 0 +- restart ++ status --pidfile $pidfile sanlock ++ RETVAL=$? + ;; + *) +- echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" +- exit 2 ++ msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" ++ exit 3 + esac +-exit $? +- ++exit $RETVAL +--- sanlock-2.0/init.d/wdmd.orig 2012-03-02 22:13:24.000000000 +0100 ++++ sanlock-2.0/init.d/wdmd 2012-03-07 18:26:30.102195201 +0100 +@@ -3,7 +3,7 @@ + # wdmd - watchdog multiplexing daemon + # + # chkconfig: 2345 97 03 +-# description: starts and stops sanlock daemon ++# description: starts and stops wdmd daemon + # + + +@@ -22,7 +22,7 @@ + . /etc/rc.d/init.d/functions + + prog="wdmd" +-lockfile="/var/run/$prog/$prog.pid" ++pidfile="/var/run/$prog/$prog.pid" + exec="/usr/sbin/$prog" + + WDMDGROUP="sanlock" +@@ -31,75 +31,58 @@ + [ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + + start() { +- [ -x $exec ] || exit 5 +- +- if [ ! -d /var/run/$prog ]; then +- mkdir -p /var/run/$prog +- [ -x /sbin/restorecon ] && restorecon /var/run/$prog ++ # Check if the service is already running? ++ if [ -f /var/lock/subsys/wdmd ]; then ++ msg_already_running "wdmd" ++ return + fi +- +- echo -n $"Starting $prog: " ++ msg_starting "wdmd" + daemon $prog $WDMDOPTS +- retval=$? +- echo +- [ $retval -eq 0 ] && touch $lockfile +- return $retval ++ RETVAL=$? ++ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/wdmd + } + + stop() { +- echo -n $"Stopping $prog: " +- killproc -p $lockfile $prog -TERM +- retval=$? +- echo +- [ $retval -eq 0 ] && rm -f $lockfile ++ if [ ! -f /var/lock/subsys/wdmd ]; then ++ msg_not_running "wdmd" ++ return ++ fi ++ killproc --pidfile $pidfile $prog ++ rm -f /var/lock/subsys/wdmd + } + +-restart() { ++condrestart() { ++ if [ ! -f /var/lock/subsys/wdmd ]; then ++ msg_not_running "wdmd" ++ RETVAL=$1 ++ return ++ fi + stop + start + } + +-reload() { +- restart +-} +- +-rh_status() { +- status $prog +-} +- +-rh_status_q() { +- rh_status >/dev/null 2>&1 +-} +- + case "$1" in + start) +- rh_status_q && exit 0 +- $1 ++ start + ;; + stop) +- rh_status_q || exit 0 +- $1 ++ stop + ;; + restart) +- $1 ++ stop ++ start + ;; +- reload) +- rh_status_q || exit 7 +- $1 ++ try-restart) ++ condrestart 0 + ;; + force-reload) +- force_reload ++ condrestart 7 + ;; + status) +- rh_status +- ;; +- condrestart|try-restart) +- rh_status_q || exit 0 +- restart ++ status --pidfile $pidfile wdmd + ;; + *) +- echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" +- exit 2 ++ msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" ++ exit 3 + esac +-exit $? +- ++exit $RETVAL ================================================================ ---- CVS-web: http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/sanlock/sanlock.spec?r1=1.3&r2=1.4&f=u _______________________________________________ pld-cvs-commit mailing list [email protected] http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
