- (bal) First wave of contrib/solaris/ package upgrades. Still more
work needs to be done, but it is a 190% better then the stuff we
had before!
diff --git a/contrib/solaris/opensshd.in b/contrib/solaris/opensshd.in
new file mode 100755
index 0000000..057459b
--- /dev/null
+++ b/contrib/solaris/opensshd.in
@@ -0,0 +1,88 @@
+#!/sbin/sh
+# Donated code that was put under PD license.
+#
+# Stripped PRNGd out of it for the time being.
+
+AWK=/usr/bin/awk
+CAT=/usr/bin/cat
+EGREP=/usr/bin/egrep
+KILL=/usr/bin/kill
+PS=/usr/bin/ps
+
+PREFIX=%%openSSHDir%%
+ETCDIR=%%configDir%%
+
+SSHD=$PREFIX/sbin/sshd
+SSH_KEYGEN=$PREFIX/bin/ssh-keygen
+HOST_KEY_RSA1=$ETCDIR/ssh_host_key
+HOST_KEY_DSA=$ETCDIR/ssh_host_dsa_key
+HOST_KEY_RSA=$ETCDIR/ssh_host_rsa_key
+
+killproc() {
+ _procname=$1
+ _signal=$2
+ ${PGREP} ${_procname} | ${HEAD} -1 | ${XARGS} -t -I {} ${KILL} -${_signal} {}
+}
+
+
+checkkeys() {
+ if [ ! -f $HOST_KEY_RSA1 ]; then
+ $SSH_KEYGEN -t rsa1 -f $HOST_KEY_RSA1 -N ""
+ fi
+ if [ ! -f $HOST_KEY_DSA ]; then
+ $SSH_KEYGEN -t dsa -f $HOST_KEY_DSA -N ""
+ fi
+ if [ ! -f $HOST_KEY_RSA ]; then
+ $SSH_KEYGEN -t rsa -f $HOST_KEY_RSA -N ""
+ fi
+}
+
+stop_service() {
+ if [ -r $PIDFILE -a ! -z ${PIDFILE} ]; then
+ PID=`cat ${PIDFILE}`
+ fi
+ if [ ${PID:=0} -gt 1 -a ! "X$PID" = "X " ]; then
+ $KILL $PID
+ else
+ echo "Unable to read PID file, killing using alternate method"
+ killproc sshd TERM
+ fi
+}
+
+start_service() {
+ # XXX We really should check if the service is already going, but
+ # XXX we will opt out at this time. - Bal
+
+ # Check to see if we have keys that need to be made
+ checkkeys
+
+ # Start SSHD
+ echo "starting $SSHD... \c" ; $SSHD
+
+ sshd_rc=$?
+ if [ $sshd_rc -ne 0 ]; then
+ echo "$0: Error ${sshd_rc} starting ${SSHD}... bailing."
+ exit $sshd_rc
+ fi
+ echo done.
+}
+
+case $1 in
+
+'start')
+ start_service
+ ;;
+
+'stop')
+ stop_service
+ ;;
+
+'restart')
+ stop_service
+ start_service
+ ;;
+
+*)
+ echo "$0: usage: $0 {start|stop|restart}"
+ ;;
+esac