| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- #!/bin/sh
- ##
- ## Shell-based package for OpenPKG BINARY bootstrap installation
- ## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
- ## Copyright (c) 2000-2002 The OpenPKG Project <http://www.openpkg.org/>
- ## Copyright (c) 2000-2002 Ralf S. Engelschall <rse@engelschall.com>
- ##
- ## Permission to use, copy, modify, and distribute this software for
- ## any purpose with or without fee is hereby granted, provided that
- ## the above copyright notice and this permission notice appear in all
- ## copies.
- ##
- ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
- ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- ## SUCH DAMAGE.
- ##
- # defaults
- f="$0"
- help=0
- verbose=0
- prefix='@l_prefix@'
- t='@TGZ@'
- susr='@SUSR@'
- sgrp='@SGRP@'
- musr='@MUSR@'
- mgrp='@MGRP@'
- rusr='@RUSR@'
- rgrp='@RGRP@'
- nusr='@NUSR@'
- ngrp='@NGRP@'
- # 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 ) help=1 ;;
- -v | --verbose ) verbose=1 ;;
- --prefix=* ) prefix=$arg ;;
- * ) help=1 ;;
- esac
- done
- if [ ".$prefix" = . ]; then
- help=1
- fi
- if [ ".$help" = .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
- cusr=`(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 $prefix..."
- # the reason of the following magic you certainly don't want to understand ;)
- set -- 1
- @PRE@
- d=''
- for c in `IFS=/; echo $prefix`; do
- d="$d/$c"
- if [ ! -d $d ]; then
- mkdir $d || exit 1
- chmod 755 $d || exit 1
- if [ ".$cusr" = .root ]; then
- chown $musr $d >/dev/null 2>&1 || true
- chgrp $mgrp $d >/dev/null 2>&1 || true
- fi
- fi
- done
- uudecode $f
- uncompress <$t |\
- (cd $prefix; tar x${v}f -)
- rm -f $t >/dev/null 2>&1
- if [ ".$cusr" = .root ]; then
- ( cd $prefix || exit 1
- chown -R -h $musr . >/dev/null 2>&1 || true
- chgrp -R -h $mgrp . >/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
|