| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #!/bin/sh
- ##
- ## Shell-based package for OpenPKG binary bootstrap installation
- ## Copyright (c) 2000-2001 Cable & Wireless Deutschland GmbH
- ## Copyright (c) 2000-2001 Ralf S. Engelschall <rse@engelschall.com>
- ##
- # defaults
- f="$0"
- h=0
- v=''
- p='@l_prefix@'
- t='@TGZ@'
- fsusr='@FSUSR@'
- fsgrp='@FSGRP@'
- # parse command line options
- for opt
- do
- case $opt in
- -*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;;
- *) arg='' ;;
- esac
- case $opt in
- -h | --help ) h=1 ;;
- -v | --verbose ) v=v ;;
- --prefix=* ) p=$arg ;;
- * ) h=1 ;;
- esac
- done
- if [ ".$h" = .1 ]; then
- echo "Usage: sh $0 [-h|--help] [-v|--verbose] [--prefix=<prefix>]" 2>&1
- exit 1
- fi
- # establish standard environment
- LC_CTYPE=C
- export LC_CTYPE
- umask 022
- # determine current username
- thisuser=`(id -un) 2>/dev/null ||\
- (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
- (whoami) 2>/dev/null ||\
- (who am i | cut "-d " -f1) 2>/dev/null ||\
- echo $LOGNAME`
- # perform the installation
- echo "$0: installing into $p..."
- # the reason of the following magic you certainly don't want to understand ;)
- set -- 1
- @PRE@
- d=''
- for c in `IFS=/; echo $p`; do
- d="$d/$c"
- if [ ! -d $d ]; then
- mkdir $d || exit 1
- chmod 755 $d || exit 1
- if [ ".$thisuser" = .root ]; then
- chown $fsusr $d >/dev/null 2>&1 || true
- chgrp $fsgrp $d >/dev/null 2>&1 || true
- fi
- fi
- done
- uudecode $f
- uncompress <$t |\
- (cd $p; tar x${v}f -)
- rm -f $t >/dev/null 2>&1
- if [ ".$thisuser" = .root ]; then
- ( cd $p || exit 1
- chown -R -h $fsusr . >/dev/null 2>&1 || true
- chgrp -R -h $fsgrp . >/dev/null 2>&1 || true
- )
- fi
- echo "$0: installation done."
- # die explicitly just before the shell would discover
- # that we carry mega-bytes of data with us...
- exit 0
- # the distribution tarball
|