blob: f90ae6e8113e928361ba72e92149af95e00afc41 [file] [log] [blame]
Tim Rice6f1f7582004-05-30 21:38:51 -07001#!/bin/sh
2#
3# Fake Root Solaris/SVR4/SVR5 Build System - Prototype
4#
5# The following code has been provide under Public Domain License. I really
6# don't care what you use it for. Just as long as you don't complain to me
7# nor my employer if you break it. - Ben Lindstrom (mouring@eviladmin.org)
8#
9umask 022
10#
11# Options for building the package
12# You can create a openssh-config.local with your customized options
13#
14REMOVE_FAKE_ROOT_WHEN_DONE=yes
15#
16# uncommenting TEST_DIR and using
17# configure --prefix=/var/tmp --with-privsep-path=/var/tmp/empty
18# and
19# PKGNAME=tOpenSSH should allow testing a package without interfering
20# with a real OpenSSH package on a system. This is not needed on systems
21# that support the -R option to pkgadd.
22#TEST_DIR=/var/tmp # leave commented out for production build
23PKGNAME=OpenSSH
Tim Ricea5757f02004-07-01 20:41:15 -070024# revisions within the same version (REV=a)
25#REV=
Tim Rice6f1f7582004-05-30 21:38:51 -070026SYSVINIT_NAME=opensshd
27MAKE=${MAKE:="make"}
28SSHDUID=67 # Default privsep uid
29SSHDGID=67 # Default privsep gid
30# uncomment these next three as needed
31#PERMIT_ROOT_LOGIN=no
32#X11_FORWARDING=yes
33#USR_LOCAL_IS_SYMLINK=yes
34# System V init run levels
35SYSVINITSTART=S98
36SYSVINITSTOPT=K30
37# We will source these if they exist
38POST_MAKE_INSTALL_FIXES=./pkg_post_make_install_fixes.sh
39POST_PROTOTYPE_EDITS=./pkg-post-prototype-edit.sh
40# We'll be one level deeper looking for these
41PKG_PREINSTALL_LOCAL=../pkg-preinstall.local
42PKG_POSTINSTALL_LOCAL=../pkg-postinstall.local
43PKG_PREREMOVE_LOCAL=../pkg-preremove.local
44PKG_POSTREMOVE_LOCAL=../pkg-postremove.local
45PKG_REQUEST_LOCAL=../pkg-request.local
46# end of sourced files
47#
Tim Rice5af9db92004-06-19 19:31:06 -070048OPENSSHD=opensshd.init
Tim Rice6f1f7582004-05-30 21:38:51 -070049
50PATH_GROUPADD_PROG=@PATH_GROUPADD_PROG@
51PATH_USERADD_PROG=@PATH_USERADD_PROG@
52PATH_PASSWD_PROG=@PATH_PASSWD_PROG@
53#
54# list of system directories we do NOT want to change owner/group/perms
55# when installing our package
56SYSTEM_DIR="/etc \
57/etc/init.d \
58/etc/rcS.d \
59/etc/rc0.d \
60/etc/rc1.d \
61/etc/rc2.d \
62/etc/opt \
63/opt \
64/opt/bin \
65/usr \
66/usr/bin \
67/usr/lib \
68/usr/sbin \
69/usr/share \
70/usr/share/man \
71/usr/share/man/man1 \
72/usr/share/man/man8 \
73/usr/local \
74/usr/local/bin \
75/usr/local/etc \
76/usr/local/libexec \
77/usr/local/man \
78/usr/local/man/man1 \
79/usr/local/man/man8 \
80/usr/local/sbin \
81/usr/local/share \
82/var \
83/var/opt \
84/var/run \
85/var/tmp \
86/tmp"
87
88# We may need to build as root so we make sure PATH is set up
89# only set the path if it's not set already
90[ -d /opt/bin ] && {
91 echo $PATH | grep ":/opt/bin" > /dev/null 2>&1
92 [ $? -ne 0 ] && PATH=$PATH:/opt/bin
93}
94[ -d /usr/local/bin ] && {
95 echo $PATH | grep ":/usr/local/bin" > /dev/null 2>&1
96 [ $? -ne 0 ] && PATH=$PATH:/usr/local/bin
97}
98[ -d /usr/ccs/bin ] && {
99 echo $PATH | grep ":/usr/ccs/bin" > /dev/null 2>&1
100 [ $? -ne 0 ] && PATH=$PATH:/usr/ccs/bin
101}
102export PATH
103#
104
105[ -f Makefile ] || {
106 echo "Please run this script from your build directory"
107 exit 1
108}
109
110# we will look for openssh-config.local to override the above options
111[ -s ./openssh-config.local ] && . ./openssh-config.local
112
113START=`pwd`
114FAKE_ROOT=$START/pkg
115
116## Fill in some details, like prefix and sysconfdir
117for confvar in prefix exec_prefix bindir sbindir libexecdir datadir mandir sysconfdir piddir srcdir
118do
119 eval $confvar=`grep "^$confvar=" Makefile | cut -d = -f 2`
120done
121
122
123## Collect value of privsep user
124for confvar in SSH_PRIVSEP_USER
125do
126 eval $confvar=`awk '/#define[ \t]'$confvar'/{print $3}' config.h`
127done
128
129## Set privsep defaults if not defined
130if [ -z "$SSH_PRIVSEP_USER" ]
131then
132 SSH_PRIVSEP_USER=sshd
133fi
134
135## Extract common info requires for the 'info' part of the package.
136VERSION=`./ssh -V 2>&1 | sed -e 's/,.*//'`
137
138ARCH=`uname -m`
139DEF_MSG="\n"
140OS_VER=`uname -v`
141SCRIPT_SHELL=/sbin/sh
142UNAME_S=`uname -s`
143case ${UNAME_S} in
144 SunOS) UNAME_S=Solaris
145 ARCH=`uname -p`
146 RCS_D=yes
147 DEF_MSG="(default: n)"
148 ;;
149 SCO_SV) UNAME_S=OpenServer
150 OS_VER=`uname -X | grep Release | sed -e 's/^Rel.*3.2v//'`
151 SCRIPT_SHELL=/bin/sh
152 RC1_D=no
153 DEF_MSG="(default: n)"
154 ;;
155esac
156
157case `basename $0` in
158 buildpkg.sh)
159## Start by faking root install
160echo "Faking root install..."
161[ -d $FAKE_ROOT ] && rm -fr $FAKE_ROOT
162mkdir $FAKE_ROOT
163${MAKE} install-nokeys DESTDIR=$FAKE_ROOT
164if [ $? -gt 0 ]
165then
166 echo "Fake root install failed, stopping."
167 exit 1
168fi
169
170## Setup our run level stuff while we are at it.
171mkdir -p $FAKE_ROOT${TEST_DIR}/etc/init.d
172
Tim Rice5af9db92004-06-19 19:31:06 -0700173cp ${OPENSSHD} $FAKE_ROOT${TEST_DIR}/etc/init.d/${SYSVINIT_NAME}
Tim Rice6f1f7582004-05-30 21:38:51 -0700174chmod 744 $FAKE_ROOT${TEST_DIR}/etc/init.d/${SYSVINIT_NAME}
175
176[ "${PERMIT_ROOT_LOGIN}" = no ] && \
177 perl -p -i -e "s/#PermitRootLogin yes/PermitRootLogin no/" \
178 $FAKE_ROOT/${sysconfdir}/sshd_config
179[ "${X11_FORWARDING}" = yes ] && \
180 perl -p -i -e "s/#X11Forwarding no/X11Forwarding yes/" \
181 $FAKE_ROOT/${sysconfdir}/sshd_config
182# fix PrintMotd
183perl -p -i -e "s/#PrintMotd yes/PrintMotd no/" \
184 $FAKE_ROOT/${sysconfdir}/sshd_config
185
186# We don't want to overwrite config files on multiple installs
187mv $FAKE_ROOT/${sysconfdir}/ssh_config $FAKE_ROOT/${sysconfdir}/ssh_config.default
188mv $FAKE_ROOT/${sysconfdir}/sshd_config $FAKE_ROOT/${sysconfdir}/sshd_config.default
189[ -f $FAKE_ROOT/${sysconfdir}/ssh_prng_cmds ] && \
190mv $FAKE_ROOT/${sysconfdir}/ssh_prng_cmds $FAKE_ROOT/${sysconfdir}/ssh_prng_cmds.default
191
192# local tweeks here
193[ -s "${POST_MAKE_INSTALL_FIXES}" ] && . ${POST_MAKE_INSTALL_FIXES}
194
195cd $FAKE_ROOT
196
197## Ok, this is outright wrong, but it will work. I'm tired of pkgmk
198## whining.
199for i in *; do
200 PROTO_ARGS="$PROTO_ARGS $i=/$i";
201done
202
203## Build info file
204echo "Building pkginfo file..."
205cat > pkginfo << _EOF
206PKG=$PKGNAME
207NAME="OpenSSH Portable for ${UNAME_S}"
208DESC="Secure Shell remote access utility; replaces telnet and rlogin/rsh."
209VENDOR="OpenSSH Portable Team - http://www.openssh.com/portable.html"
210ARCH=$ARCH
Tim Ricea5757f02004-07-01 20:41:15 -0700211VERSION=$VERSION$REV
Tim Rice6f1f7582004-05-30 21:38:51 -0700212CATEGORY="Security,application"
213BASEDIR=/
214CLASSES="none"
215PSTAMP="${UNAME_S} ${OS_VER} ${ARCH} `date '+%d%b%Y %H:%M'`"
216_EOF
217
218## Build empty depend file that may get updated by $POST_PROTOTYPE_EDITS
219echo "Building depend file..."
220touch depend
221
222## Build space file
223echo "Building space file..."
224cat > space << _EOF
225# extra space required by start/stop links added by installf in postinstall
226$TEST_DIR/etc/rc0.d/${SYSVINITSTOPT}${SYSVINIT_NAME} 0 1
227$TEST_DIR/etc/rc2.d/${SYSVINITSTART}${SYSVINIT_NAME} 0 1
228_EOF
229[ "$RC1_D" = no ] || \
230echo "$TEST_DIR/etc/rc1.d/${SYSVINITSTOPT}${SYSVINIT_NAME} 0 1" >> space
231[ "$RCS_D" = yes ] && \
232echo "$TEST_DIR/etc/rcS.d/${SYSVINITSTOPT}${SYSVINIT_NAME} 0 1" >> space
233
234## Build preinstall file
235echo "Building preinstall file..."
236cat > preinstall << _EOF
237#! ${SCRIPT_SHELL}
238#
239_EOF
240
241# local preinstall changes here
242[ -s "${PKG_PREINSTALL_LOCAL}" ] && . ${PKG_PREINSTALL_LOCAL}
243
244cat >> preinstall << _EOF
245#
246[ "\${PRE_INS_STOP}" = "yes" ] && ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} stop
247exit 0
248_EOF
249
250## Build postinstall file
251echo "Building postinstall file..."
252cat > postinstall << _EOF
253#! ${SCRIPT_SHELL}
254#
255[ -f \${PKG_INSTALL_ROOT}${sysconfdir}/ssh_config ] || \\
256 cp -p \${PKG_INSTALL_ROOT}${sysconfdir}/ssh_config.default \\
257 \${PKG_INSTALL_ROOT}${sysconfdir}/ssh_config
258[ -f \${PKG_INSTALL_ROOT}${sysconfdir}/sshd_config ] || \\
259 cp -p \${PKG_INSTALL_ROOT}${sysconfdir}/sshd_config.default \\
260 \${PKG_INSTALL_ROOT}${sysconfdir}/sshd_config
261[ -f \${PKG_INSTALL_ROOT}${sysconfdir}/ssh_prng_cmds.default ] && {
262 [ -f \${PKG_INSTALL_ROOT}${sysconfdir}/ssh_prng_cmds ] || \\
263 cp -p \${PKG_INSTALL_ROOT}${sysconfdir}/ssh_prng_cmds.default \\
264 \${PKG_INSTALL_ROOT}${sysconfdir}/ssh_prng_cmds
265}
266
267# make rc?.d dirs only if we are doing a test install
268[ -n "${TEST_DIR}" ] && {
269 [ "$RCS_D" = yes ] && mkdir -p ${TEST_DIR}/etc/rcS.d
270 mkdir -p ${TEST_DIR}/etc/rc0.d
271 [ "$RC1_D" = no ] || mkdir -p ${TEST_DIR}/etc/rc1.d
272 mkdir -p ${TEST_DIR}/etc/rc2.d
273}
274
275if [ "\${USE_SYM_LINKS}" = yes ]
276then
277 [ "$RCS_D" = yes ] && \
278installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rcS.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s
279 installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc0.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s
280 [ "$RC1_D" = no ] || \
281 installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc1.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s
282 installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc2.d/${SYSVINITSTART}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s
283else
284 [ "$RCS_D" = yes ] && \
Tim Riceb58bd032005-05-12 10:32:19 -0700285installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rcS.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l
286 installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc0.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l
Tim Rice6f1f7582004-05-30 21:38:51 -0700287 [ "$RC1_D" = no ] || \
Tim Riceb58bd032005-05-12 10:32:19 -0700288 installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc1.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l
289 installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc2.d/${SYSVINITSTART}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l
Tim Rice6f1f7582004-05-30 21:38:51 -0700290fi
291
292# If piddir doesn't exist we add it. (Ie. --with-pid-dir=/var/opt/ssh)
293[ -d $piddir ] || installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR$piddir d 0755 root sys
294
295_EOF
296
297# local postinstall changes here
298[ -s "${PKG_POSTINSTALL_LOCAL}" ] && . ${PKG_POSTINSTALL_LOCAL}
299
300cat >> postinstall << _EOF
301installf -f ${PKGNAME}
302
303# Use chroot to handle PKG_INSTALL_ROOT
304if [ ! -z "\${PKG_INSTALL_ROOT}" ]
305then
306 chroot="chroot \${PKG_INSTALL_ROOT}"
307fi
308# If this is a test build, we will skip the groupadd/useradd/passwd commands
309if [ ! -z "${TEST_DIR}" ]
310then
311 chroot=echo
312fi
313
314if egrep '^[ \t]*UsePrivilegeSeparation[ \t]+no' \${PKG_INSTALL_ROOT}/$sysconfdir/sshd_config >/dev/null
315then
316 echo "UsePrivilegeSeparation disabled in config, not creating PrivSep user"
317 echo "or group."
318else
319 echo "UsePrivilegeSeparation enabled in config (or defaulting to on)."
320
Tim Ricea5757f02004-07-01 20:41:15 -0700321 # user required?
322 if cut -f1 -d: \${PKG_INSTALL_ROOT}/etc/passwd | egrep '^'$SSH_PRIVSEP_USER'\$' >/dev/null
Tim Rice6f1f7582004-05-30 21:38:51 -0700323 then
Tim Ricea5757f02004-07-01 20:41:15 -0700324 echo "PrivSep user $SSH_PRIVSEP_USER already exists."
325 SSH_PRIVSEP_GROUP=\`grep "^$SSH_PRIVSEP_USER:" \${PKG_INSTALL_ROOT}/etc/passwd | awk -F: '{print \$4}'\`
326 SSH_PRIVSEP_GROUP=\`grep ":\$SSH_PRIVSEP_GROUP:" \${PKG_INSTALL_ROOT}/etc/group | awk -F: '{print \$1}'\`
Tim Rice6f1f7582004-05-30 21:38:51 -0700327 else
Tim Ricea5757f02004-07-01 20:41:15 -0700328 DO_PASSWD=yes
329 fi
330 [ -z "\$SSH_PRIVSEP_GROUP" ] && SSH_PRIVSEP_GROUP=$SSH_PRIVSEP_USER
331
332 # group required?
333 if cut -f1 -d: \${PKG_INSTALL_ROOT}/etc/group | egrep '^'\$SSH_PRIVSEP_GROUP'\$' >/dev/null
334 then
335 echo "PrivSep group \$SSH_PRIVSEP_GROUP already exists."
336 else
337 DO_GROUP=yes
338 fi
339
340 # create group if required
341 [ "\$DO_GROUP" = yes ] && {
Tim Rice6f1f7582004-05-30 21:38:51 -0700342 # Use gid of 67 if possible
343 if cut -f3 -d: \${PKG_INSTALL_ROOT}/etc/group | egrep '^'$SSHDGID'\$' >/dev/null
344 then
345 :
346 else
347 sshdgid="-g $SSHDGID"
348 fi
Tim Ricea5757f02004-07-01 20:41:15 -0700349 echo "Creating PrivSep group \$SSH_PRIVSEP_GROUP."
350 \$chroot ${PATH_GROUPADD_PROG} \$sshdgid \$SSH_PRIVSEP_GROUP
351 }
Tim Rice6f1f7582004-05-30 21:38:51 -0700352
353 # Create user if required
Tim Ricea5757f02004-07-01 20:41:15 -0700354 [ "\$DO_PASSWD" = yes ] && {
Tim Rice6f1f7582004-05-30 21:38:51 -0700355 # Use uid of 67 if possible
356 if cut -f3 -d: \${PKG_INSTALL_ROOT}/etc/passwd | egrep '^'$SSHDGID'\$' >/dev/null
357 then
358 :
359 else
360 sshduid="-u $SSHDUID"
361 fi
362 echo "Creating PrivSep user $SSH_PRIVSEP_USER."
363 \$chroot ${PATH_USERADD_PROG} -c 'SSHD PrivSep User' -s /bin/false -g $SSH_PRIVSEP_USER \$sshduid $SSH_PRIVSEP_USER
364 \$chroot ${PATH_PASSWD_PROG} -l $SSH_PRIVSEP_USER
Tim Ricea5757f02004-07-01 20:41:15 -0700365 }
Tim Rice6f1f7582004-05-30 21:38:51 -0700366fi
367
368[ "\${POST_INS_START}" = "yes" ] && ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} start
369exit 0
370_EOF
371
372## Build preremove file
373echo "Building preremove file..."
374cat > preremove << _EOF
375#! ${SCRIPT_SHELL}
376#
377${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} stop
378_EOF
379
380# local preremove changes here
381[ -s "${PKG_PREREMOVE_LOCAL}" ] && . ${PKG_PREREMOVE_LOCAL}
382
383cat >> preremove << _EOF
384exit 0
385_EOF
386
387## Build postremove file
388echo "Building postremove file..."
389cat > postremove << _EOF
390#! ${SCRIPT_SHELL}
391#
392_EOF
393
394# local postremove changes here
395[ -s "${PKG_POSTREMOVE_LOCAL}" ] && . ${PKG_POSTREMOVE_LOCAL}
396
397cat >> postremove << _EOF
398exit 0
399_EOF
400
401## Build request file
402echo "Building request file..."
403cat > request << _EOF
404trap 'exit 3' 15
405
406_EOF
407
408[ -x /usr/bin/ckyorn ] || cat >> request << _EOF
409
410ckyorn() {
411# for some strange reason OpenServer has no ckyorn
412# We build a striped down version here
413
414DEFAULT=n
415PROMPT="Yes or No [yes,no,?,quit]"
416HELP_PROMPT=" Enter y or yes if your answer is yes; n or no if your answer is no."
417USAGE="usage: ckyorn [options]
418where options may include:
419 -d default
420 -h help
421 -p prompt
422"
423
424if [ \$# != 0 ]
425then
426 while getopts d:p:h: c
427 do
428 case \$c in
429 h) HELP_PROMPT="\$OPTARG" ;;
430 d) DEFAULT=\$OPTARG ;;
431 p) PROMPT=\$OPTARG ;;
432 \\?) echo "\$USAGE" 1>&2
433 exit 1 ;;
434 esac
435 done
436 shift \`expr \$OPTIND - 1\`
437fi
438
439while true
440do
441 echo "\${PROMPT}\\c " 1>&2
442 read key
443 [ -z "\$key" ] && key=\$DEFAULT
444 case \$key in
445 [n,N]|[n,N][o,O]|[y,Y]|[y,Y][e,E][s,S]) echo "\${key}\\c"
446 exit 0 ;;
447 \\?) echo \$HELP_PROMPT 1>&2 ;;
448 q|quit) echo "q\\c" 1>&2
449 exit 3 ;;
450 esac
451done
452
453}
454
455_EOF
456
457cat >> request << _EOF
458USE_SYM_LINKS=no
459PRE_INS_STOP=no
460POST_INS_START=no
461# Use symbolic links?
462ans=\`ckyorn -d n \
463-p "Do you want symbolic links for the start/stop scripts? ${DEF_MSG}"\` || exit \$?
464case \$ans in
465 [y,Y]*) USE_SYM_LINKS=yes ;;
466esac
467
468# determine if should restart the daemon
469if [ -s ${piddir}/sshd.pid -a -f ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} ]
470then
471 ans=\`ckyorn -d n \
472-p "Should the running sshd daemon be restarted? ${DEF_MSG}"\` || exit \$?
473 case \$ans in
474 [y,Y]*) PRE_INS_STOP=yes
475 POST_INS_START=yes
476 ;;
477 esac
478
479else
480
481# determine if we should start sshd
482 ans=\`ckyorn -d n \
483-p "Start the sshd daemon after installing this package? ${DEF_MSG}"\` || exit \$?
484 case \$ans in
485 [y,Y]*) POST_INS_START=yes ;;
486 esac
487fi
488
489# make parameters available to installation service,
490# and so to any other packaging scripts
491cat >\$1 <<!
492USE_SYM_LINKS='\$USE_SYM_LINKS'
493PRE_INS_STOP='\$PRE_INS_STOP'
494POST_INS_START='\$POST_INS_START'
495!
496
497_EOF
498
499# local request changes here
500[ -s "${PKG_REQUEST_LOCAL}" ] && . ${PKG_REQUEST_LOCAL}
501
502cat >> request << _EOF
503exit 0
504
505_EOF
506
507## Next Build our prototype
508echo "Building prototype file..."
509cat >mk-proto.awk << _EOF
510 BEGIN { print "i pkginfo"; print "i depend"; \\
511 print "i preinstall"; print "i postinstall"; \\
512 print "i preremove"; print "i postremove"; \\
513 print "i request"; print "i space"; \\
514 split("$SYSTEM_DIR",sys_files); }
515 {
516 for (dir in sys_files) { if ( \$3 != sys_files[dir] )
517 { if ( \$1 == "s" )
518 { \$5=""; \$6=""; }
519 else
520 { \$5="root"; \$6="sys"; }
521 }
522 else
523 { \$4="?"; \$5="?"; \$6="?"; break;}
524 } }
525 { print; }
526_EOF
527
528find . | egrep -v "prototype|pkginfo|mk-proto.awk" | sort | \
529 pkgproto $PROTO_ARGS | nawk -f mk-proto.awk > prototype
530
531# /usr/local is a symlink on some systems
532[ "${USR_LOCAL_IS_SYMLINK}" = yes ] && {
533 grep -v "^d none /usr/local ? ? ?$" prototype > prototype.new
534 mv prototype.new prototype
535}
536
537## Step back a directory and now build the package.
538cd ..
539# local prototype tweeks here
540[ -s "${POST_PROTOTYPE_EDITS}" ] && . ${POST_PROTOTYPE_EDITS}
541
542echo "Building package.."
543pkgmk -d ${FAKE_ROOT} -f $FAKE_ROOT/prototype -o
Tim Ricea5757f02004-07-01 20:41:15 -0700544echo | pkgtrans -os ${FAKE_ROOT} ${START}/$PKGNAME-$VERSION$REV-$UNAME_S-$ARCH.pkg
Tim Rice6f1f7582004-05-30 21:38:51 -0700545 ;;
546
547 justpkg.sh)
548rm -fr ${FAKE_ROOT}/${PKGNAME}
549grep -v "^PSTAMP=" $FAKE_ROOT/pkginfo > $$tmp
550mv $$tmp $FAKE_ROOT/pkginfo
551cat >> $FAKE_ROOT/pkginfo << _EOF
552PSTAMP="${UNAME_S} ${OS_VER} ${ARCH} `date '+%d%b%Y %H:%M'`"
553_EOF
554pkgmk -d ${FAKE_ROOT} -f $FAKE_ROOT/prototype -o
Tim Ricea5757f02004-07-01 20:41:15 -0700555echo | pkgtrans -os ${FAKE_ROOT} ${START}/$PKGNAME-$VERSION$REV-$UNAME_S-$ARCH.pkg
Tim Rice6f1f7582004-05-30 21:38:51 -0700556 ;;
557
558esac
559
560[ "${REMOVE_FAKE_ROOT_WHEN_DONE}" = yes ] && rm -rf $FAKE_ROOT
Tim Rice2d2b9f72004-05-30 21:48:40 -0700561exit 0
Tim Rice6f1f7582004-05-30 21:38:51 -0700562