Bläddra i källkod

try to fix symlink problem

Ralf S. Engelschall 24 år sedan
förälder
incheckning
e8161725c7
2 ändrade filer med 176 tillägg och 0 borttagningar
  1. 93 0
      openpkg/wrap1.sh
  2. 83 0
      openpkg/wrap2.sh

+ 93 - 0
openpkg/wrap1.sh

@@ -0,0 +1,93 @@
+#!/bin/sh
+##
+##  Shell-based package for OpenPKG source bootstrap procedure
+##  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=''
+u=''
+g=''
+d='@DIR@'
+t='@TGZ@'
+
+#   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 ;;
+        --user=*       ) u=$arg ;;
+        --group=*      ) g=$arg ;;
+        *              ) h=1    ;;
+    esac
+done
+if [ ".$p" = . ]; then
+    h=1
+fi
+if [ ".$h" = .1 ]; then
+    echo "Usage: sh $0 [-h|--help] [-v|--verbose] --prefix=<prefix> [--user=<user>] [--group=<group>]" 2>&1
+    exit 1
+fi
+
+#   establish standard environment
+LC_CTYPE=C
+export LC_CTYPE
+umask 022
+
+#   determine current user and group
+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`
+thisgroup=`(cat /etc/passwd; ypcat passwd) 2>/dev/null |\
+           grep "^${thisuser}:" | awk -F: '{ print $4; }'`
+thisgroup=`(cat /etc/group; ypcat group) 2>/dev/null |\
+           grep ":${thisgroup}:" | awk -F: '{ print $1; }'`
+if [ ".$thisgroup" = . ]; then
+    thisgroup="$thisuser"
+fi
+
+#   perform the extraction
+echo "$0: extracting to $d..."
+uudecode $f
+rm -rf $d >/dev/null 2>&1
+mkdir $d || exit 1
+uncompress <$t |\
+(cd $d; tar x${v}f - 2>/dev/null)
+if [ ".$thisuser" = .root ]; then
+    ( cd $d 
+      chown -R -h $thisuser  . >/dev/null 2>&1 || true
+      chgrp -R -h $thisgroup . >/dev/null 2>&1 || true
+    )
+fi
+echo "$0: extraction done."
+
+#   perform building
+echo "$0: building for $p..."
+cd $d || exit 1
+./openpkg.boot $p $u $g || exit 1
+echo "$0: build done."
+
+#   cleanup
+echo "$0: cleaning up..."
+cd ..
+rm -rf $d >/dev/null 2>&1
+rm -f $t >/dev/null 2>&1
+echo "$0: cleaned up."
+
+#   die explicitly just before the shell would discover
+#   that we carry mega-bytes of data with us...
+exit 0
+
+#   the distribution tarball

+ 83 - 0
openpkg/wrap2.sh

@@ -0,0 +1,83 @@
+#!/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