]> andersk Git - gssapi-openssh.git/blame - openssh/buildpkg.sh.in
Merge from OPENSSH_3_8_1P1_GSSAPI_20040713 to OPENSSH_3_9P1_GSSAPI_20040818.
[gssapi-openssh.git] / openssh / buildpkg.sh.in
CommitLineData
3c0ef626 1#!/bin/sh
2#
2980ea68 3# Fake Root Solaris/SVR4/SVR5 Build System - Prototype
3c0ef626 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)
416fd2a8 8#
3c0ef626 9umask 022
2980ea68 10#
11# Options for building the package
1b56ff3d 12# You can create a openssh-config.local with your customized options
13#
14REMOVE_FAKE_ROOT_WHEN_DONE=yes
2980ea68 15#
e54b3d7c 16# uncommenting TEST_DIR and using
17# configure --prefix=/var/tmp --with-privsep-path=/var/tmp/empty
416fd2a8 18# and
2980ea68 19# PKGNAME=tOpenSSH should allow testing a package without interfering
e54b3d7c 20# with a real OpenSSH package on a system. This is not needed on systems
21# that support the -R option to pkgadd.
2980ea68 22#TEST_DIR=/var/tmp # leave commented out for production build
3c0ef626 23PKGNAME=OpenSSH
1b56ff3d 24# revisions within the same version (REV=a)
25#REV=
2980ea68 26SYSVINIT_NAME=opensshd
27MAKE=${MAKE:="make"}
e54b3d7c 28SSHDUID=67 # Default privsep uid
29SSHDGID=67 # Default privsep gid
416fd2a8 30# uncomment these next three as needed
2980ea68 31#PERMIT_ROOT_LOGIN=no
32#X11_FORWARDING=yes
416fd2a8 33#USR_LOCAL_IS_SYMLINK=yes
1b56ff3d 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#
48OPENSSHD=opensshd.init
49
50PATH_GROUPADD_PROG=@PATH_GROUPADD_PROG@
51PATH_USERADD_PROG=@PATH_USERADD_PROG@
52PATH_PASSWD_PROG=@PATH_PASSWD_PROG@
53#
2980ea68 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"
3c0ef626 87
e54b3d7c 88# We may need to build as root so we make sure PATH is set up
2980ea68 89# only set the path if it's not set already
1b56ff3d 90[ -d /opt/bin ] && {
91 echo $PATH | grep ":/opt/bin" > /dev/null 2>&1
92 [ $? -ne 0 ] && PATH=$PATH:/opt/bin
93}
2980ea68 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
1b56ff3d 110# we will look for openssh-config.local to override the above options
111[ -s ./openssh-config.local ] && . ./openssh-config.local
3c0ef626 112
3c0ef626 113START=`pwd`
1b56ff3d 114FAKE_ROOT=$START/pkg
3c0ef626 115
116## Fill in some details, like prefix and sysconfdir
1b56ff3d 117for confvar in prefix exec_prefix bindir sbindir libexecdir datadir mandir sysconfdir piddir srcdir
2980ea68 118do
416fd2a8 119 eval $confvar=`grep "^$confvar=" Makefile | cut -d = -f 2`
2980ea68 120done
3c0ef626 121
e54b3d7c 122
123## Collect value of privsep user
124for confvar in SSH_PRIVSEP_USER
125do
416fd2a8 126 eval $confvar=`awk '/#define[ \t]'$confvar'/{print $3}' config.h`
e54b3d7c 127done
128
129## Set privsep defaults if not defined
130if [ -z "$SSH_PRIVSEP_USER" ]
131then
416fd2a8 132 SSH_PRIVSEP_USER=sshd
e54b3d7c 133fi
134
2980ea68 135## Extract common info requires for the 'info' part of the package.
136VERSION=`./ssh -V 2>&1 | sed -e 's/,.*//'`
3c0ef626 137
1b56ff3d 138ARCH=`uname -m`
139DEF_MSG="\n"
140OS_VER=`uname -v`
141SCRIPT_SHELL=/sbin/sh
2980ea68 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 ;;
1b56ff3d 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 ;;
2980ea68 155esac
156
1b56ff3d 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
2980ea68 170## Setup our run level stuff while we are at it.
171mkdir -p $FAKE_ROOT${TEST_DIR}/etc/init.d
3c0ef626 172
1b56ff3d 173cp ${OPENSSHD} $FAKE_ROOT${TEST_DIR}/etc/init.d/${SYSVINIT_NAME}
2980ea68 174chmod 744 $FAKE_ROOT${TEST_DIR}/etc/init.d/${SYSVINIT_NAME}
3c0ef626 175
2980ea68 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
3c0ef626 185
2980ea68 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
1b56ff3d 192# local tweeks here
193[ -s "${POST_MAKE_INSTALL_FIXES}" ] && . ${POST_MAKE_INSTALL_FIXES}
194
2980ea68 195cd $FAKE_ROOT
3c0ef626 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
2980ea68 207NAME="OpenSSH Portable for ${UNAME_S}"
3c0ef626 208DESC="Secure Shell remote access utility; replaces telnet and rlogin/rsh."
209VENDOR="OpenSSH Portable Team - http://www.openssh.com/portable.html"
3c0ef626 210ARCH=$ARCH
1b56ff3d 211VERSION=$VERSION$REV
2980ea68 212CATEGORY="Security,application"
3c0ef626 213BASEDIR=/
2980ea68 214CLASSES="none"
1b56ff3d 215PSTAMP="${UNAME_S} ${OS_VER} ${ARCH} `date '+%d%b%Y %H:%M'`"
2980ea68 216_EOF
217
1b56ff3d 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
2980ea68 234## Build preinstall file
235echo "Building preinstall file..."
236cat > preinstall << _EOF
1b56ff3d 237#! ${SCRIPT_SHELL}
238#
239_EOF
240
241# local preinstall changes here
242[ -s "${PKG_PREINSTALL_LOCAL}" ] && . ${PKG_PREINSTALL_LOCAL}
243
244cat >> preinstall << _EOF
2980ea68 245#
246[ "\${PRE_INS_STOP}" = "yes" ] && ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} stop
247exit 0
3c0ef626 248_EOF
249
2980ea68 250## Build postinstall file
251echo "Building postinstall file..."
252cat > postinstall << _EOF
1b56ff3d 253#! ${SCRIPT_SHELL}
2980ea68 254#
e54b3d7c 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
2980ea68 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
1b56ff3d 271 [ "$RC1_D" = no ] || mkdir -p ${TEST_DIR}/etc/rc1.d
2980ea68 272 mkdir -p ${TEST_DIR}/etc/rc2.d
273}
274
275if [ "\${USE_SYM_LINKS}" = yes ]
276then
277 [ "$RCS_D" = yes ] && \
1b56ff3d 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
2980ea68 283else
284 [ "$RCS_D" = yes ] && \
1b56ff3d 285installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rcS.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l
286 installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc0.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l
287 [ "$RC1_D" = no ] || \
288 installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc1.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l
289 installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc2.d/${SYSVINITSTART}${SYSVINIT_NAME}=$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l
2980ea68 290fi
291
292# If piddir doesn't exist we add it. (Ie. --with-pid-dir=/var/opt/ssh)
1b56ff3d 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}
2980ea68 299
1b56ff3d 300cat >> postinstall << _EOF
2980ea68 301installf -f ${PKGNAME}
302
e54b3d7c 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
416fd2a8 316 echo "UsePrivilegeSeparation disabled in config, not creating PrivSep user"
317 echo "or group."
e54b3d7c 318else
416fd2a8 319 echo "UsePrivilegeSeparation enabled in config (or defaulting to on)."
e54b3d7c 320
1b56ff3d 321 # user required?
322 if cut -f1 -d: \${PKG_INSTALL_ROOT}/etc/passwd | egrep '^'$SSH_PRIVSEP_USER'\$' >/dev/null
416fd2a8 323 then
1b56ff3d 324 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}'\`
416fd2a8 327 else
1b56ff3d 328 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 ] && {
e54b3d7c 342 # 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
1b56ff3d 349 echo "Creating PrivSep group \$SSH_PRIVSEP_GROUP."
350 \$chroot ${PATH_GROUPADD_PROG} \$sshdgid \$SSH_PRIVSEP_GROUP
351 }
416fd2a8 352
353 # Create user if required
1b56ff3d 354 [ "\$DO_PASSWD" = yes ] && {
e54b3d7c 355 # 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
416fd2a8 362 echo "Creating PrivSep user $SSH_PRIVSEP_USER."
1b56ff3d 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
365 }
e54b3d7c 366fi
367
2980ea68 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
1b56ff3d 375#! ${SCRIPT_SHELL}
2980ea68 376#
377${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} stop
1b56ff3d 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
2980ea68 398exit 0
399_EOF
400
401## Build request file
402echo "Building request file..."
403cat > request << _EOF
404trap 'exit 3' 15
1b56ff3d 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
2980ea68 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!
2980ea68 496
497_EOF
498
1b56ff3d 499# local request changes here
500[ -s "${PKG_REQUEST_LOCAL}" ] && . ${PKG_REQUEST_LOCAL}
501
502cat >> request << _EOF
503exit 0
504
2980ea68 505_EOF
2980ea68 506
3c0ef626 507## Next Build our prototype
508echo "Building prototype file..."
2980ea68 509cat >mk-proto.awk << _EOF
1b56ff3d 510 BEGIN { print "i pkginfo"; print "i depend"; \\
511 print "i preinstall"; print "i postinstall"; \\
512 print "i preremove"; print "i postremove"; \\
2980ea68 513 print "i request"; print "i space"; \\
416fd2a8 514 split("$SYSTEM_DIR",sys_files); }
2980ea68 515 {
516 for (dir in sys_files) { if ( \$3 != sys_files[dir] )
1b56ff3d 517 { if ( \$1 == "s" )
518 { \$5=""; \$6=""; }
519 else
520 { \$5="root"; \$6="sys"; }
521 }
416fd2a8 522 else
523 { \$4="?"; \$5="?"; \$6="?"; break;}
2980ea68 524 } }
525 { print; }
526_EOF
1b56ff3d 527
2980ea68 528find . | egrep -v "prototype|pkginfo|mk-proto.awk" | sort | \
529 pkgproto $PROTO_ARGS | nawk -f mk-proto.awk > prototype
3c0ef626 530
416fd2a8 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
3c0ef626 537## Step back a directory and now build the package.
3c0ef626 538cd ..
1b56ff3d 539# local prototype tweeks here
540[ -s "${POST_PROTOTYPE_EDITS}" ] && . ${POST_PROTOTYPE_EDITS}
541
542echo "Building package.."
2980ea68 543pkgmk -d ${FAKE_ROOT} -f $FAKE_ROOT/prototype -o
1b56ff3d 544echo | pkgtrans -os ${FAKE_ROOT} ${START}/$PKGNAME-$VERSION$REV-$UNAME_S-$ARCH.pkg
545 ;;
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
555echo | pkgtrans -os ${FAKE_ROOT} ${START}/$PKGNAME-$VERSION$REV-$UNAME_S-$ARCH.pkg
556 ;;
557
558esac
559
560[ "${REMOVE_FAKE_ROOT_WHEN_DONE}" = yes ] && rm -rf $FAKE_ROOT
561exit 0
2980ea68 562
This page took 0.147887 seconds and 5 git commands to generate.