diff options
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/solaris/buildpkg.sh | 9 | ||||
-rwxr-xr-x | contrib/solaris/opensshd.in | 16 |
2 files changed, 15 insertions, 10 deletions
diff --git a/contrib/solaris/buildpkg.sh b/contrib/solaris/buildpkg.sh index a71417075..05abb2236 100755 --- a/contrib/solaris/buildpkg.sh +++ b/contrib/solaris/buildpkg.sh | |||
@@ -24,6 +24,7 @@ make install-nokeys DESTDIR=$FAKE_ROOT | |||
24 | ## Fill in some details, like prefix and sysconfdir | 24 | ## Fill in some details, like prefix and sysconfdir |
25 | ETCDIR=`grep "^sysconfdir=" Makefile | sed 's/sysconfdir=//'` | 25 | ETCDIR=`grep "^sysconfdir=" Makefile | sed 's/sysconfdir=//'` |
26 | PREFIX=`grep "^prefix=" Makefile | cut -d = -f 2` | 26 | PREFIX=`grep "^prefix=" Makefile | cut -d = -f 2` |
27 | PIDDIR=`grep "^piddir=" Makefile | cut -d = -f 2` | ||
27 | cd $FAKE_ROOT | 28 | cd $FAKE_ROOT |
28 | 29 | ||
29 | ## Setup our run level stuff while we are at it. | 30 | ## Setup our run level stuff while we are at it. |
@@ -37,12 +38,14 @@ mkdir -p $FAKE_ROOT/etc/rc2.d | |||
37 | ## setup our initscript correctly | 38 | ## setup our initscript correctly |
38 | sed -e "s#%%configDir%%#$ETCDIR#g" \ | 39 | sed -e "s#%%configDir%%#$ETCDIR#g" \ |
39 | -e "s#%%openSSHDir%%#$PREFIX#g" \ | 40 | -e "s#%%openSSHDir%%#$PREFIX#g" \ |
41 | -e "s#%%pidDir%%#$PIDDIR#g" \ | ||
40 | ../opensshd.in > $FAKE_ROOT/etc/init.d/opensshd | 42 | ../opensshd.in > $FAKE_ROOT/etc/init.d/opensshd |
41 | chmod 711 $FAKE_ROOT/etc/init.d/opensshd | 43 | chmod 711 $FAKE_ROOT/etc/init.d/opensshd |
42 | 44 | ||
43 | ln -s $FAKE_ROOT/etc/init.d/opensshd $FAKE_ROOT/etc/rcS.d/K30opensshd | 45 | ln -s ../init.d/opensshd $FAKE_ROOT/etc/rcS.d/K30opensshd |
44 | ln -s $FAKE_ROOT/etc/init.d/opensshd $FAKE_ROOT/etc/rc1.d/K30opensshd | 46 | ln -s ../init.d/opensshd $FAKE_ROOT/etc/rc0.d/K30opensshd |
45 | ln -s $FAKE_ROOT/etc/init.d/opensshd $FAKE_ROOT/etc/rc2.d/S98opensshd | 47 | ln -s ../init.d/opensshd $FAKE_ROOT/etc/rc1.d/K30opensshd |
48 | ln -s ../init.d/opensshd $FAKE_ROOT/etc/rc2.d/S98opensshd | ||
46 | 49 | ||
47 | 50 | ||
48 | ## Ok, this is outright wrong, but it will work. I'm tired of pkgmk | 51 | ## Ok, this is outright wrong, but it will work. I'm tired of pkgmk |
diff --git a/contrib/solaris/opensshd.in b/contrib/solaris/opensshd.in index d1d573eb8..212254dc8 100755 --- a/contrib/solaris/opensshd.in +++ b/contrib/solaris/opensshd.in | |||
@@ -5,14 +5,16 @@ | |||
5 | 5 | ||
6 | AWK=/usr/bin/awk | 6 | AWK=/usr/bin/awk |
7 | CAT=/usr/bin/cat | 7 | CAT=/usr/bin/cat |
8 | EGREP=/usr/bin/egrep | ||
9 | KILL=/usr/bin/kill | 8 | KILL=/usr/bin/kill |
10 | PS=/usr/bin/ps | 9 | PS=/usr/bin/ps |
10 | XARGS=/usr/bin/xargs | ||
11 | 11 | ||
12 | prefix=%%openSSHDir%% | 12 | prefix=%%openSSHDir%% |
13 | etcdir=%%configDir%% | 13 | etcdir=%%configDir%% |
14 | piddir=%%pidDir%% | ||
14 | 15 | ||
15 | SSHD=$prefix/sbin/sshd | 16 | SSHD=$prefix/sbin/sshd |
17 | PIDFILE=$piddir/sshd.pid | ||
16 | SSH_KEYGEN=$prefix/bin/ssh-keygen | 18 | SSH_KEYGEN=$prefix/bin/ssh-keygen |
17 | HOST_KEY_RSA1=$etcdir/ssh_host_key | 19 | HOST_KEY_RSA1=$etcdir/ssh_host_key |
18 | HOST_KEY_DSA=$etcdir/ssh_host_dsa_key | 20 | HOST_KEY_DSA=$etcdir/ssh_host_dsa_key |
@@ -21,28 +23,28 @@ HOST_KEY_RSA=$etcdir/ssh_host_rsa_key | |||
21 | killproc() { | 23 | killproc() { |
22 | _procname=$1 | 24 | _procname=$1 |
23 | _signal=$2 | 25 | _signal=$2 |
24 | ${PGREP} ${_procname} | ${HEAD} -1 | ${XARGS} -t -I {} ${KILL} -${_signal} {} | 26 | ${PS} -u root | ${AWK} '/'"$_procname"'$/ {print $1}' | ${XARGS} ${KILL} |
25 | } | 27 | } |
26 | 28 | ||
27 | 29 | ||
28 | checkkeys() { | 30 | checkkeys() { |
29 | if [ ! -f $HOST_KEY_RSA1 ]; then | 31 | if [ ! -f $HOST_KEY_RSA1 ]; then |
30 | $SSH_KEYGEN -t rsa1 -f $HOST_KEY_RSA1 -N "" | 32 | ${SSH_KEYGEN} -t rsa1 -f ${HOST_KEY_RSA1} -N "" |
31 | fi | 33 | fi |
32 | if [ ! -f $HOST_KEY_DSA ]; then | 34 | if [ ! -f $HOST_KEY_DSA ]; then |
33 | $SSH_KEYGEN -t dsa -f $HOST_KEY_DSA -N "" | 35 | ${SSH_KEYGEN} -t dsa -f ${HOST_KEY_DSA} -N "" |
34 | fi | 36 | fi |
35 | if [ ! -f $HOST_KEY_RSA ]; then | 37 | if [ ! -f $HOST_KEY_RSA ]; then |
36 | $SSH_KEYGEN -t rsa -f $HOST_KEY_RSA -N "" | 38 | ${SSH_KEYGEN} -t rsa -f ${HOST_KEY_RSA} -N "" |
37 | fi | 39 | fi |
38 | } | 40 | } |
39 | 41 | ||
40 | stop_service() { | 42 | stop_service() { |
41 | if [ -r $PIDFILE -a ! -z ${PIDFILE} ]; then | 43 | if [ -r $PIDFILE -a ! -z ${PIDFILE} ]; then |
42 | PID=`cat ${PIDFILE}` | 44 | PID=`${CAT} ${PIDFILE}` |
43 | fi | 45 | fi |
44 | if [ ${PID:=0} -gt 1 -a ! "X$PID" = "X " ]; then | 46 | if [ ${PID:=0} -gt 1 -a ! "X$PID" = "X " ]; then |
45 | $KILL $PID | 47 | ${KILL} ${PID} |
46 | else | 48 | else |
47 | echo "Unable to read PID file, killing using alternate method" | 49 | echo "Unable to read PID file, killing using alternate method" |
48 | killproc sshd TERM | 50 | killproc sshd TERM |