diff options
Diffstat (limited to 'contrib/solaris/build-pkg')
-rwxr-xr-x | contrib/solaris/build-pkg | 218 |
1 files changed, 0 insertions, 218 deletions
diff --git a/contrib/solaris/build-pkg b/contrib/solaris/build-pkg deleted file mode 100755 index fe92d9dda..000000000 --- a/contrib/solaris/build-pkg +++ /dev/null | |||
@@ -1,218 +0,0 @@ | |||
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 | |||
65 | if [ -f sshd.c ]; then | ||
66 | cd contrib/solaris >/dev/null | ||
67 | fi | ||
68 | |||
69 | # Locations of standard binaries | ||
70 | UNAME=/usr/bin/uname | ||
71 | SED=/usr/bin/sed | ||
72 | PWD=/usr/bin/pwd | ||
73 | CUT=/usr/bin/cut | ||
74 | STRIP=/usr/ccs/bin/strip | ||
75 | PKGMK=/usr/bin/pkgmk | ||
76 | PKGTRANS=/usr/bin/pkgtrans | ||
77 | GREP=/usr/bin/grep | ||
78 | DATE=/usr/bin/date | ||
79 | |||
80 | CURRDIR=`${PWD}` | ||
81 | BUILDDIR=${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. | ||
88 | PKGNAME="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. | ||
91 | PSTAMP="`${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. | ||
95 | prefix=`${GREP} "^prefix=" ../../Makefile | ${CUT} -d = -f 2` | ||
96 | execprefix=`${GREP} "^execprefix=" ../../Makefile | ${CUT} -d = -f 2` | ||
97 | INSTROOT=${prefix:=/usr/local} | ||
98 | ETCDIR=`${GREP} "^ETCDIR=" ../../Makefile | ${CUT} -d = -f 2` | ||
99 | PIDDIR=`${GREP} "^piddir=" ../../Makefile | ${CUT} -d = -f 2` | ||
100 | |||
101 | if [ ! -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 | ||
106 | fi | ||
107 | |||
108 | |||
109 | VERSION=`${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... | ||
112 | OSMINOR=`${UNAME} -r | ${CUT} -f 2 -d .` | ||
113 | if [ $OSMINOR -gt 6 ]; then | ||
114 | OSVERSION=$OSMINOR | ||
115 | else | ||
116 | OSVERSION=`${UNAME} -r | ${SED} 's/5/2/'` | ||
117 | fi | ||
118 | ARCH=`$UNAME -p` | ||
119 | SHORTINSTROOT="" | ||
120 | if [ "$INSTROOT" = "/usr/local" ]; then | ||
121 | SHORTINSTROOT="-local" | ||
122 | else | ||
123 | if [ "$INSTROOT" = "/opt" ]; then | ||
124 | SHORTINSTROOT="-opt" | ||
125 | fi | ||
126 | fi | ||
127 | |||
128 | DESTFILE="${PKGNAME}-${VERSION}-sol${OSVERSION}-${ARCH}${SHORTINSTROOT}" | ||
129 | |||
130 | echo "Building Solaris package of OpenSSH ${VERSION} in\n\t${BUILDDIR}." | ||
131 | echo "Binaries were compiled for Solaris ${OSVERSION} (${ARCH})" | ||
132 | echo "The installable package will be named ${DESTFILE}." | ||
133 | echo "When installed, the package will be located under ${INSTROOT}." | ||
134 | echo "" | ||
135 | |||
136 | echo "Cleaning up old build files..." | ||
137 | rm -rf $BUILDDIR | ||
138 | mkdir $BUILDDIR | ||
139 | cd $BUILDDIR | ||
140 | |||
141 | echo "Setting up build directories..." | ||
142 | mkdir -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 | ||
145 | mkdir -p ${BUILDDIR}/man/man8 | ||
146 | mkdir -p ${BUILDDIR}/etc | ||
147 | mkdir -p ${BUILDDIR}/bin | ||
148 | mkdir -p ${BUILDDIR}/libexec | ||
149 | mkdir -p ${BUILDDIR}/sbin | ||
150 | |||
151 | echo "Populating build directories..." | ||
152 | cp -p ../../../sshd sbin | ||
153 | cp -p ../../../ssh-keygen bin | ||
154 | cp -p ../../../ssh-keyscan bin | ||
155 | cp -p ../../../ssh bin | ||
156 | cp -p ../../../ssh-add bin | ||
157 | cp -p ../../../ssh-agent bin | ||
158 | cp -p ../../../scp bin | ||
159 | cp -p ../../../scp.1.out man/man1/scp.1 | ||
160 | cp -p ../../../sftp bin | ||
161 | cp -p ../../../sftp.1.out man/man1/sftp.1 | ||
162 | cp -p ../../../sftp-server libexec/sftp-server | ||
163 | cp -p ../../../sftp-server.8.out man/man8/sftp-server.8 | ||
164 | cp -p ../../../ssh-add.1.out man/man1/ssh-add.1 | ||
165 | cp -p ../../../ssh-agent.1.out man/man1/ssh-agent.1 | ||
166 | cp -p ../../../ssh-keygen.1.out man/man1/ssh-keygen.1 | ||
167 | cp -p ../../../ssh-keyscan.1.out man/man1/ssh-keyscan.1 | ||
168 | cp -p ../../../ssh.1.out man/man1/ssh.1 | ||
169 | cp -p ../../../sshd.8.out man/man8/sshd.8 | ||
170 | cp -p ../../../sshd_config.out etc/sshd_config.default | ||
171 | cp -p ../../../ssh_config.out etc/ssh_config.default | ||
172 | cp -p ../../../ssh_prng_cmds etc/ssh_prng_cmds.default | ||
173 | cp -p ../../../primes etc/primes.default | ||
174 | |||
175 | # One of the annoying things about the Solaris packaging process is that | ||
176 | # there's no simple way to prototype on the fly--so make sure you edit | ||
177 | # the prototype file if you add/subtract files from the mix. | ||
178 | cp -p ../prototype . | ||
179 | cp -p ../preremove . | ||
180 | |||
181 | echo "Creating compile-dependent files from their prototypes" | ||
182 | $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 | ||
183 | $SED -e "s/%%PKGNAME%%/${PKGNAME}/g" -e "s/%%OSMINOR%%/${OSMINOR}/g" -e "s/%%OSVERSION%%/${OSVERSION}/g" <../checkinstall.in >./checkinstall | ||
184 | $SED -e "s|%%PIDDIR%%|${PIDDIR}|g" <../postinstall.in >./postinstall | ||
185 | $SED -e "s|%%PIDDIR%%|${PIDDIR}|g" <../sshd-initscript.in > etc/sshd-initscript | ||
186 | |||
187 | echo "Stripping binaries" | ||
188 | ${STRIP} bin/ssh | ||
189 | ${STRIP} bin/ssh-add | ||
190 | ${STRIP} bin/ssh-agent | ||
191 | ${STRIP} bin/ssh-keygen | ||
192 | ${STRIP} bin/ssh-keyscan | ||
193 | ${STRIP} sbin/sshd | ||
194 | ${STRIP} bin/scp | ||
195 | ${STRIP} bin/sftp | ||
196 | ${STRIP} libexec/sftp-server | ||
197 | |||
198 | echo "" | ||
199 | echo "Building Package" | ||
200 | |||
201 | cd ${BUILDDIR} | ||
202 | $PKGMK -o -r . -p ${PSTAMP} -d ${BUILDDIR} | ||
203 | |||
204 | if [ $? -gt 0 ]; then | ||
205 | echo "Error performing pkgmk--cannot continue." | ||
206 | exit 1 | ||
207 | fi | ||
208 | |||
209 | echo "" | ||
210 | echo "Translating Package Tree into Installable Image" | ||
211 | $PKGTRANS -s ${BUILDDIR} ${BUILDDIR}/${DESTFILE} OPENssh | ||
212 | |||
213 | if [ $? -gt 0 ]; then | ||
214 | echo "Error performing pkgtrans--cannot continue." | ||
215 | exit 1 | ||
216 | fi | ||
217 | |||
218 | echo "Done. Package is in ${BUILDDIR}/${DESTFILE} !" | ||