From f53b73f4eabc6f44642945e624ef5e5e05897ee4 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Sun, 26 Mar 2006 16:46:37 +0000 Subject: [PATCH] *** empty log message *** --- commands/scripts/packman.sh | 63 ++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/commands/scripts/packman.sh b/commands/scripts/packman.sh index 07f716ce0..0e8266957 100644 --- a/commands/scripts/packman.sh +++ b/commands/scripts/packman.sh @@ -21,6 +21,8 @@ else echo "Please run $0 as root." exit 1 fi +chmod 700 $TMPDIR + if [ -f "$RC" ] then . "$RC" fi @@ -47,7 +49,14 @@ if [ "$cdpackages" = "" ] then echo "Skipping CD packages." fi -TMPF=/tmp/list.$$ +TMPF=$TMPDIR/.list.$$ +rm -f $TMPF +rm -f $TMPDIR/.* # Remove any remaining .postinstall script or .list* + +# For local testing +#cdpackages=/usr/bigports/Packages/List +#CDPACK=/usr/bigports/Packages +#CDSRC=/usr/bigports/Sources netpackages="" if $TMPF awk -F'|' <$TMPF '{ printf "%3s %-6s %-15s %s\n", $1, $2, $3, $4 }' | more echo -n "Package to install? [RETURN for none] " read packno - if [ -n "$packno" ] - then source="`grep "^$packno|" $TMPF | awk -F'|' '{ print $2 }'`" - packagename="`grep "^$packno|" $TMPF | awk -F'|' '{ print $3 }'`" + ok=y + pat="^$packno|" + if [ "`grep $pat $TMPF | wc -l | awk '{ print $1 }'`" -ne 1 ] + then if [ "$packno" ] + then echo "Wrong package number." + fi + ok=n + fi + if [ $ok = y ] + then source="`grep $pat $TMPF | awk -F'|' '{ print $2 }'`" + packagename="`grep $pat $TMPF | awk -F'|' '{ print $3 }'`" file=$packagename.tar.bz2 - echo -n "Get source of $packagename? (y/N) " - read src case $source in - net*) echo "Retrieving binary from primary location into $TMPDIR .." + net*) echo -n "Get source of $packagename? (y/N) " + read src + echo "Retrieving binary from primary location into $TMPDIR .." srcurl="" if urlget $URL1/$file >$file - then echo "Installing .." + then echo "Retrieved ok. Installing .." packit $file && echo Installed ok. srcurl=$SRCURL1/$file else echo "Retrying from Beta binary location.." if urlget $URL2/$file >$file - then echo "Installing .." + then echo "Retrieved ok. Installing .." packit $file && echo Installed ok. srcurl=$SRCURL2/$file else echo "Retrieval failed." @@ -131,18 +148,28 @@ do cd $TMPDIR fi ;; cdrom*) - if -f [ $CDPACK/$file ] - then packit $CDPACK/$file + if [ -f $CDPACK/$file ] + then echo "Installing from $CDPACK/$file .." + packit $CDPACK/$file + else echo "$CDPACK/$file not found." fi - if [ "$src" = y -o "$src" = Y ] - then ( cd $SRC || exit - srcfile=$CDSRC/${packagename}-src.tar.bz2 - smallbunzip2 -dc $srcfile | tar xf - || exit - echo "Source $srcfile unpacked in $SRC." - ) + srcfile=$CDSRC/${packagename}-src.tar.bz2 + if [ -f $srcfile ] + then + echo -n "Get source of $packagename? (y/N) " + read src + if [ "$src" = y -o "$src" = Y ] + then ( cd $SRC || exit + smallbunzip2 -dc $srcfile | tar xf - || exit + echo "Source $srcfile unpacked in $SRC." + ) + fi + else echo "No source on CD for $packagename." fi ;; esac else cont=n fi done + +rm -f $TMPDIR/.* # Remove any remaining .postinstall script or .list* -- 2.44.0