From f013bee3ece272555de8831634b39965f6fd7be9 Mon Sep 17 00:00:00 2001 From: "Jan F. Chadima" Date: Thu, 24 Sep 2009 16:05:27 +0000 Subject: [PATCH] Repair initscript to be acord to guidelines --- openssh.spec | 4 ++-- sshd.init | 25 +++++++++++++------------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/openssh.spec b/openssh.spec index 4dae781..7aff002 100644 --- a/openssh.spec +++ b/openssh.spec @@ -63,7 +63,7 @@ Summary: An open source implementation of SSH protocol versions 1 and 2 Name: openssh Version: 5.2p1 -Release: 27%{?dist}%{?rescue_rel} +Release: 28%{?dist}%{?rescue_rel} URL: http://www.openssh.com/portable.html #Source0: ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-%{version}.tar.gz #Source1: ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-%{version}.tar.gz.asc @@ -466,7 +466,7 @@ fi %endif %changelog -* Thu Sep 24 2009 Jan F. Chadima - 5.2p1-27 +* Thu Sep 24 2009 Jan F. Chadima - 5.2p1-28 - Repair initscript to be acord to guidelines (#521860) - Add bugzilla# to application of edns and xmodifiers patch diff --git a/sshd.init b/sshd.init index 8259660..72d3512 100755 --- a/sshd.init +++ b/sshd.init @@ -107,7 +107,7 @@ do_restart_sanity_check() { $SSHD -t RETVAL=$? - if [ ! "$RETVAL" = 0 ]; then + if [ $RETVAL -ne 0 ]; then failure $"Configuration file or keys are invalid" echo fi @@ -127,7 +127,7 @@ start() echo -n $"Starting $prog: " $SSHD $OPTIONS && success || failure RETVAL=$? - [ "$RETVAL" = 0 ] && touch $lockfile + [ $RETVAL -eq 0 ] && touch $lockfile echo return $RETVAL } @@ -148,7 +148,7 @@ stop() killall $prog 2>/dev/null trap TERM fi - [ "$RETVAL" = 0 ] && rm -f $lockfile + [ $RETVAL -eq 0 ] && rm -f $lockfile echo } @@ -174,7 +174,7 @@ force_reload() { } rh_status() { - status -p $PID_FILE $prog #openssh-daemon + status -p $PID_FILE openssh-daemon } rh_status_q() { @@ -187,7 +187,10 @@ case "$1" in start ;; stop) - rh_status_q || exit 0 + if ! rh_status_q; then + rm -f $lockfile + exit 0 + fi stop ;; restart) @@ -200,16 +203,11 @@ case "$1" in force-reload) force_reload ;; - condrestart) - if [ -f /var/lock/subsys/$prog ]; then - restart - fi - ;; - try-restart) + condrestart|try-restart) rh_status_q || exit 0 if [ -f $lockfile ] ; then do_restart_sanity_check - if [ "$RETVAL" = 0 ] ; then + if [ $RETVAL -eq 0 ] ; then stop # avoid race sleep 3 @@ -222,6 +220,9 @@ case "$1" in status) rh_status RETVAL=$? + if [ $RETVAL -eq 3 -a -f $lockfile ] ; then + RETVAL=2 + fi ;; *) echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"