summaryrefslogtreecommitdiff
path: root/buildpkg.sh.in
diff options
context:
space:
mode:
authorTim Rice <tim@multitalents.net>2004-07-01 20:41:15 -0700
committerTim Rice <tim@multitalents.net>2004-07-01 20:41:15 -0700
commita5757f0f28c95c6eee8ce570e58a1321d74fe4ad (patch)
tree0aab5216227af2c7e9af98aff02df2974fd58e87 /buildpkg.sh.in
parent1f7e40864faa5632696718ea6950ebdb4df41ce5 (diff)
- (tim) [buildpkg.sh.in] Add $REV to bump the package revision within
the same version. Handle the case where someone uses --with-privsep-user= and the user name does not match the group name. ok dtucker@
Diffstat (limited to 'buildpkg.sh.in')
-rw-r--r--buildpkg.sh.in43
1 files changed, 29 insertions, 14 deletions
diff --git a/buildpkg.sh.in b/buildpkg.sh.in
index 3b5343b95..f243e90bf 100644
--- a/buildpkg.sh.in
+++ b/buildpkg.sh.in
@@ -21,6 +21,8 @@ REMOVE_FAKE_ROOT_WHEN_DONE=yes
21# that support the -R option to pkgadd. 21# that support the -R option to pkgadd.
22#TEST_DIR=/var/tmp # leave commented out for production build 22#TEST_DIR=/var/tmp # leave commented out for production build
23PKGNAME=OpenSSH 23PKGNAME=OpenSSH
24# revisions within the same version (REV=a)
25#REV=
24SYSVINIT_NAME=opensshd 26SYSVINIT_NAME=opensshd
25MAKE=${MAKE:="make"} 27MAKE=${MAKE:="make"}
26SSHDUID=67 # Default privsep uid 28SSHDUID=67 # Default privsep uid
@@ -206,7 +208,7 @@ NAME="OpenSSH Portable for ${UNAME_S}"
206DESC="Secure Shell remote access utility; replaces telnet and rlogin/rsh." 208DESC="Secure Shell remote access utility; replaces telnet and rlogin/rsh."
207VENDOR="OpenSSH Portable Team - http://www.openssh.com/portable.html" 209VENDOR="OpenSSH Portable Team - http://www.openssh.com/portable.html"
208ARCH=$ARCH 210ARCH=$ARCH
209VERSION=$VERSION 211VERSION=$VERSION$REV
210CATEGORY="Security,application" 212CATEGORY="Security,application"
211BASEDIR=/ 213BASEDIR=/
212CLASSES="none" 214CLASSES="none"
@@ -316,11 +318,27 @@ then
316else 318else
317 echo "UsePrivilegeSeparation enabled in config (or defaulting to on)." 319 echo "UsePrivilegeSeparation enabled in config (or defaulting to on)."
318 320
319 # create group if required 321 # user required?
320 if cut -f1 -d: \${PKG_INSTALL_ROOT}/etc/group | egrep '^'$SSH_PRIVSEP_USER'\$' >/dev/null 322 if cut -f1 -d: \${PKG_INSTALL_ROOT}/etc/passwd | egrep '^'$SSH_PRIVSEP_USER'\$' >/dev/null
323 then
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}'\`
327 else
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
321 then 334 then
322 echo "PrivSep group $SSH_PRIVSEP_USER already exists." 335 echo "PrivSep group \$SSH_PRIVSEP_GROUP already exists."
323 else 336 else
337 DO_GROUP=yes
338 fi
339
340 # create group if required
341 [ "\$DO_GROUP" = yes ] && {
324 # Use gid of 67 if possible 342 # Use gid of 67 if possible
325 if cut -f3 -d: \${PKG_INSTALL_ROOT}/etc/group | egrep '^'$SSHDGID'\$' >/dev/null 343 if cut -f3 -d: \${PKG_INSTALL_ROOT}/etc/group | egrep '^'$SSHDGID'\$' >/dev/null
326 then 344 then
@@ -328,15 +346,12 @@ else
328 else 346 else
329 sshdgid="-g $SSHDGID" 347 sshdgid="-g $SSHDGID"
330 fi 348 fi
331 echo "Creating PrivSep group $SSH_PRIVSEP_USER." 349 echo "Creating PrivSep group \$SSH_PRIVSEP_GROUP."
332 \$chroot ${PATH_GROUPADD_PROG} \$sshdgid $SSH_PRIVSEP_USER 350 \$chroot ${PATH_GROUPADD_PROG} \$sshdgid \$SSH_PRIVSEP_GROUP
333 fi 351 }
334 352
335 # Create user if required 353 # Create user if required
336 if cut -f1 -d: \${PKG_INSTALL_ROOT}/etc/passwd | egrep '^'$SSH_PRIVSEP_USER'\$' >/dev/null 354 [ "\$DO_PASSWD" = yes ] && {
337 then
338 echo "PrivSep user $SSH_PRIVSEP_USER already exists."
339 else
340 # Use uid of 67 if possible 355 # Use uid of 67 if possible
341 if cut -f3 -d: \${PKG_INSTALL_ROOT}/etc/passwd | egrep '^'$SSHDGID'\$' >/dev/null 356 if cut -f3 -d: \${PKG_INSTALL_ROOT}/etc/passwd | egrep '^'$SSHDGID'\$' >/dev/null
342 then 357 then
@@ -347,7 +362,7 @@ else
347 echo "Creating PrivSep user $SSH_PRIVSEP_USER." 362 echo "Creating PrivSep user $SSH_PRIVSEP_USER."
348 \$chroot ${PATH_USERADD_PROG} -c 'SSHD PrivSep User' -s /bin/false -g $SSH_PRIVSEP_USER \$sshduid $SSH_PRIVSEP_USER 363 \$chroot ${PATH_USERADD_PROG} -c 'SSHD PrivSep User' -s /bin/false -g $SSH_PRIVSEP_USER \$sshduid $SSH_PRIVSEP_USER
349 \$chroot ${PATH_PASSWD_PROG} -l $SSH_PRIVSEP_USER 364 \$chroot ${PATH_PASSWD_PROG} -l $SSH_PRIVSEP_USER
350 fi 365 }
351fi 366fi
352 367
353[ "\${POST_INS_START}" = "yes" ] && ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} start 368[ "\${POST_INS_START}" = "yes" ] && ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} start
@@ -526,7 +541,7 @@ cd ..
526 541
527echo "Building package.." 542echo "Building package.."
528pkgmk -d ${FAKE_ROOT} -f $FAKE_ROOT/prototype -o 543pkgmk -d ${FAKE_ROOT} -f $FAKE_ROOT/prototype -o
529echo | pkgtrans -os ${FAKE_ROOT} ${START}/$PKGNAME-$VERSION-$UNAME_S-$ARCH.pkg 544echo | pkgtrans -os ${FAKE_ROOT} ${START}/$PKGNAME-$VERSION$REV-$UNAME_S-$ARCH.pkg
530 ;; 545 ;;
531 546
532 justpkg.sh) 547 justpkg.sh)
@@ -537,7 +552,7 @@ cat >> $FAKE_ROOT/pkginfo << _EOF
537PSTAMP="${UNAME_S} ${OS_VER} ${ARCH} `date '+%d%b%Y %H:%M'`" 552PSTAMP="${UNAME_S} ${OS_VER} ${ARCH} `date '+%d%b%Y %H:%M'`"
538_EOF 553_EOF
539pkgmk -d ${FAKE_ROOT} -f $FAKE_ROOT/prototype -o 554pkgmk -d ${FAKE_ROOT} -f $FAKE_ROOT/prototype -o
540echo | pkgtrans -os ${FAKE_ROOT} ${START}/$PKGNAME-$VERSION-$UNAME_S-$ARCH.pkg 555echo | pkgtrans -os ${FAKE_ROOT} ${START}/$PKGNAME-$VERSION$REV-$UNAME_S-$ARCH.pkg
541 ;; 556 ;;
542 557
543esac 558esac