summaryrefslogtreecommitdiff
path: root/contrib/solaris/postinstall.in
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-10-12 20:30:52 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-10-12 20:30:52 +0000
commit8b5ba1c39acd9bdf64c55a1407021111969a4289 (patch)
tree70d01b6f6b8000a3310692331957840684a8ac29 /contrib/solaris/postinstall.in
parent4a820ea750ce79be709ca8c4b11edf39e07b2676 (diff)
- (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!
Diffstat (limited to 'contrib/solaris/postinstall.in')
-rw-r--r--contrib/solaris/postinstall.in243
1 files changed, 0 insertions, 243 deletions
diff --git a/contrib/solaris/postinstall.in b/contrib/solaris/postinstall.in
deleted file mode 100644
index 3ce3bf13d..000000000
--- a/contrib/solaris/postinstall.in
+++ /dev/null
@@ -1,243 +0,0 @@
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 instbackup ${CONFDIR} primes
50
51 ### If no existing sshd_config and host key, then create
52 if [ ! -f "${CONFDIR}/ssh_host_key" ]; then
53 echo "Creating new RSA public/private host key pair for SSH-1."
54 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key
55 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key.pub
56 ### If there is *anything* there then leave it, otherwise look
57 ### in some reasonable alternate locations before giving up.
58 ### It's worth spending some extra time looking for the old one
59 ### to avoid a bunch of "host identification has changed" warnings.
60 ### Note that some old keys from the commercial SSH might not
61 ### be compatible, but we don't test for that.
62 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_key" ]; then
63 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_key ${CONFDIR}
64 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key" ]; then
65 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key ${CONFDIR}
66 else
67 ${DESTBIN}/ssh-keygen -b 1024 -f ${CONFDIR}/ssh_host_key -N ''
68 fi
69 else
70 echo "Using existing RSA public/private host key pair for SSH-1."
71 fi
72 if [ ! -f "${CONFDIR}/ssh_host_dsa_key" ]; then
73 echo "Creating new DSA public/private host key pair for SSH-2."
74 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key
75 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key.pub
76 ### If there is *anything* there then leave it, otherwise look
77 ### in some reasonable alternate locations before giving up.
78 ### It's worth spending some extra time looking for the old one
79 ### to avoid a bunch of "host identification has changed" warnings.
80 ### Note that some old keys from the commercial SSH2 might not
81 ### be compatible, but we don't test for that.
82 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key" ]; then
83 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key ${CONFDIR}
84 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key" ]; then
85 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key ${CONFDIR}
86 else
87 ${DESTBIN}/ssh-keygen -d -f ${CONFDIR}/ssh_host_dsa_key -N ''
88 fi
89 else
90 echo "Using existing DSA public/private host key pair for SSH-2."
91 fi
92 if [ ! -f "${CONFDIR}/ssh_host_rsa_key" ]; then
93 echo "Creating new RSA public/private host key pair for SSH-2."
94 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_rsa_key
95 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_rsa_key.pub
96 ### If there is *anything* there then leave it, otherwise look
97 ### in some reasonable alternate locations before giving up.
98 ### It's worth spending some extra time looking for the old one
99 ### to avoid a bunch of "host identification has changed" warnings.
100 ### Note that some old keys from the commercial SSH2 might not
101 ### be compatible, but we don't test for that.
102 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_rsa_key" ]; then
103 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_rsa_key ${CONFDIR}
104 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_rsa_key" ]; then
105 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_rsa_key ${CONFDIR}
106 else
107 ${DESTBIN}/ssh-keygen -t rsa -f ${CONFDIR}/ssh_host_rsa_key -N ''
108 fi
109 else
110 echo "Using existing RSA public/private host key pair for SSH-2."
111 fi
112else
113 echo "Performing an \"update\" installation of OpenSSH."
114 ### Okay, this part *is* an update install...so we need to ensure
115 ### we don't overwrite any of the existing files.
116
117 ### Install init script and create symlinks
118 if [ ! -f ${PKG_INSTALL_ROOT}/etc/init.d/sshd ]; then
119 echo "Installing init script in ${PKG_INSTALL_ROOT}/etc/init.d/sshd"
120 $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/init.d/sshd || exit 2
121 cp -p ${CONFDIR}/sshd-initscript ${PKG_INSTALL_ROOT}/etc/init.d/sshd
122 chown root:root ${PKG_INSTALL_ROOT}/etc/init.d/sshd
123 chmod 500 ${PKG_INSTALL_ROOT}/etc/init.d/sshd
124 fi
125 if [ ! -r ${PKG_INSTALL_ROOT}/etc/rc2.d/S72local_sshd ]; then
126 $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/rc2.d/S72local_sshd=/etc/init.d/sshd s || exit 2
127 fi
128 if [ ! -r ${PKG_INSTALL_ROOT}/etc/rc2.d/K30local_sshd ]; then
129 $INSTALLF $PKGINST /etc/rc0.d/K30local_sshd=/etc/init.d/sshd s || exit 2
130 fi
131
132 ### The initial package installation leaves default versions of
133 ### ssh_prng_cmds, ssh_config, and sshd_config in ${CONFDIR}. Now
134 ### we need to decide whether to install them. Since this is
135 ### an update install, we only install the new files if the old
136 ### files somehow don't exist.
137 NEWCONF=0
138 if [ ! -r "${CONFDIR}/ssh_prng_cmds" ]; then
139 instbackup ${CONFDIR} ssh_prng_cmds
140 NEWCONF=1
141 fi
142 if [ ! -r "${CONFDIR}/ssh_config" ]; then
143 instbackup ${CONFDIR} ssh_config
144 NEWCONF=1
145 fi
146 if [ ! -r "${CONFDIR}/sshd_config" ]; then
147 instbackup ${CONFDIR} sshd_config
148 NEWCONF=1
149 fi
150 if [ ! -r "${CONFDIR}/primes" ]; then
151 instbackup ${CONFDIR} primes
152 NEWCONF=1
153 fi
154 if [ $NEWCONF -eq 0 ]; then
155 echo "Your existing SSH configuration files have not been altered."
156 else
157 echo "Your other existing SSH configuration files have not been altered."
158 fi
159
160 ### If no existing sshd_config and host key, then create
161 if [ ! -f "${CONFDIR}/ssh_host_key" ]; then
162 echo "Creating new RSA public/private host key pair for SSH-1."
163 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key
164 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key.pub
165 ### If there is *anything* there then leave it, otherwise look
166 ### in some reasonable alternate locations before giving up.
167 ### It's worth spending some extra time looking for the old one
168 ### to avoid a bunch of "host identification has changed" warnings.
169 ### Note that some old keys from the commercial SSH might not
170 ### be compatible, but we don't test for that.
171 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_key" ]; then
172 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_key ${CONFDIR}
173 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key" ]; then
174 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key ${CONFDIR}
175 else
176 ${DESTBIN}/ssh-keygen -b 1024 -f ${CONFDIR}/ssh_host_key -N ''
177 fi
178 else
179 echo "Using existing RSA public/private host key pair for SSH-1."
180 fi
181 if [ ! -f "${CONFDIR}/ssh_host_dsa_key" ]; then
182 echo "Creating new DSA public/private host key pair for SSH-2."
183 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key
184 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key.pub
185 ### If there is *anything* there then leave it, otherwise look
186 ### in some reasonable alternate locations before giving up.
187 ### It's worth spending some extra time looking for the old one
188 ### to avoid a bunch of "host identification has changed" warnings.
189 ### Note that some old keys from the commercial SSH2 might not
190 ### be compatible, but we don't test for that.
191 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key" ]; then
192 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key ${CONFDIR}
193 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key" ]; then
194 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key ${CONFDIR}
195 else
196 ${DESTBIN}/ssh-keygen -d -f ${CONFDIR}/ssh_host_dsa_key -N ''
197 fi
198 else
199 echo "Using existing DSA public/private host key pair for SSH-2."
200 fi
201 if [ ! -f "${CONFDIR}/ssh_host_rsa_key" ]; then
202 echo "Creating new RSA public/private host key pair for SSH-2."
203 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_rsa_key
204 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_rsa_key.pub
205 ### If there is *anything* there then leave it, otherwise look
206 ### in some reasonable alternate locations before giving up.
207 ### It's worth spending some extra time looking for the old one
208 ### to avoid a bunch of "host identification has changed" warnings.
209 ### Note that some old keys from the commercial SSH2 might not
210 ### be compatible, but we don't test for that.
211 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_rsa_key" ]; then
212 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_rsa_key ${CONFDIR}
213 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_rsa_key" ]; then
214 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_rsa_key ${CONFDIR}
215 else
216 ${DESTBIN}/ssh-keygen -d -f ${CONFDIR}/ssh_host_rsa_key -N ''
217 fi
218 else
219 echo "Using existing RSA public/private host key pair for SSH-2."
220 fi
221fi
222
223if [ ! -d %%PIDDIR%% ]; then
224 $INSTALLF $PKGINST %%PIDDIR%%
225 mkdir -p %%PIDDIR%%
226 chown root:sys %%PIDDIR%%
227 chmod 755 %%PIDDIR%%
228fi
229
230$INSTALLF -f $PKGINST || exit 2
231
232if [ "X${PKG_INSTALL_ROOT}" = "X" ]; then
233 ### We're doing a local install, rather than an install for
234 ### old-style diskless clients.
235 echo "Stopping any current sshd process, and then starting the new sshd."
236 /etc/init.d/sshd stop
237 /etc/init.d/sshd start
238else
239 echo "Not restarting sshd, since this appears to be a remote install"
240 echo "for support of diskless clients."
241fi
242
243exit 0