1.1 --- a/openpkg/aux.wrapsrc.sh Tue Jul 31 12:27:54 2012 +0200 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,156 +0,0 @@ 1.4 -#!/bin/sh 1.5 -## 1.6 -## OpenPKG Source Bootstrap Package (self-extracting shell script) 1.7 -## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/> 1.8 -## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/> 1.9 -## 1.10 -## Permission to use, copy, modify, and distribute this software for 1.11 -## any purpose with or without fee is hereby granted, provided that 1.12 -## the above copyright notice and this permission notice appear in all 1.13 -## copies. 1.14 -## 1.15 -## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 1.16 -## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1.17 -## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1.18 -## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 1.19 -## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.20 -## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.21 -## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1.22 -## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 1.23 -## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 1.24 -## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 1.25 -## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.26 -## SUCH DAMAGE. 1.27 -## 1.28 - 1.29 -# configuration 1.30 -l_me="$0" 1.31 -o_help=no 1.32 -o_version=no 1.33 -o_tar=no 1.34 -l_prefix='/openpkg' 1.35 -l_dir='@l_dir@' 1.36 -l_release="@l_release@" 1.37 -l_version="@l_version@" 1.38 - 1.39 -# establish standard environment 1.40 -PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin" 1.41 -LC_CTYPE=C 1.42 -export LC_CTYPE 1.43 -umask 022 1.44 - 1.45 -# pre-parse command line options 1.46 -for opt 1.47 -do 1.48 - case $opt in 1.49 - -*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;; 1.50 - *) arg='' ;; 1.51 - esac 1.52 - case $opt in 1.53 - -h | --help ) o_help=yes ;; 1.54 - -v | --version ) o_version=yes ;; 1.55 - -t | --tar ) o_tar=yes ;; 1.56 - --prefix=* ) l_prefix=$arg ;; 1.57 - esac 1.58 -done 1.59 -if [ ".$o_help" = .yes ]; then 1.60 - echo "Usage: sh $l_me" 2>&1 1.61 - echo " [--prefix=<prefix>] [--tag=<str>]" 2>&1 1.62 - echo " [--user=<usr>] [--group=<grp>]" 2>&1 1.63 - echo " [--{s,m,r,n}usr=<usr>] [--{s,m,r,n}grp=<grp>]" 2>&1 1.64 - echo " [--{s,m,r,n}uid=<uid>] [--{s,m,r,n}gid=<gid>]" 2>&1 1.65 - echo " [--use_tar=<tar>] [--use_make=<make>] [--use_cc=<cc>]" 2>&1 1.66 - echo " [--use_ar=<ar>] [--use_ld=<ld>] [--use_as=<as>] [--use_strip=<strip>]" 2>&1 1.67 - echo " [-t|--tar] [-h|--help] [-v|--version]" 2>&1 1.68 - exit 1 1.69 -fi 1.70 - 1.71 -# make sure all essential unpacking tools are available 1.72 -# (the build tools are checked later from within openpkg.spec) 1.73 -for tool in /bin/sh mkdir cat tar rm chown chgrp sed dd; do 1.74 - found=no 1.75 - case $tool in 1.76 - /* ) 1.77 - if [ -f $tool ]; then 1.78 - found=yes 1.79 - fi 1.80 - ;; 1.81 - * ) 1.82 - for p in `IFS=:; echo $PATH`; do 1.83 - if [ -f "$p/$tool" ]; then 1.84 - found=yes 1.85 - break 1.86 - fi 1.87 - done 1.88 - ;; 1.89 - esac 1.90 - if [ ".$found" = .no ]; then 1.91 - echo "$l_me:ERROR: unable to find bootstrap tool \"$tool\"" 1>&2 1.92 - exit 1 1.93 - fi 1.94 -done 1.95 - 1.96 -# optionally extract the embedded tarball only 1.97 -if [ ".$o_tar" = .yes ]; then 1.98 - dd if=$l_me bs=8192 skip=8 2>/dev/null 1.99 - exit 0 1.100 -fi 1.101 - 1.102 -# display version and copyright header 1.103 -echo "OpenPKG ${l_release} Source Bootstrap Package, version ${l_version}" 1.104 -if [ ".$o_version" = .yes ]; then 1.105 - exit 0 1.106 -fi 1.107 -echo "Building for prefix ${l_prefix} on current platform" 1.108 - 1.109 -# determine current user/group 1.110 -cusr=`(id -un) 2>/dev/null ||\ 1.111 - (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\ 1.112 - (whoami) 2>/dev/null ||\ 1.113 - (who am i | cut "-d " -f1) 2>/dev/null ||\ 1.114 - echo $LOGNAME` 1.115 -cgid=`(id -g $cusr) 2>/dev/null ||\ 1.116 - ((getent passwd "${cusr}"; grep "^${cusr}:" /etc/passwd; ypmatch "${cusr}" passwd; nismatch "${cusr}" passwd; nidump passwd . | grep "^${cusr}:") 2>/dev/null |\ 1.117 - sed -e 'q' | awk -F: '{ print $4; }')` 1.118 -cgrp=`(id -gn $cusr) 2>/dev/null ||\ 1.119 - ((getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null | grep "^[^:]*:[^:]*:${cgid}:" |\ 1.120 - sed -e 'q' | awk -F: '{ print $1; }')` 1.121 -if [ ".$cgrp" = . ]; then 1.122 - cgrp="$cusr" 1.123 -fi 1.124 - 1.125 -# extract the source distribution files 1.126 -echo "++ extracting OpenPKG source distribution" 1.127 -rm -rf $l_dir >/dev/null 2>&1 1.128 -mkdir $l_dir || exit 1 1.129 -dd if=$l_me bs=8192 skip=8 2>/dev/null | (cd $l_dir; tar xf - 2>/dev/null) 1.130 -if [ ".$cusr" = .root ]; then 1.131 - ( cd $l_dir || exit 1 1.132 - chown -R -h $cusr . >/dev/null 2>&1 || true 1.133 - chgrp -R -h $cgrp . >/dev/null 2>&1 || true 1.134 - ) || exit 1 1.135 -fi 1.136 -if [ ! -f $l_dir/openpkg.boot ]; then 1.137 - echo "$l_me:ERROR: failed to unpack into directory \"$l_dir\"" 1>&2 1.138 - exit 1 1.139 -fi 1.140 - 1.141 -# perform bootstrap procedure 1.142 -echo "++ building OpenPKG binary distribution" 1.143 -( cd $l_dir || exit 1 1.144 - ./openpkg.boot ${1+"$@"} || exit 1 1.145 -) || exit 1 1.146 - 1.147 -# cleanup 1.148 -rm -rf $l_dir >/dev/null 2>&1 1.149 - 1.150 -# die explicitly just before the shell would discover 1.151 -# that we carry mega-bytes of data with us... 1.152 -exit 0 1.153 - 1.154 -# the distribution tarball is appended in raw format directly to the 1.155 -# end of this script, just leaded by padding whitespaces which make 1.156 -# sure that the tarball data starts at the pre-defined offset of 64KB. 1.157 -# This allows us to unpack the tarball by just skipping the leading 1.158 -# 64KB (= 8192*8, see above). 1.159 -