diff options
author | jlam <jlam> | 2006-07-17 14:30:05 +0000 |
---|---|---|
committer | jlam <jlam> | 2006-07-17 14:30:05 +0000 |
commit | ef9ea0828528bf20cd645b69500ad8ba63371c84 (patch) | |
tree | 30e9980a599b3f8d08f02661f7fd283d9879c3cb /bootstrap | |
parent | fb7fe393dfcde797e7fc5680dc3ca0d31fed3fb3 (diff) | |
download | pkgsrc-ef9ea0828528bf20cd645b69500ad8ba63371c84.tar.gz |
* Move the "extra" scripts installed by bootstrap for certain platforms
into a separate package pkgtools/bootstrap-extras. Teach the bootstrap
script to look for those scripts from the bootstrap-extras package.
* When registering the installed software, set WRKOBJDIR to the bootstrap
work directory to protect against a read-only pkgsrc tree.
Diffstat (limited to 'bootstrap')
-rwxr-xr-x | bootstrap/bootstrap | 57 | ||||
-rwxr-xr-x | bootstrap/files/fakeldd | 2 | ||||
-rwxr-xr-x | bootstrap/files/install-sh.in | 291 | ||||
-rwxr-xr-x | bootstrap/files/mkdir-sh | 45 | ||||
-rwxr-xr-x | bootstrap/files/strip-sh | 26 | ||||
-rwxr-xr-x | bootstrap/mkbootstrapkit | 5 |
6 files changed, 38 insertions, 388 deletions
diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap index 1ec62ef92fa..990ecd1d208 100755 --- a/bootstrap/bootstrap +++ b/bootstrap/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh -# $NetBSD: bootstrap,v 1.66 2006/07/14 23:19:15 jlam Exp $ +# $NetBSD: bootstrap,v 1.67 2006/07/17 14:30:05 jlam Exp $ # # # Copyright (c) 2001-2002 Alistair G. Crooks. All rights reserved. @@ -174,7 +174,8 @@ opsys_finish() fi if [ `uname -r` -lt 6 ]; then echo_msg "Installing fake ldd script" - run_cmd "$shprog $wrkdir/install-sh -c -o $user -g $group -m 755 files/fakeldd $prefix/sbin" + run_cmd "$install_sh -c -o $user -g $group -m 755 ../pkgtools/bootstrap-extras/files/fakeldd $prefix/sbin" + need_extras=yes echo "LDD= $prefix/sbin/fakeldd" >> ${MKCONF_EXAMPLE} fi ;; @@ -220,7 +221,7 @@ run_cmd() mkdir_p() { for dir in $@; do - run_cmd "$shprog $wrkdir/install-sh -d -o $user -g $group $dir" + run_cmd "$install_sh -d -o $user -g $group $dir" done } @@ -277,6 +278,7 @@ while [ $# -gt 0 ]; do done # set defaults for system locations if not already set by the user +wrkobjdir=${wrkdir}/pkgsrc if [ "$ignoreusercheck" = "yes" ]; then [ -z "$prefix" ] && prefix=${HOME}/pkg [ -z "$pkgdbdir" ] && pkgdbdir=${prefix}/var/db/pkg @@ -303,6 +305,7 @@ root_user=root bmakexenv= bmakexargs= tnftpxenv= +need_extras=no case "$opsys" in Darwin) root_group=wheel @@ -565,10 +568,10 @@ if [ x"$check_compiler" = x"yes" ]; then fi fi -if [ ! -x ${wrkdir}/install-sh ]; then - run_cmd "$sedprog -e 's|@DEFAULT_INSTALL_MODE@|'${default_install_mode-0755}'|' files/install-sh.in > $wrkdir/install-sh" - run_cmd "$chmodprog +x $wrkdir/install-sh" -fi +# build install-sh +run_cmd "$sedprog -e 's|@DEFAULT_INSTALL_MODE@|'${default_install_mode-0755}'|' ../sysutils/install-sh/files/install-sh.in > $wrkdir/install-sh" +run_cmd "$chmodprog +x $wrkdir/install-sh" +install_sh="$shprog $wrkdir/install-sh" is_root if [ $? = 1 ]; then @@ -696,28 +699,30 @@ run_cmd "$cpprog bsd.* sys.mk $prefix/share/mk" if [ "$need_bsd_install" = "yes" ]; then echo_msg "Installing BSD compatible install script" - run_cmd "$shprog $wrkdir/install-sh -c -o $user -g $group -m 755 $wrkdir/install-sh $prefix/bin/install-sh" + run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/install-sh/install-sh $prefix/bin/install-sh" BSTRAP_ENV="INSTALL='$prefix/bin/install-sh -c' $BSTRAP_ENV" echo "TOOLS_PLATFORM.install?= $prefix/bin/install-sh" >> ${MKCONF_EXAMPLE} fi if [ "$need_fixed_strip" = "yes" ] ; then echo_msg "Installing fixed strip script" - run_cmd "$shprog $wrkdir/install-sh -c -o $user -g $group -m 755 files/strip-sh $prefix/bin/strip" + run_cmd "$install_sh -c -o $user -g $group -m 755 ../pkgtools/bootstrap-extras/files/strip-sh $prefix/bin/strip" echo "TOOLS_PLATFORM.strip?= $prefix/bin/strip" >> ${MKCONF_EXAMPLE} + need_extras=yes fi if [ "$need_mkdir" = "yes" ]; then echo_msg "Installing fixed mkdir script \"mkdir-sh\"" - run_cmd "$shprog $wrkdir/install-sh -c -o $user -g $group -m 755 files/mkdir-sh $prefix/sbin/mkdir-sh" - echo "TOOLS_PLATFORM.mkdir?= $prefix/sbin/mkdir-sh -p" >> ${MKCONF_EXAMPLE} + run_cmd "$install_sh -c -o $user -g $group -m 755 ../pkgtools/bootstrap-extras/files/mkdir-sh $prefix/bin/mkdir-sh" + echo "TOOLS_PLATFORM.mkdir?= $prefix/bin/mkdir-sh -p" >> ${MKCONF_EXAMPLE} + need_extras=yes fi echo_msg "Installing bmake" copy_src ../devel/bmake/files bmake run_cmd "(cd $wrkdir/bmake && env CPPFLAGS='$CPPFLAGS -I../../libnbcompat' LDFLAGS='$LDFLAGS -L../../libnbcompat' LIBS='-lnbcompat' $bmakexenv $shprog ./boot-strap -q -o $opsys --prefix=$prefix --sysconfdir=$sysconfdir --mksrc none --with-default-sys-path="$prefix/share/mk" $bmakexargs)" -run_cmd "$shprog $wrkdir/install-sh -c -o $user -g $group -m 755 $wrkdir/bmake/$opsys/bmake $prefix/bin/bmake" -run_cmd "$shprog $wrkdir/install-sh -c -o $user -g $group -m 644 $wrkdir/bmake/bmake.1 $mandir/man1/bmake.1" +run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/bmake/$opsys/bmake $prefix/bin/bmake" +run_cmd "$install_sh -c -o $user -g $group -m 644 $wrkdir/bmake/bmake.1 $mandir/man1/bmake.1" bmake=$prefix/bin/bmake @@ -726,8 +731,8 @@ case "$need_awk" in yes) echo_msg "Installing awk" copy_src ../lang/nawk/files awk run_cmd "(cd $wrkdir/awk && $bmake)" - run_cmd "$shprog $wrkdir/install-sh -c -o $user -g $group -m 755 $wrkdir/awk/a.out $prefix/bin/nawk" - run_cmd "$shprog $wrkdir/install-sh -c -o $user -g $group -m 644 $wrkdir/awk/nawk.1 $mandir/man1/nawk.1" + run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/awk/a.out $prefix/bin/nawk" + run_cmd "$install_sh -c -o $user -g $group -m 644 $wrkdir/awk/nawk.1 $mandir/man1/nawk.1" echo "TOOLS_PLATFORM.awk?= $prefix/bin/nawk" >> ${MKCONF_EXAMPLE} BSTRAP_ENV="AWK=\"$prefix/bin/nawk\" $BSTRAP_ENV" ;; @@ -808,27 +813,33 @@ echo ".endif # end pkgsrc settings" >> ${MKCONF_EXAMPLE} # register packages echo_msg "Registering installed packages" -run_cmd "(cd ../pkgtools/bootstrap-mk-files && $bmake MAKECONF=${MKCONF_EXAMPLE} bootstrap-register)" +run_cmd "(cd ../pkgtools/bootstrap-mk-files && $bmake MAKECONF=${MKCONF_EXAMPLE} WRKOBJDIR=$wrkobjdir bootstrap-register)" case "$need_awk" in -yes) run_cmd "(cd ../lang/nawk && $bmake MAKECONF=${MKCONF_EXAMPLE} bootstrap-register)" ;; +yes) run_cmd "(cd ../lang/nawk && $bmake MAKECONF=${MKCONF_EXAMPLE} WRKOBJDIR=$wrkobjdir bootstrap-register)" ;; esac case "$need_sed" in -yes) run_cmd "(cd ../textproc/nbsed && $bmake MAKECONF=${MKCONF_EXAMPLE} LIBNBCOMPAT_STYLE=inplace bootstrap-register)" ;; +yes) run_cmd "(cd ../textproc/nbsed && $bmake MAKECONF=${MKCONF_EXAMPLE} LIBNBCOMPAT_STYLE=inplace WRKOBJDIR=$wrkobjdir bootstrap-register)" ;; +esac +case "$need_bsd_install" in +yes) run_cmd "(cd ../sysutils/install-sh && $bmake MAKECONF=${MKCONF_EXAMPLE} WRKOBJDIR=$wrkobjdir bootstrap-register)" ;; +esac +case "$need_extras" in +yes) run_cmd "(cd ../pkgtools/bootstrap-extras && $bmake MAKECONF=${MKCONF_EXAMPLE} WRKOBJDIR=$wrkobjdir bootstrap-register)" ;; esac case "$need_ftp" in -yes) run_cmd "(cd ../pkgtools/tnftp && $bmake MAKECONF=${MKCONF_EXAMPLE} bootstrap-register)" ;; +yes) run_cmd "(cd ../pkgtools/tnftp && $bmake MAKECONF=${MKCONF_EXAMPLE} WRKOBJDIR=$wrkobjdir bootstrap-register)" ;; esac case "$need_mtree" in -yes) run_cmd "(cd ../pkgtools/mtree && $bmake MAKECONF=${MKCONF_EXAMPLE} bootstrap-register)" ;; +yes) run_cmd "(cd ../pkgtools/mtree && $bmake MAKECONF=${MKCONF_EXAMPLE} WRKOBJDIR=$wrkobjdir bootstrap-register)" ;; esac case "$need_pax" in -yes) run_cmd "(cd ../pkgtools/pax && $bmake MAKECONF=${MKCONF_EXAMPLE} bootstrap-register)" ;; +yes) run_cmd "(cd ../pkgtools/pax && $bmake MAKECONF=${MKCONF_EXAMPLE} WRKOBJDIR=$wrkobjdir bootstrap-register)" ;; esac -run_cmd "(cd ../pkgtools/pkg_install && $bmake MAKECONF=${MKCONF_EXAMPLE} bootstrap-register)" +run_cmd "(cd ../pkgtools/pkg_install && $bmake MAKECONF=${MKCONF_EXAMPLE} WRKOBJDIR=$wrkobjdir bootstrap-register)" # Install the man page. echo_msg "Installing packages(7) man page" -run_cmd "(cd ../pkgtools/pkgmanpages && $bmake MAKECONF=${MKCONF_EXAMPLE} install)" +run_cmd "(cd ../pkgtools/pkgmanpages && $bmake MAKECONF=${MKCONF_EXAMPLE} WRKOBJDIR=$wrkobjdir install)" echo "" echo "Please remember to add $prefix/bin to your PATH environment variable" diff --git a/bootstrap/files/fakeldd b/bootstrap/files/fakeldd deleted file mode 100755 index 727f9ba8c1c..00000000000 --- a/bootstrap/files/fakeldd +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -/usr/bin/elfdump -Dl $* | /usr/bin/nawk 'NF == 7 || NF == 8 {printf "x x %s\n",$1}' diff --git a/bootstrap/files/install-sh.in b/bootstrap/files/install-sh.in deleted file mode 100755 index 8c8108c24bb..00000000000 --- a/bootstrap/files/install-sh.in +++ /dev/null @@ -1,291 +0,0 @@ -#!/bin/sh -# -# $NetBSD: install-sh.in,v 1.3 2005/03/04 03:11:50 jschauma Exp $ -# This script now also installs multiple files, but might choke on installing -# multiple files with spaces in the file names. -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog @DEFAULT_INSTALL_MODE@" -chowncmd="" -chgrpcmd="" -stripcmd="" -stripflags="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -msrc="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -S) stripcmd="$stripprog" - stripflags="-S $2 $stripflags" - shift - shift - continue;; - - -t=*) transformarg=`echo "$1" | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo "$1" | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - msrc=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - msrc="$msrc $1" - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$dir_arg" = x -a x"$msrc" != x"$src $dst" ] -then - if [ ! -d "$dst" ]; then - echo "install: destination is not a directory" - exit 1 - fi -else - msrc=$src -fi - - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d "$dst" ]; then - instcmd=: - chmodcmd="" - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f "$src" ] - then - true - elif [ -d "$src" ] - then - echo "install: $src: not a regular file" - exit 1 - elif [ x"$src" = x"/dev/null" ] - then - instcmd="$cpprog" - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d "$dst" ] - then - dst="$dst"/`basename "$src"` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd "$dst" && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $stripflags "$dst"; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - for arg in `echo "$msrc"| sed -e 's/ [^ ]*$//'`; do - - if [ x"$msrc" = x"$src" ] - then - file=$dst - else - file=$arg - fi - - if [ x"$transformarg" = x ] - then - dstfile=`basename "$file"` - else - dstfile=`basename "$file" "$transformbasename" | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename "$file"` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $arg "$dsttmp" && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $stripflags "$dsttmp"; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f "$dstdir/$dstfile" && - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - done - -fi && - - -exit 0 diff --git a/bootstrap/files/mkdir-sh b/bootstrap/files/mkdir-sh deleted file mode 100755 index 0bec4f58687..00000000000 --- a/bootstrap/files/mkdir-sh +++ /dev/null @@ -1,45 +0,0 @@ -#! /bin/sh -# $NetBSD: mkdir-sh,v 1.2 2005/10/09 20:12:29 heinz Exp $ -# -# workaround for the broken "mkdir -p" on Unixware -PATH=/usr/bin:/usr/sbin; export PATH - -MKDIRCMD=mkdir -cmdargs="$@" - -# variable 'options' is unused -for options in p m; do - if [ $# -lt 1 ]; then - ${MKDIRCMD} ${cmdargs} - exit $? - fi - - case $1 in - -p) pathopt=-p; - shift;; - -m) modeopt="-m ${2}" - shift; - if [ $# -ne 0 ] ; then - shift - else - ${MKDIRCMD} ${cmdargs} - exit $? - fi - ;; - esac -done - -if [ $# -gt 0 ]; then - while [ $# -gt 0 ]; do - if [ -z "${pathopt}" ]; then - ${MKDIRCMD} ${modeopt} -- "$1" - elif [ ! -d $1 ] ; then - ${MKDIRCMD} ${pathopt} ${modeopt} -- "$1" - else - : # directory exists, nothing to do - fi - shift - done -else - ${MKDIRCMD} ${cmdargs} -fi diff --git a/bootstrap/files/strip-sh b/bootstrap/files/strip-sh deleted file mode 100755 index a737466080c..00000000000 --- a/bootstrap/files/strip-sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# -# On AIX, strip complains too much if the file is not -# writable, or if it's already stripped. -# -for f in "$@" ; do - if ! /usr/bin/file "$f" | grep -q "not stripped" ; then - # Skip the file if it's already stripped - continue - fi - nowrite=0 - if [ ! -w "$f" ] ; then - # Make sure it's writable. - nowrite=1 - chmod +w "$f" - fi - /usr/bin/strip "$f" - ret=$? - if [ $nowrite -eq 1 ] ; then - chmod -w "$f" - fi - if [ $ret -ne 0 ] ; then - exit $ret - fi -done -exit 0 diff --git a/bootstrap/mkbootstrapkit b/bootstrap/mkbootstrapkit index c513d437d2f..3ed381ba2ae 100755 --- a/bootstrap/mkbootstrapkit +++ b/bootstrap/mkbootstrapkit @@ -1,6 +1,6 @@ #! /bin/sh # -# $NetBSD: mkbootstrapkit,v 1.6 2006/07/14 22:17:09 jlam Exp $ +# $NetBSD: mkbootstrapkit,v 1.7 2006/07/17 14:30:05 jlam Exp $ # # Usage: mkbootstrapkit [kitdir] # @@ -26,6 +26,8 @@ for dir in \ lang/nawk \ mk \ net/tnftp \ + pkgtools/bootstrap-extras \ + pkgtools/bootstrap-mk-files \ pkgtools/digest \ pkgtools/libnbcompat \ pkgtools/mtree \ @@ -33,6 +35,7 @@ for dir in \ pkgtools/pkg_install \ pkgtools/pkgmanpages \ pkgtools/tnftp \ + sysutils/install-sh \ textproc/nbsed do echo "Copying $dir." |