- fix #523221 - initscript collected problems LSB-compilant

This commit is contained in:
kzak 2010-02-24 14:00:23 +00:00
parent 2d10e9c3e5
commit 197cf35ac2
2 changed files with 86 additions and 51 deletions

View File

@ -18,84 +18,116 @@
# We require the /etc/amd.conf file, but supply it in the package, so it # We require the /etc/amd.conf file, but supply it in the package, so it
# should always be there. # should always be there.
[ -f /etc/amd.conf ] || exit $? [ -f /etc/amd.conf ] || exit $?
[ -f /etc/sysconfig/amd ] || exit $?
# Source function library. # source function library.
. /etc/init.d/functions . /etc/init.d/functions
# Recover AMDOPTS from /etc/sysconfig/amd. [ -e /etc/sysconfig/amd ] && . /etc/sysconfig/amd
if [ -f /etc/sysconfig/amd ] ; then
. /etc/sysconfig/amd
fi
RETVAL=0 DAEMON=amd
prog=amd prog=amd
amd=/usr/sbin/amd exec=/usr/sbin/amd
config=/etc/amd.conf
optconfig=/etc/sysconfig/amd
lockfile=/var/lock/subsys/$DAEMON
start() { [ -e $optconfig ] && . $optconfig
echo -n $"Starting $prog: "
daemon $amd -F /etc/amd.conf $AMDOPTS $OPTIONS $MOUNTPTS check() {
RETVAL=$? # Check that we're a privileged user
echo [ $(id -u) -eq 0 ] || exit 4
[ $RETVAL = 0 ] && touch /var/lock/subsys/amd
return $RETVAL
} }
stop() { start () {
echo -n $"Stopping $prog: " check
killproc $amd -TERM [ -x $exec ] || exit 5
# this part is from wait4amd2die [ -f $config ] || exit 6
[ -f $optconfig ] || exit 6
echo -n $"Starting $prog: "
daemon $exec -F $config $AMDOPTS $OPTIONS $MOUNTPTS
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop () {
check
echo -n $"Stopping $prog: "
killproc $exec
delay=3 delay=3
count=10 count=10
i=1 i=1
retval=1
maxcount=`expr $count + 1` maxcount=`expr $count + 1`
while [ $i != $maxcount ]; do while [ $i != $maxcount ]; do
# run amq # run amq
/usr/sbin/amq > /dev/null 2>&1 /usr/sbin/amq > /dev/null 2>&1
if [ $? != 0 ] if [ $? != 0 ]; then
then
# amq failed to run (because amd is dead) # amq failed to run (because amd is dead)
rm -f /var/lock/subsys/amd /var/run/amd.pid retval=0
echo break
return 0
fi fi
sleep $delay sleep $delay
i=`expr $i + 1` i=`expr $i + 1`
done done
failure $"amd shutdown"
echo echo
echo "amd is still up" [ $retval -eq 0 ] && rm -f $lockfile
return 1 return $retval
} }
# See how we were called.
case "$1" in restart() {
start)
start
;;
stop)
stop
;;
status)
status $amd
RETVAL=$?
;;
restart)
stop stop
start start
}
reload() {
restart
}
force_reload() {
restart
}
rh_status() {
status $DAEMON
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;; ;;
condrestart) stop)
if [ -f /var/lock/subsys/amd ]; then rh_status_q || exit 0
stop $1
start ;;
fi restart)
$1
;; ;;
reload) reload)
action $"Reloading $prog:" killall -HUP $amd rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;; ;;
*) *)
echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}" echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 1 exit 2
esac esac
exit $?
exit $RETVAL

View File

@ -1,7 +1,7 @@
Summary: Automount utilities including an updated version of Amd Summary: Automount utilities including an updated version of Amd
Name: am-utils Name: am-utils
Version: 6.1.5 Version: 6.1.5
Release: 14%{?dist} Release: 15%{?dist}
License: BSD License: BSD
Epoch: 5 Epoch: 5
Group: System Environment/Daemons Group: System Environment/Daemons
@ -177,6 +177,9 @@ fi
%{_libdir}/libamu.so* %{_libdir}/libamu.so*
%changelog %changelog
* Wed Feb 24 2010 Karel Zak <kzak@redhat.com> 5:6.1.5-15
- fix #523221 - initscript collected problems LSB-compilant
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5:6.1.5-14 * Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5:6.1.5-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild