PATCH: make contrib/redhat/sshd.init work with older RH releases

Pekka Savola pekkas at netcore.fi
Sun Feb 18 02:14:34 EST 2001


On Fri, 16 Feb 2001, Jim Knoble wrote:
> Attached is a patch to contrib/redhat/sshd.init which eliminates the
> dependency on the success() and failure() functions from
> initscripts>=4.16.  This allows sshd.init to be used for both early and
> recent releases of Red Hat Linux (i've confirmed it works on both 4.2
> and 5.2 as well as 6.2).
>
> The patch also removes the 'Requires: initscripts >= 4.16' line from
> contrib/redhat/openssh.spec.
>
> After inspecting and applying, you ought to be able to remove
> contrib/redhat/sshd.init-5.x.

IMO, this is a wrong way to do this.

Rather, if we want to do this, I propose something like (sshd-funcs may
not be the best name to describe this..):

--- sshd~       Sat Feb 17 16:16:33 2001
+++ sshd        Sat Feb 17 17:07:00 2001
@@ -15,6 +15,9 @@
 # source function library
 . /etc/rc.d/init.d/functions

+# source local sshd functions
+. /etc/rc.d/init.d/sshd-funcs
+
 RETVAL=0
 prog="sshd"
---
[no further changes in the main file!]

Where sshd-funcs would redefine success, failure, action, and whatever
other things that might come up, with something of it's own, like:

---
if [ ! "`type -type success`" = "function" ]; then
  my_success "$*"
fi

if [ ! "`type -type failure`" = "function" ]; then
  my_failure "$*"
fi

my_success() {
  local msg
  if [ $# -gt 1 ]; then
    msg="$2"
  else
    msg="done"
  fi
  case "`type -type success`" in
    function)
      success "$1"
    ;;
    *)
      echo -n "${msg}"
    ;;
  esac
}

my_failure() {
  local msg
  if [ $# -gt 1 ]; then
    msg="$2"
  else
    msg="FAILED"
  fi
  case "`type -type failure`" in
    function)
      failure "$1"
    ;;
    *)
      echo -n "${msg}"
    ;;
  esac
}
---

-- 
Pekka Savola                  "Tell me of difficulties surmounted,
Netcore Oy                    not those you stumble over and fall"
Systems. Networks. Security.   -- Robert Jordan: A Crown of Swords






More information about the openssh-unix-dev mailing list