Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # buildbff.sh: Create AIX SMIT-installable OpenSSH packages |
Darren Tucker | e25a9bd | 2010-04-18 13:35:00 +1000 | [diff] [blame^] | 4 | # $Id: buildbff.sh,v 1.12 2010/04/18 03:35:00 dtucker Exp $ |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 5 | # |
| 6 | # Author: Darren Tucker (dtucker at zip dot com dot au) |
| 7 | # This file is placed in the public domain and comes with absolutely |
| 8 | # no warranty. |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 9 | # |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 10 | # Based originally on Ben Lindstrom's buildpkg.sh for Solaris |
| 11 | # |
| 12 | |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 13 | # |
| 14 | # Tunable configuration settings |
Damien Miller | c9c1d37 | 2003-03-10 12:10:45 +1100 | [diff] [blame] | 15 | # create a "config.local" in your build directory or set |
| 16 | # environment variables to override these. |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 17 | # |
Darren Tucker | 36ca53a | 2003-08-25 15:01:04 +1000 | [diff] [blame] | 18 | [ -z "$PERMIT_ROOT_LOGIN" ] && PERMIT_ROOT_LOGIN=no |
| 19 | [ -z "$X11_FORWARDING" ] && X11_FORWARDING=no |
| 20 | [ -z "$AIX_SRC" ] && AIX_SRC=no |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 21 | |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 22 | umask 022 |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 23 | |
Ben Lindstrom | 2faabf3 | 2002-07-18 01:04:50 +0000 | [diff] [blame] | 24 | startdir=`pwd` |
| 25 | |
Darren Tucker | f376669 | 2006-09-10 13:24:18 +1000 | [diff] [blame] | 26 | perl -v >/dev/null || (echo perl required; exit 1) |
| 27 | |
Ben Lindstrom | 2faabf3 | 2002-07-18 01:04:50 +0000 | [diff] [blame] | 28 | # Path to inventory.sh: same place as buildbff.sh |
| 29 | if echo $0 | egrep '^/' |
| 30 | then |
| 31 | inventory=`dirname $0`/inventory.sh # absolute path |
| 32 | else |
| 33 | inventory=`pwd`/`dirname $0`/inventory.sh # relative path |
| 34 | fi |
| 35 | |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 36 | # |
Darren Tucker | 36ca53a | 2003-08-25 15:01:04 +1000 | [diff] [blame] | 37 | # We still support running from contrib/aix, but this is deprecated |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 38 | # |
| 39 | if pwd | egrep 'contrib/aix$' |
| 40 | then |
| 41 | echo "Changing directory to `pwd`/../.." |
| 42 | echo "Please run buildbff.sh from your build directory in future." |
| 43 | cd ../.. |
| 44 | contribaix=1 |
| 45 | fi |
| 46 | |
| 47 | if [ ! -f Makefile ] |
| 48 | then |
| 49 | echo "Makefile not found (did you run configure?)" |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 50 | exit 1 |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 51 | fi |
| 52 | |
| 53 | # |
| 54 | # Directories used during build: |
| 55 | # current dir = $objdir directory you ran ./configure in. |
| 56 | # $objdir/$PKGDIR/ directory package files are constructed in |
| 57 | # $objdir/$PKGDIR/root/ package root ($FAKE_ROOT) |
| 58 | # |
| 59 | objdir=`pwd` |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 60 | PKGNAME=openssh |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 61 | PKGDIR=package |
| 62 | |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 63 | # |
| 64 | # Collect local configuration settings to override defaults |
| 65 | # |
| 66 | if [ -s ./config.local ] |
| 67 | then |
| 68 | echo Reading local settings from config.local |
| 69 | . ./config.local |
| 70 | fi |
| 71 | |
| 72 | # |
| 73 | # Fill in some details from Makefile, like prefix and sysconfdir |
| 74 | # the eval also expands variables like sysconfdir=${prefix}/etc |
| 75 | # provided they are eval'ed in the correct order |
| 76 | # |
| 77 | for confvar in prefix exec_prefix bindir sbindir libexecdir datadir mandir mansubdir sysconfdir piddir srcdir |
| 78 | do |
| 79 | eval $confvar=`grep "^$confvar=" $objdir/Makefile | cut -d = -f 2` |
| 80 | done |
| 81 | |
| 82 | # |
| 83 | # Collect values of privsep user and privsep path |
| 84 | # currently only found in config.h |
| 85 | # |
| 86 | for confvar in SSH_PRIVSEP_USER PRIVSEP_PATH |
| 87 | do |
| 88 | eval $confvar=`awk '/#define[ \t]'$confvar'/{print $3}' $objdir/config.h` |
| 89 | done |
| 90 | |
| 91 | # Set privsep defaults if not defined |
| 92 | if [ -z "$SSH_PRIVSEP_USER" ] |
| 93 | then |
| 94 | SSH_PRIVSEP_USER=sshd |
| 95 | fi |
| 96 | if [ -z "$PRIVSEP_PATH" ] |
| 97 | then |
| 98 | PRIVSEP_PATH=/var/empty |
| 99 | fi |
| 100 | |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 101 | # Clean package build directory |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 102 | rm -rf $objdir/$PKGDIR |
| 103 | FAKE_ROOT=$objdir/$PKGDIR/root |
| 104 | mkdir -p $FAKE_ROOT |
| 105 | |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 106 | # Start by faking root install |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 107 | echo "Faking root install..." |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 108 | cd $objdir |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 109 | make install-nokeys DESTDIR=$FAKE_ROOT |
| 110 | |
Tim Rice | 3a42346 | 2002-03-17 14:05:24 -0800 | [diff] [blame] | 111 | if [ $? -gt 0 ] |
| 112 | then |
| 113 | echo "Fake root install failed, stopping." |
| 114 | exit 1 |
| 115 | fi |
| 116 | |
| 117 | # |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 118 | # Copy informational files to include in package |
| 119 | # |
| 120 | cp $srcdir/LICENCE $objdir/$PKGDIR/ |
| 121 | cp $srcdir/README* $objdir/$PKGDIR/ |
| 122 | |
| 123 | # |
Tim Rice | 3a42346 | 2002-03-17 14:05:24 -0800 | [diff] [blame] | 124 | # Extract common info requires for the 'info' part of the package. |
| 125 | # AIX requires 4-part version numbers |
| 126 | # |
Darren Tucker | 36ca53a | 2003-08-25 15:01:04 +1000 | [diff] [blame] | 127 | VERSION=`./ssh -V 2>&1 | cut -f 1 -d , | cut -f 2 -d _` |
Tim Rice | 3a42346 | 2002-03-17 14:05:24 -0800 | [diff] [blame] | 128 | MAJOR=`echo $VERSION | cut -f 1 -d p | cut -f 1 -d .` |
| 129 | MINOR=`echo $VERSION | cut -f 1 -d p | cut -f 2 -d .` |
| 130 | PATCH=`echo $VERSION | cut -f 1 -d p | cut -f 3 -d .` |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 131 | PORTABLE=`echo $VERSION | awk 'BEGIN{FS="p"}{print $2}'` |
| 132 | [ "$PATCH" = "" ] && PATCH=0 |
| 133 | [ "$PORTABLE" = "" ] && PORTABLE=0 |
Tim Rice | 3a42346 | 2002-03-17 14:05:24 -0800 | [diff] [blame] | 134 | BFFVERSION=`printf "%d.%d.%d.%d" $MAJOR $MINOR $PATCH $PORTABLE` |
| 135 | |
| 136 | echo "Building BFF for $PKGNAME $VERSION (package version $BFFVERSION)" |
| 137 | |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 138 | # |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 139 | # Set ssh and sshd parameters as per config.local |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 140 | # |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 141 | if [ "${PERMIT_ROOT_LOGIN}" = no ] |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 142 | then |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 143 | perl -p -i -e "s/#PermitRootLogin yes/PermitRootLogin no/" \ |
| 144 | $FAKE_ROOT/${sysconfdir}/sshd_config |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 145 | fi |
| 146 | if [ "${X11_FORWARDING}" = yes ] |
| 147 | then |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 148 | perl -p -i -e "s/#X11Forwarding no/X11Forwarding yes/" \ |
| 149 | $FAKE_ROOT/${sysconfdir}/sshd_config |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 150 | fi |
| 151 | |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 152 | |
| 153 | # Rename config files; postinstall script will copy them if necessary |
Darren Tucker | 558d6ca | 2009-03-07 10:22:10 +1100 | [diff] [blame] | 154 | for cfgfile in ssh_config sshd_config |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 155 | do |
| 156 | mv $FAKE_ROOT/$sysconfdir/$cfgfile $FAKE_ROOT/$sysconfdir/$cfgfile.default |
| 157 | done |
| 158 | |
Darren Tucker | 558d6ca | 2009-03-07 10:22:10 +1100 | [diff] [blame] | 159 | # AIX 5.3 and newer have /dev/random and don't create ssh_prng_cmds |
| 160 | if [ -f $FAKE_ROOT/$sysconfdir/ssh_prng_cmds ] |
| 161 | then |
Darren Tucker | e25a9bd | 2010-04-18 13:35:00 +1000 | [diff] [blame^] | 162 | mv $FAKE_ROOT/$sysconfdir/ssh_prng_cmds \ |
Darren Tucker | 558d6ca | 2009-03-07 10:22:10 +1100 | [diff] [blame] | 163 | $FAKE_ROOT/$sysconfdir/ssh_prng_cmds.default |
| 164 | fi |
| 165 | |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 166 | # |
| 167 | # Generate lpp control files. |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 168 | # working dir is $FAKE_ROOT but files are generated in dir above |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 169 | # and moved into place just before creation of .bff |
| 170 | # |
| 171 | cd $FAKE_ROOT |
| 172 | echo Generating LPP control files |
| 173 | find . ! -name . -print >../openssh.al |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 174 | $inventory >../openssh.inventory |
| 175 | |
| 176 | cat <<EOD >../openssh.copyright |
| 177 | This software is distributed under a BSD-style license. |
| 178 | For the full text of the license, see /usr/lpp/openssh/LICENCE |
| 179 | EOD |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 180 | |
| 181 | # |
Damien Miller | c9c1d37 | 2003-03-10 12:10:45 +1100 | [diff] [blame] | 182 | # openssh.size file allows filesystem expansion as required |
| 183 | # generate list of directories containing files |
| 184 | # then calculate disk usage for each directory and store in openssh.size |
| 185 | # |
| 186 | files=`find . -type f -print` |
| 187 | dirs=`for file in $files; do dirname $file; done | sort -u` |
| 188 | for dir in $dirs |
| 189 | do |
| 190 | du $dir |
| 191 | done > ../openssh.size |
| 192 | |
| 193 | # |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 194 | # Create postinstall script |
| 195 | # |
| 196 | cat <<EOF >>../openssh.post_i |
| 197 | #!/bin/sh |
| 198 | |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 199 | echo Creating configs from defaults if necessary. |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 200 | for cfgfile in ssh_config sshd_config ssh_prng_cmds |
| 201 | do |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 202 | if [ ! -f $sysconfdir/\$cfgfile ] |
| 203 | then |
| 204 | echo "Creating \$cfgfile from default" |
| 205 | cp $sysconfdir/\$cfgfile.default $sysconfdir/\$cfgfile |
| 206 | else |
| 207 | echo "\$cfgfile already exists." |
| 208 | fi |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 209 | done |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 210 | echo |
| 211 | |
Darren Tucker | 19a66db | 2006-09-09 20:34:15 +1000 | [diff] [blame] | 212 | # Create PrivilegeSeparation user and group if not present |
| 213 | echo Checking for PrivilegeSeparation user and group. |
| 214 | if cut -f1 -d: /etc/group | egrep '^'$SSH_PRIVSEP_USER'\$' >/dev/null |
| 215 | then |
| 216 | echo "PrivSep group $SSH_PRIVSEP_USER already exists." |
| 217 | else |
| 218 | echo "Creating PrivSep group $SSH_PRIVSEP_USER." |
| 219 | mkgroup -A $SSH_PRIVSEP_USER |
| 220 | fi |
| 221 | |
| 222 | # Create user if required |
| 223 | if lsuser "$SSH_PRIVSEP_USER" >/dev/null |
| 224 | then |
| 225 | echo "PrivSep user $SSH_PRIVSEP_USER already exists." |
| 226 | else |
| 227 | echo "Creating PrivSep user $SSH_PRIVSEP_USER." |
| 228 | mkuser gecos='SSHD PrivSep User' login=false rlogin=false account_locked=true pgrp=$SSH_PRIVSEP_USER $SSH_PRIVSEP_USER |
| 229 | fi |
| 230 | |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 231 | if egrep '^[ \t]*UsePrivilegeSeparation[ \t]+no' $sysconfdir/sshd_config >/dev/null |
| 232 | then |
Darren Tucker | 19a66db | 2006-09-09 20:34:15 +1000 | [diff] [blame] | 233 | echo UsePrivilegeSeparation not enabled, privsep directory not required. |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 234 | else |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 235 | # create chroot directory if required |
| 236 | if [ -d $PRIVSEP_PATH ] |
| 237 | then |
| 238 | echo "PrivSep chroot directory $PRIVSEP_PATH already exists." |
| 239 | else |
| 240 | echo "Creating PrivSep chroot directory $PRIVSEP_PATH." |
| 241 | mkdir $PRIVSEP_PATH |
| 242 | chown 0 $PRIVSEP_PATH |
| 243 | chgrp 0 $PRIVSEP_PATH |
| 244 | chmod 755 $PRIVSEP_PATH |
| 245 | fi |
| 246 | fi |
| 247 | echo |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 248 | |
| 249 | # Generate keys unless they already exist |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 250 | echo Creating host keys if required. |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 251 | if [ -f "$sysconfdir/ssh_host_key" ] ; then |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 252 | echo "$sysconfdir/ssh_host_key already exists, skipping." |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 253 | else |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 254 | $bindir/ssh-keygen -t rsa1 -f $sysconfdir/ssh_host_key -N "" |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 255 | fi |
| 256 | if [ -f $sysconfdir/ssh_host_dsa_key ] ; then |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 257 | echo "$sysconfdir/ssh_host_dsa_key already exists, skipping." |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 258 | else |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 259 | $bindir/ssh-keygen -t dsa -f $sysconfdir/ssh_host_dsa_key -N "" |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 260 | fi |
| 261 | if [ -f $sysconfdir/ssh_host_rsa_key ] ; then |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 262 | echo "$sysconfdir/ssh_host_rsa_key already exists, skipping." |
| 263 | else |
| 264 | $bindir/ssh-keygen -t rsa -f $sysconfdir/ssh_host_rsa_key -N "" |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 265 | fi |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 266 | echo |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 267 | |
Damien Miller | c9c1d37 | 2003-03-10 12:10:45 +1100 | [diff] [blame] | 268 | # Set startup command depending on SRC support |
| 269 | if [ "$AIX_SRC" = "yes" ] |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 270 | then |
Damien Miller | c9c1d37 | 2003-03-10 12:10:45 +1100 | [diff] [blame] | 271 | echo Creating SRC sshd subsystem. |
| 272 | rmssys -s sshd 2>&1 >/dev/null |
| 273 | mkssys -s sshd -p "$sbindir/sshd" -a '-D' -u 0 -S -n 15 -f 9 -R -G tcpip |
| 274 | startupcmd="start $sbindir/sshd \\\"\\\$src_running\\\"" |
| 275 | oldstartcmd="$sbindir/sshd" |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 276 | else |
Damien Miller | c9c1d37 | 2003-03-10 12:10:45 +1100 | [diff] [blame] | 277 | startupcmd="$sbindir/sshd" |
| 278 | oldstartcmd="start $sbindir/sshd \\\"$src_running\\\"" |
| 279 | fi |
| 280 | |
| 281 | # If migrating to or from SRC, change previous startup command |
| 282 | # otherwise add to rc.tcpip |
| 283 | if egrep "^\$oldstartcmd" /etc/rc.tcpip >/dev/null |
| 284 | then |
| 285 | if sed "s|^\$oldstartcmd|\$startupcmd|g" /etc/rc.tcpip >/etc/rc.tcpip.new |
| 286 | then |
| 287 | chmod 0755 /etc/rc.tcpip.new |
| 288 | mv /etc/rc.tcpip /etc/rc.tcpip.old && \ |
| 289 | mv /etc/rc.tcpip.new /etc/rc.tcpip |
| 290 | else |
| 291 | echo "Updating /etc/rc.tcpip failed, please check." |
| 292 | fi |
| 293 | else |
| 294 | # Add to system startup if required |
| 295 | if grep "^\$startupcmd" /etc/rc.tcpip >/dev/null |
| 296 | then |
| 297 | echo "sshd found in rc.tcpip, not adding." |
| 298 | else |
| 299 | echo "Adding sshd to rc.tcpip" |
| 300 | echo >>/etc/rc.tcpip |
| 301 | echo "# Start sshd" >>/etc/rc.tcpip |
| 302 | echo "\$startupcmd" >>/etc/rc.tcpip |
| 303 | fi |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 304 | fi |
| 305 | EOF |
| 306 | |
| 307 | # |
| 308 | # Create liblpp.a and move control files into it |
| 309 | # |
| 310 | echo Creating liblpp.a |
| 311 | ( |
| 312 | cd .. |
Damien Miller | c9c1d37 | 2003-03-10 12:10:45 +1100 | [diff] [blame] | 313 | for i in openssh.al openssh.copyright openssh.inventory openssh.post_i openssh.size LICENCE README* |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 314 | do |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 315 | ar -r liblpp.a $i |
| 316 | rm $i |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 317 | done |
| 318 | ) |
| 319 | |
| 320 | # |
| 321 | # Create lpp_name |
| 322 | # |
| 323 | # This will end up looking something like: |
| 324 | # 4 R I OpenSSH { |
| 325 | # OpenSSH 3.0.2.1 1 N U en_US OpenSSH 3.0.2p1 Portable for AIX |
| 326 | # [ |
| 327 | # % |
| 328 | # /usr/local/bin 8073 |
| 329 | # /usr/local/etc 189 |
| 330 | # /usr/local/libexec 185 |
| 331 | # /usr/local/man/man1 145 |
| 332 | # /usr/local/man/man8 83 |
| 333 | # /usr/local/sbin 2105 |
| 334 | # /usr/local/share 3 |
| 335 | # % |
| 336 | # ] |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 337 | # } |
| 338 | |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 339 | echo Creating lpp_name |
| 340 | cat <<EOF >../lpp_name |
| 341 | 4 R I $PKGNAME { |
| 342 | $PKGNAME $BFFVERSION 1 N U en_US OpenSSH $VERSION Portable for AIX |
| 343 | [ |
| 344 | % |
| 345 | EOF |
| 346 | |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 347 | for i in $bindir $sysconfdir $libexecdir $mandir/${mansubdir}1 $mandir/${mansubdir}8 $sbindir $datadir /usr/lpp/openssh |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 348 | do |
| 349 | # get size in 512 byte blocks |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 350 | if [ -d $FAKE_ROOT/$i ] |
| 351 | then |
| 352 | size=`du $FAKE_ROOT/$i | awk '{print $1}'` |
| 353 | echo "$i $size" >>../lpp_name |
| 354 | fi |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 355 | done |
| 356 | |
| 357 | echo '%' >>../lpp_name |
| 358 | echo ']' >>../lpp_name |
| 359 | echo '}' >>../lpp_name |
| 360 | |
| 361 | # |
| 362 | # Move pieces into place |
| 363 | # |
| 364 | mkdir -p usr/lpp/openssh |
| 365 | mv ../liblpp.a usr/lpp/openssh |
| 366 | mv ../lpp_name . |
| 367 | |
| 368 | # |
| 369 | # Now invoke backup to create .bff file |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 370 | # note: lpp_name needs to be the first file so we generate the |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 371 | # file list on the fly and feed it to backup using -i |
| 372 | # |
| 373 | echo Creating $PKGNAME-$VERSION.bff with backup... |
Tim Rice | 3a42346 | 2002-03-17 14:05:24 -0800 | [diff] [blame] | 374 | rm -f $PKGNAME-$VERSION.bff |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 375 | ( |
| 376 | echo "./lpp_name" |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 377 | find . ! -name lpp_name -a ! -name . -print |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 378 | ) | backup -i -q -f ../$PKGNAME-$VERSION.bff $filelist |
| 379 | |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 380 | # |
Ben Lindstrom | 2faabf3 | 2002-07-18 01:04:50 +0000 | [diff] [blame] | 381 | # Move package into final location and clean up |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 382 | # |
Ben Lindstrom | 2faabf3 | 2002-07-18 01:04:50 +0000 | [diff] [blame] | 383 | mv ../$PKGNAME-$VERSION.bff $startdir |
| 384 | cd $startdir |
Ben Lindstrom | 5223727 | 2002-06-25 23:38:47 +0000 | [diff] [blame] | 385 | rm -rf $objdir/$PKGDIR |
| 386 | |
Ben Lindstrom | 01e7fa1 | 2002-03-05 03:38:35 +0000 | [diff] [blame] | 387 | echo $0: done. |
| 388 | |