summaryrefslogtreecommitdiff
path: root/contrib/solaris
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-08-18 14:43:41 +1000
committerDamien Miller <djm@mindrot.org>2000-08-18 14:43:41 +1000
commita7f58293f7340fc022c025b482614d5bd8dada50 (patch)
tree85500ec7087d95a5aba61bb2ac24c526d7cd48d4 /contrib/solaris
parent681062a6b347383768ddf62c30ca468c2829c329 (diff)
- (djm) Add Solaris package support from Rip Loomis <loomisg@cist.saic.com>
Diffstat (limited to 'contrib/solaris')
-rw-r--r--contrib/solaris/README82
-rwxr-xr-xcontrib/solaris/build-pkg207
-rw-r--r--contrib/solaris/checkinstall.in37
-rw-r--r--contrib/solaris/pkginfo.in17
-rw-r--r--contrib/solaris/postinstall.in198
-rw-r--r--contrib/solaris/preremove2
-rw-r--r--contrib/solaris/prototype26
-rwxr-xr-xcontrib/solaris/sshd-initscript.in50
8 files changed, 619 insertions, 0 deletions
diff --git a/contrib/solaris/README b/contrib/solaris/README
new file mode 100644
index 000000000..e5445c3ac
--- /dev/null
+++ b/contrib/solaris/README
@@ -0,0 +1,82 @@
1README for OpenSSH Solaris packaging scripts
2Rip Loomis <loomisg@saic.com> - 2000-08-02
3
4To use, simply expand this tarball under your main
5OpenSSH source directory--it will create a
6contrib/solaris subdirectory. Run configure and
7make in OpenSSH as before. Then, from either
8that directory or the main OpenSSH source directory,
9run the command "build-pkg" (specifying the
10appropriate path of course.) A subdirectory
11will be created as contrib/solaris/build-SSH-package,
12and after the build is done the package will be
13present in that build-SSH-package directory
14with a name of the form
15OPENssh-$SSHversion-$arch-$OSversion[-$installLocation]
16
17The build and install scripts should take into account
18most possible situations (existing SSH installation,
19differences in Solaris version between build and
20target systems, changes you have made to the default
21configuration, etc.) I would appreciate any feedback
22or comments.
23
24Copyright information is included below, followed by the known issue list.
25Both are taken verbatim from the "build-pkg" script.
26
27# OpenSSH solaris build script and supporting data files
28# Copyright (c) 2000 Rip Loomis and
29# Science Applications International Corporation (SAIC)
30# (http://www.cist-east.saic.com). All rights reserved.
31#
32# Redistribution and use in source and binary forms, with or without
33# modification, are permitted provided that the following conditions
34# are met:
35# 1. Redistributions of source code must retain the above copyright
36# notice, this list of conditions and the following disclaimer.
37# 2. Redistributions in binary form must reproduce the above copyright
38# notice, this list of conditions and the following disclaimer in the
39# documentation and/or other materials provided with the distribution.
40# 3. The name of the author may not be used to endorse or promote products
41# derived from this software without specific prior written permission.
42#
43# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
44# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
45# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
46# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
47# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
52# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53
54# Obviously, without all the hard work of the OpenBSD OpenSSH developers
55# and the OpenSSH Portability Team, these scripts would be pointless...
56# so thanks again folks!
57#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
58
59#### Known issues
60# These methods are generally based on a "default" compilation of
61# OpenSSH on Solaris--so the more things that you change from the default,
62# the greater the chance that something in the script won't be able to
63# handle the changes. In general, though, most things should be determined
64# from your compile environment--the architecture, SSH version, and
65# other related data should all get picked up by this script. The script
66# and data files were last updated to match OpenSSH 2.1.1p4.
67#
68# All building and packaging is done under a temporary directory that is
69# itself created under the contrib/solaris directory--so there shouldn't
70# be any special security issues (or need for root access during the
71# packaging process). The temporary directory is defined below as
72# ${BUILDDIR}.
73#
74# The permissions on the installed files are based on how we prefer to
75# do things here--so nothing is installed SetUID to root.
76#
77# The post-install script makes a good-faith attempt to install a
78# functional configuration on your system. I would be interested in hearing
79# of any failure modes that are found, as I tried to compensate for all
80# the ones that showed up here when we started replacing all the
81# different installed versions of SSH.
82
diff --git a/contrib/solaris/build-pkg b/contrib/solaris/build-pkg
new file mode 100755
index 000000000..5f2e3addd
--- /dev/null
+++ b/contrib/solaris/build-pkg
@@ -0,0 +1,207 @@
1#!/bin/sh
2
3# OpenSSH solaris build script and supporting data files
4# Copyright (c) 2000 Rip Loomis and
5# Science Applications International Corporation (SAIC)
6# (http://www.cist-east.saic.com). All rights reserved.
7#
8# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions
10# are met:
11# 1. Redistributions of source code must retain the above copyright
12# notice, this list of conditions and the following disclaimer.
13# 2. Redistributions in binary form must reproduce the above copyright
14# notice, this list of conditions and the following disclaimer in the
15# documentation and/or other materials provided with the distribution.
16# 3. The name of the author may not be used to endorse or promote products
17# derived from this software without specific prior written permission.
18#
19# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30# Obviously, without all the hard work of the OpenBSD OpenSSH developers
31# and the OpenSSH Portability Team, these scripts would be pointless...
32# so thanks again folks!
33#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
34
35#### Known issues
36# These methods are generally based on a "default" compilation of
37# OpenSSH on Solaris--so the more things that you change from the default,
38# the greater the chance that something in the script won't be able to
39# handle the changes. In general, though, most things should be determined
40# from your compile environment--the architecture, SSH version, and
41# other related data should all get picked up by this script. The script
42# and data files were last updated to match OpenSSH 2.1.1p4.
43#
44# All building and packaging is done under a temporary directory that is
45# itself created under the contrib/solaris directory--so there shouldn't
46# be any special security issues (or need for root access during the
47# packaging process). The temporary directory is defined below as
48# ${BUILDDIR}.
49#
50# The permissions on the installed files are based on how we prefer to
51# do things here--so nothing is installed SetUID to root.
52#
53# The post-install script makes a good-faith attempt to install a
54# functional configuration on your system. I would be interested in hearing
55# of any failure modes that are found, as I tried to compensate for all
56# the ones that showed up here when we started replacing all the
57# different installed versions of SSH.
58
59#### Body of the script (finally!)
60# We expect to be building the solaris package under the contrib/solaris
61# directory--but the build-package script might be run with a relative
62# path by a user in the main SSH directory...so we try to handle this
63# case. Note that this is still a quick and dirty solution, not robust.
64
65if [ -f sshd.c ]; then
66 cd contrib/solaris >/dev/null
67fi
68
69# Locations of standard binaries
70UNAME=/usr/bin/uname
71SED=/usr/bin/sed
72PWD=/usr/bin/pwd
73CUT=/usr/bin/cut
74STRIP=/usr/ccs/bin/strip
75PKGMK=/usr/bin/pkgmk
76PKGTRANS=/usr/bin/pkgtrans
77GREP=/usr/bin/grep
78DATE=/usr/bin/date
79
80CURRDIR=`${PWD}`
81BUILDDIR=${CURRDIR}/build-SSH-package
82# If you really want to name the package "ssh" then go ahead, but the
83# Sun convention is that the first 2-4 characters are supposed to be
84# uppercase representing the company or organization that produced the
85# software, and the next 3-5 characters are supposed to be lowercase
86# identifying the specific software. The best package names I could
87# come up with were "OBSDssh" or "OPENssh", given those constraints.
88PKGNAME="OPENssh"
89# PSTAMP is a standard setting in the 'pkginfo' file that helps to identify
90# the time and location that the packaging was done.
91PSTAMP="`${UNAME} -n`-`${DATE} +%Y-%m-%d-%H%M`"
92# The several lines below are designed to pull the relevant information
93# out of the Makefile. It may be simpler to hard-code this if you have
94# made changes and these lines don't find them.
95prefix=`${GREP} "^prefix=" ../../Makefile | ${CUT} -d = -f 2`
96execprefix=`${GREP} "^execprefix=" ../../Makefile | ${CUT} -d = -f 2`
97INSTROOT=${prefix:=/usr/local}
98ETCDIR=`${GREP} "^ETCDIR=" ../../Makefile | ${CUT} -d = -f 2`
99PIDDIR=`${GREP} "^piddir=" ../../Makefile | ${CUT} -d = -f 2`
100
101if [ ! -f ../../sshd ]; then
102 echo "Unable to locate sshd binary where I expected, and can't continue."
103 echo "Verify that the SSH configure/make has been completed, and that"
104 echo " this script is being run from within the SSH source tree."
105 exit 1
106fi
107
108
109VERSION=`${GREP} "SSH_VERSION" ../../version.h | ${CUT} -f 2 | sed -e 's/"//g' -e 's/OpenSSH_//g'`
110# Extra shenanigans to compensate for Sun marketeer tricks with Solaris
111# version numbering...
112OSMINOR=`${UNAME} -r | ${CUT} -f 2 -d .`
113if [ $OSMINOR -gt 6 ]; then
114 OSVERSION=$OSMINOR
115else
116 OSVERSION=`${UNAME} -r | ${SED} 's/5/2/'`
117fi
118ARCH=`$UNAME -p`
119SHORTINSTROOT=""
120if [ "$INSTROOT" = "/usr/local" ]; then
121 SHORTINSTROOT="-local"
122else
123 if [ "$INSTROOT" = "/opt" ]; then
124 SHORTINSTROOT="-opt"
125 fi
126fi
127
128DESTFILE="${PKGNAME}-${VERSION}-sol${OSVERSION}-${ARCH}${SHORTINSTROOT}"
129
130echo "Building Solaris package of OpenSSH ${VERSION} in\n\t${BUILDDIR}."
131echo "Binaries were compiled for Solaris ${OSVERSION} (${ARCH})"
132echo "The installable package will be named ${DESTFILE}."
133echo "When installed, the package will be located under ${INSTROOT}."
134echo ""
135
136echo "Cleaning up old build files..."
137rm -rf $BUILDDIR
138mkdir $BUILDDIR
139cd $BUILDDIR
140
141echo "Setting up build directories..."
142mkdir -p ${BUILDDIR}/man/man1
143# Need manpages for sshd_config(5) and ssh_config(5), but we don't yet have.
144#mkdir -p ${BUILDDIR}/man/man5
145mkdir -p ${BUILDDIR}/man/man8
146mkdir -p ${BUILDDIR}/etc
147mkdir -p ${BUILDDIR}/bin
148mkdir -p ${BUILDDIR}/sbin
149
150echo "Populating build directories..."
151cp -p ../../../sshd sbin
152cp -p ../../../ssh-keygen bin
153cp -p ../../../ssh bin
154cp -p ../../../ssh-add bin
155cp -p ../../../ssh-agent bin
156cp -p ../../../scp bin
157cp -p ../../../scp.1 man/man1/scp.1
158cp -p ../../../ssh-add.1 man/man1/ssh-add.1
159cp -p ../../../ssh-agent.1 man/man1/ssh-agent.1
160cp -p ../../../ssh-keygen.1 man/man1/ssh-keygen.1
161cp -p ../../../ssh.1 man/man1/ssh.1
162cp -p ../../../sshd.8 man/man8/sshd.8
163cp -p ../../../sshd_config.out etc/sshd_config.default
164cp -p ../../../ssh_config.out etc/ssh_config.default
165cp -p ../../../ssh_prng_cmds etc/ssh_prng_cmds.default
166
167# One of the annoying things about the Solaris packaging process is that
168# there's no simple way to prototype on the fly--so make sure you edit
169# the prototype file if you add/subtract files from the mix.
170cp -p ../prototype .
171cp -p ../preremove .
172
173echo "Creating compile-dependent files from their prototypes"
174$SED -e "s/%%PKGNAME%%/${PKGNAME}/g" -e "s|%%BASEDIR%%|${INSTROOT}|g" -e "s/%%VERSION%%/${VERSION}/g" -e "s/%%ARCH%%/${ARCH}/g" -e "s/%%OSVERSION%%/${OSVERSION}/g" <../pkginfo.in >./pkginfo
175$SED -e "s/%%PKGNAME%%/${PKGNAME}/g" -e "s/%%OSMINOR%%/${OSMINOR}/g" -e "s/%%OSVERSION%%/${OSVERSION}/g" <../checkinstall.in >./checkinstall
176$SED -e "s|%%PIDDIR%%|${PIDDIR}|g" <../postinstall.in >./postinstall
177$SED -e "s|%%PIDDIR%%|${PIDDIR}|g" <../sshd-initscript.in > etc/sshd-initscript
178
179echo "Stripping binaries"
180${STRIP} bin/ssh
181${STRIP} bin/ssh-add
182${STRIP} bin/ssh-agent
183${STRIP} bin/ssh-keygen
184${STRIP} sbin/sshd
185${STRIP} bin/scp
186
187echo ""
188echo "Building Package"
189
190cd ${BUILDDIR}
191$PKGMK -o -r . -p ${PSTAMP} -d ${BUILDDIR}
192
193if [ $? -gt 0 ]; then
194 echo "Error performing pkgmk--cannot continue."
195 exit 1
196fi
197
198echo ""
199echo "Translating Package Tree into Installable Image"
200$PKGTRANS -s ${BUILDDIR} ${BUILDDIR}/${DESTFILE} OPENssh
201
202if [ $? -gt 0 ]; then
203 echo "Error performing pkgtrans--cannot continue."
204 exit 1
205fi
206
207echo "Done. Package is in ${BUILDDIR}/${DESTFILE} !"
diff --git a/contrib/solaris/checkinstall.in b/contrib/solaris/checkinstall.in
new file mode 100644
index 000000000..37571936a
--- /dev/null
+++ b/contrib/solaris/checkinstall.in
@@ -0,0 +1,37 @@
1#!/bin/sh
2echo "Checking SunOS revision..."
3MINOR=`/bin/uname -r | /bin/cut -d "." -f 2`
4if [ ${MINOR} -lt %%OSMINOR%% ]; then
5 echo "This package was created on Solaris %%OSVERSION%%, and will probably"
6 echo " not function correctly on older versions of Solaris."
7 echo "** Unable to continue. **"
8 exit 3
9fi
10echo "\t...revision okay."
11
12echo "Checking for existing SSH installation..."
13if [ -f /etc/sshd_config -o -f /usr/local/etc/sshd_config ]; then
14 UPDATE=1
15fi
16if [ -f /etc/ssh_host_key -o -f /usr/local/etc/ssh_host_key ]; then
17 UPDATE=1
18fi
19
20if [ ${UPDATE} -eq 1 ]; then
21 echo "Performing an \"update\" installation of %%PKGNAME%%"
22else
23 echo "Performing a \"fresh\" installation of %%PKGNAME%%"
24fi
25echo ""
26
27# We derive these at install time in case the package is relocated.
28CONFDIR="${BASEDIR}/etc"
29DESTBIN="${BASEDIR}/bin"
30
31# make parameters available to installation service, and
32# so to any other packaging scripts
33cat >$1 <<!
34CONFDIR='$CONFDIR'
35DESTBIN='$DESTBIN'
36UPDATE='$UPDATE'
37!
diff --git a/contrib/solaris/pkginfo.in b/contrib/solaris/pkginfo.in
new file mode 100644
index 000000000..4953d7d8e
--- /dev/null
+++ b/contrib/solaris/pkginfo.in
@@ -0,0 +1,17 @@
1CLASSES=none
2BASEDIR="%%BASEDIR%%"
3PATH=/sbin:/usr/sbin:/usr/bin:/usr/sadm/install/bin
4OAMBASE=/usr/sadm/sysadm
5PKG=%%PKGNAME%%
6NAME="OpenSSH %%VERSION%% %%ARCH%%"
7DESC="Secure Shell remote access utility; replaces telnet and rlogin/rsh. OpenBSD version ported to Solaris. Compiled on Solaris %%OSVERSION%%"
8ARCH="%%ARCH%%"
9VERSION="%%VERSION%%"
10CATEGORY=utility,application
11VENDOR="Software produced by OpenSSH Portability Team, http://www.openssh.com/portable.html"
12EMAIL="OpenSSH Development List <openssh-unix-dev@mindrot.org>"
13PKGINST=%%PKGNAME%%
14PKGSAV=/var/sadm/pkg/%%PKGNAME%%/save
15ISTATES="S s 1 2 3"
16RSTATES="S s 1 2 3"
17UPDATE=0
diff --git a/contrib/solaris/postinstall.in b/contrib/solaris/postinstall.in
new file mode 100644
index 000000000..58d773f87
--- /dev/null
+++ b/contrib/solaris/postinstall.in
@@ -0,0 +1,198 @@
1# PostInstall script for OPENssh
2INSTALLF="/usr/sbin/installf"
3
4instbackup() {
5 _DIRECTORY=$1
6 _FILEBASE=$2
7 $INSTALLF $PKGINST ${_DIRECTORY}/${_FILEBASE}
8 _SUFFIX=`/usr/bin/date +%Y-%m-%d-%H%M`
9 if [ -f ${_DIRECTORY}/${_FILEBASE} ]; then
10 echo " Backing up file ${_FILEBASE}..."
11 if [ -f ${_DIRECTORY}/${_FILEBASE}.orig ]; then
12 $INSTALLF $PKGINST ${_DIRECTORY}/${_FILEBASE}.orig.${_SUFFIX}
13 cp -p ${_DIRECTORY}/${_FILEBASE} ${_DIRECTORY}/${_FILEBASE}.orig.${_SUFFIX}
14 echo " Saved as ${_DIRECTORY}/${_FILEBASE}.orig.${_SUFFIX}."
15 else
16 $INSTALLF $PKGINST ${_DIRECTORY}/${_FILEBASE}.orig
17 cp -p ${_DIRECTORY}/${_FILEBASE} ${_DIRECTORY}/${_FILEBASE}.orig
18 echo " Saved as ${_DIRECTORY}/${_FILEBASE}.orig."
19 fi
20 fi
21 cp -p ${_DIRECTORY}/${_FILEBASE}.default ${_DIRECTORY}/${_FILEBASE}
22 echo "Installed new ${_DIRECTORY}/${_FILEBASE} configuration file."
23}
24
25### Main body of script
26
27echo ""
28echo "Beginning postinstall script--this script should leave you with a"
29echo "functional and operational configuration of OpenSSH."
30echo ""
31
32if [ ! "${UPDATE}" = "1" ]; then
33 echo "Performing a \"fresh\" installation of OpenSSH."
34 ### Install init script and create symlinks
35 $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/init.d/sshd f 0500 root sys || exit 2
36 cp -p ${CONFDIR}/sshd-initscript ${PKG_INSTALL_ROOT}/etc/init.d/sshd
37 $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/rc2.d/S72local_sshd=/etc/init.d/sshd s || exit 2
38 $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/rc1.d/K30local_sshd=/etc/init.d/sshd s || exit 2
39 $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/rc0.d/K30local_sshd=/etc/init.d/sshd s || exit 2
40
41 ### The initial package installation leaves default versions of
42 ### ssh_prng_cmds, ssh_config, and sshd_config in ${CONFDIR}. Now
43 ### we need to decide whether to install them. Since this is *not*
44 ### an update install, we don't ask, but simply back up the old ones
45 ### and put the new ones in their place.
46 instbackup ${CONFDIR} ssh_prng_cmds
47 instbackup ${CONFDIR} ssh_config
48 instbackup ${CONFDIR} sshd_config
49
50 ### If no existing sshd_config and host key, then create
51 if [ ! -f "${CONFDIR}/ssh_host_key" ]; then
52 echo "Creating new RSA public/private host key pair for SSH-1."
53 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key
54 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key.pub
55 ### If there is *anything* there then leave it, otherwise look
56 ### in some reasonable alternate locations before giving up.
57 ### It's worth spending some extra time looking for the old one
58 ### to avoid a bunch of "host identification has changed" warnings.
59 ### Note that some old keys from the commercial SSH might not
60 ### be compatible, but we don't test for that.
61 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_key" ]; then
62 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_key ${CONFDIR}
63 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key" ]; then
64 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key ${CONFDIR}
65 else
66 ${DESTBIN}/ssh-keygen -b 1024 -f ${CONFDIR}/ssh_host_key -N ''
67 fi
68 else
69 echo "Using existing RSA public/private host key pair for SSH-1."
70 fi
71 if [ ! -f "${CONFDIR}/ssh_host_dsa_key" ]; then
72 echo "Creating new DSA public/private host key pair for SSH-2."
73 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key
74 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key.pub
75 ### If there is *anything* there then leave it, otherwise look
76 ### in some reasonable alternate locations before giving up.
77 ### It's worth spending some extra time looking for the old one
78 ### to avoid a bunch of "host identification has changed" warnings.
79 ### Note that some old keys from the commercial SSH2 might not
80 ### be compatible, but we don't test for that.
81 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key" ]; then
82 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key ${CONFDIR}
83 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key" ]; then
84 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key ${CONFDIR}
85 else
86 ${DESTBIN}/ssh-keygen -d -f ${CONFDIR}/ssh_host_dsa_key -N ''
87 fi
88 else
89 echo "Using existing DSA public/private host key pair for SSH-2."
90 fi
91else
92 echo "Performing an \"update\" installation of OpenSSH."
93 ### Okay, this part *is* an update install...so we need to ensure
94 ### we don't overwrite any of the existing files.
95
96 ### Install init script and create symlinks
97 if [ ! -f ${PKG_INSTALL_ROOT}/etc/init.d/sshd ]; then
98 echo "Installing init script in ${PKG_INSTALL_ROOT}/etc/init.d/sshd"
99 $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/init.d/sshd || exit 2
100 cp -p ${CONFDIR}/sshd-initscript ${PKG_INSTALL_ROOT}/etc/init.d/sshd
101 chown root:root ${PKG_INSTALL_ROOT}/etc/init.d/sshd
102 chmod 500 ${PKG_INSTALL_ROOT}/etc/init.d/sshd
103 fi
104 if [ ! -r ${PKG_INSTALL_ROOT}/etc/rc2.d/S72local_sshd ]; then
105 $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/rc2.d/S72local_sshd=/etc/init.d/sshd s || exit 2
106 fi
107 if [ ! -r ${PKG_INSTALL_ROOT}/etc/rc2.d/K30local_sshd ]; then
108 $INSTALLF $PKGINST /etc/rc0.d/K30local_sshd=/etc/init.d/sshd s || exit 2
109 fi
110
111 ### The initial package installation leaves default versions of
112 ### ssh_prng_cmds, ssh_config, and sshd_config in ${CONFDIR}. Now
113 ### we need to decide whether to install them. Since this is
114 ### an update install, we only install the new files if the old
115 ### files somehow don't exist.
116 NEWCONF=0
117 if [ ! -r "${CONFDIR}/ssh_prng_cmds" ]; then
118 instbackup ${CONFDIR} ssh_prng_cmds
119 NEWCONF=1
120 fi
121 if [ ! -r "${CONFDIR}/ssh_config" ]; then
122 instbackup ${CONFDIR} ssh_config
123 NEWCONF=1
124 fi
125 if [ ! -r "${CONFDIR}/ssh_config" ]; then
126 instbackup ${CONFDIR} sshd_config
127 NEWCONF=1
128 fi
129 if [ $NEWCONF -eq 0 ]; then
130 echo "Your existing SSH configuration files have not been altered."
131 else
132 echo "Your other existing SSH configuration files have not been altered."
133 fi
134
135 ### If no existing sshd_config and host key, then create
136 if [ ! -f "${CONFDIR}/ssh_host_key" ]; then
137 echo "Creating new RSA public/private host key pair for SSH-1."
138 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key
139 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key.pub
140 ### If there is *anything* there then leave it, otherwise look
141 ### in some reasonable alternate locations before giving up.
142 ### It's worth spending some extra time looking for the old one
143 ### to avoid a bunch of "host identification has changed" warnings.
144 ### Note that some old keys from the commercial SSH might not
145 ### be compatible, but we don't test for that.
146 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_key" ]; then
147 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_key ${CONFDIR}
148 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key" ]; then
149 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key ${CONFDIR}
150 else
151 ${DESTBIN}/ssh-keygen -b 1024 -f ${CONFDIR}/ssh_host_key -N ''
152 fi
153 else
154 echo "Using existing RSA public/private host key pair for SSH-1."
155 fi
156 if [ ! -f "${CONFDIR}/ssh_host_dsa_key" ]; then
157 echo "Creating new DSA public/private host key pair for SSH-2."
158 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key
159 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key.pub
160 ### If there is *anything* there then leave it, otherwise look
161 ### in some reasonable alternate locations before giving up.
162 ### It's worth spending some extra time looking for the old one
163 ### to avoid a bunch of "host identification has changed" warnings.
164 ### Note that some old keys from the commercial SSH2 might not
165 ### be compatible, but we don't test for that.
166 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key" ]; then
167 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key ${CONFDIR}
168 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key" ]; then
169 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key ${CONFDIR}
170 else
171 ${DESTBIN}/ssh-keygen -d -f ${CONFDIR}/ssh_host_dsa_key -N ''
172 fi
173 else
174 echo "Using existing DSA public/private host key pair for SSH-2."
175 fi
176fi
177
178if [ ! -d %%PIDDIR%% ]; then
179 $INSTALLF $PKGINST %%PIDDIR%%
180 mkdir -p %%PIDDIR%%
181 chown root:sys %%PIDDIR%%
182 chmod 755 %%PIDDIR%%
183fi
184
185$INSTALLF -f $PKGINST || exit 2
186
187if [ "X${PKG_INSTALL_ROOT}" = "X" ]; then
188 ### We're doing a local install, rather than an install for
189 ### old-style diskless clients.
190 echo "Stopping any current sshd process, and then starting the new sshd."
191 /etc/init.d/sshd stop
192 /etc/init.d/sshd start
193else
194 echo "Not restarting sshd, since this appears to be a remote install"
195 echo "for support of diskless clients."
196fi
197
198exit 0
diff --git a/contrib/solaris/preremove b/contrib/solaris/preremove
new file mode 100644
index 000000000..701c8c55b
--- /dev/null
+++ b/contrib/solaris/preremove
@@ -0,0 +1,2 @@
1# pre-removal script for OPENssh
2/etc/init.d/sshd stop
diff --git a/contrib/solaris/prototype b/contrib/solaris/prototype
new file mode 100644
index 000000000..02c4823de
--- /dev/null
+++ b/contrib/solaris/prototype
@@ -0,0 +1,26 @@
1i pkginfo
2i checkinstall
3i postinstall
4i preremove
5d none man 0755 root sys
6d none man/man1 0755 root sys
7f none man/man1/scp.1 0644 root sys
8f none man/man1/ssh-add.1 0644 root sys
9f none man/man1/ssh-agent.1 0644 root sys
10f none man/man1/ssh-keygen.1 0644 root sys
11f none man/man1/ssh.1 0644 root sys
12d none man/man8 0755 root sys
13f none man/man8/sshd.8 0644 root sys
14d none etc 0755 root sys
15f none etc/sshd_config.default 0644 root sys
16f none etc/ssh_config.default 0644 root sys
17f none etc/ssh_prng_cmds.default 0644 root sys
18f none etc/sshd-initscript 0755 root sys
19d none bin 0755 root sys
20f none bin/ssh-keygen 0755 root sys
21f none bin/ssh 0755 root sys
22f none bin/ssh-add 0755 root sys
23f none bin/ssh-agent 0755 root sys
24f none bin/scp 0755 root sys
25d none sbin 0755 root sys
26f none sbin/sshd 0755 root sys
diff --git a/contrib/solaris/sshd-initscript.in b/contrib/solaris/sshd-initscript.in
new file mode 100755
index 000000000..886a51fba
--- /dev/null
+++ b/contrib/solaris/sshd-initscript.in
@@ -0,0 +1,50 @@
1#! /sbin/sh
2
3# SSHd startup/shutdown script, based on uucp script.
4
5PIDFILE="%%PIDDIR%%/sshd.pid"
6PGREP="/usr/bin/pgrep"
7HEAD="/usr/bin/head"
8XARGS="/usr/bin/xargs"
9KILL="/usr/bin/kill"
10
11killproc() {
12 _procname=$1
13 _signal=$2
14 ${PGREP} ${_procname} | ${HEAD} -1 | ${XARGS} -t -I {} ${KILL} -${_signal} {}
15}
16
17case $1 in
18'start')
19 /usr/local/sbin/sshd
20 ;;
21
22'stop')
23 if [ -r $PIDFILE -a ! -z ${PIDFILE} ]; then
24 PID=`cat ${PIDFILE}`
25 fi
26 if [ ${PID:=0} -gt 1 -a ! "X$PID" = "X " ]; then
27 /usr/bin/kill $PID
28 else
29 echo "Unable to read PID file, killing using alternate method"
30 killproc sshd TERM
31 fi
32 ;;
33
34'restart')
35 if [ -r $PIDFILE -a ! -z ${PIDFILE} ]; then
36 PID=`cat ${PIDFILE}`
37 fi
38 if [ ${PID:=0} -gt 1 -a ! "X$PID" = "X " ]; then
39 /usr/bin/kill -HUP $PID
40 else
41 echo "Unable to read PID file, trying alternate method"
42 killproc sshd HUP
43 /usr/local/sbin/sshd
44 fi
45 ;;
46
47*)
48 echo "usage: /etc/init.d/sshd {start|stop|restart}"
49 ;;
50esac