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

View File

@ -1,7 +1,7 @@
Summary: Automount utilities including an updated version of Amd
Name: am-utils
Version: 6.1.5
Release: 14%{?dist}
Release: 15%{?dist}
License: BSD
Epoch: 5
Group: System Environment/Daemons
@ -177,6 +177,9 @@ fi
%{_libdir}/libamu.so*
%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
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild