--- installpkg.orig 2007-12-28 16:38:00.000000000 +0000 +++ installpkg 2007-12-28 17:00:02.000000000 +0000 @@ -4,6 +4,9 @@ # Copyright 2007 Patrick Volkerding, Sebeka, MN, USA # All rights reserved. # +# Modifed by Stuart Winter to include some speedups for ARMedslack. +# +# # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # @@ -205,8 +208,8 @@ mkdir -p $TMP/scan$$ ( cd $TMP/scan$$ ; $TAR xzf - install ) < $1 2> /dev/null if [ -r $TMP/scan$$/install/doinst.sh ]; then - if cat $TMP/scan$$/install/doinst.sh | grep ' rm -rf ' 1>/dev/null 2>/dev/null ; then - cat $TMP/scan$$/install/doinst.sh | grep ' rm -rf ' > $TMP/scan$$/install/delete + if grep ' rm -rf ' $TMP/scan$$/install/doinst.sh 1>/dev/null 2>/dev/null ; then + grep ' rm -rf ' $TMP/scan$$/install/doinst.sh > $TMP/scan$$/install/delete echo "The following locations will be completely WIPED OUT to allow symbolic" echo "links to be made. (We're talking 'rm -rf') These locations may be files," echo "or entire directories. Be sure you've backed up anything at these" @@ -325,12 +328,12 @@ COMPRESSED="`expr $COMPRESSED / 1024` K" UNCOMPRESSED="`expr $UNCOMPRESSED / 1024` K" # MD5SUM=`md5sum $package | cut -f 1 -d ' '` - cat $DESCRIPTION | grep "^$packagebase:" | cut -f 2- -d : | cut -b2- 1> $TMP/tmpmsg$$ 2> /dev/null + grep "^$packagebase:" $DESCRIPTION | cut -f 2- -d : | cut -b2- 1> $TMP/tmpmsg$$ 2> /dev/null if [ "$shortname" != "$packagebase" ]; then - cat $DESCRIPTION | grep "^$shortname:" | cut -f 2- -d : | cut -b2- 1>> $TMP/tmpmsg$$ 2> /dev/null + grep "^$shortname:" $DESCRIPTION | cut -f 2- -d : | cut -b2- 1>> $TMP/tmpmsg$$ 2> /dev/null fi # Adjust the length here. This allows a slack-desc to be any size up to 13 lines instead of fixed at 11. - LENGTH=`cat $TMP/tmpmsg$$ | wc -l` + LENGTH=`wc -l < $TMP/tmpmsg$$` while [ $LENGTH -lt 12 ]; do echo >> $TMP/tmpmsg$$ LENGTH=`expr $LENGTH + 1` @@ -364,9 +367,9 @@ echo "Installing package $shortname ($PMSG)... " fi echo "PACKAGE DESCRIPTION:" - cat $DESCRIPTION | grep "^$packagebase:" | uniq + grep "^$packagebase:" $DESCRIPTION | uniq if [ "$shortname" != "$packagebase" ]; then - cat $DESCRIPTION | grep "^$shortname:" | uniq + grep "^$shortname:" $DESCRIPTION | uniq fi elif [ "$MODE" = "infobox" -a ! "$PRIORITY" = "SKP" ]; then # install non-SKP infobox package dialog --title "Installing package $shortname $PMSG" --infobox "`cat $TMP/tmpmsg$$`" 0 0 @@ -408,7 +411,7 @@ rm -f $TMP/tmplist$$ continue fi - cat $TMP/tmplist$$ | grep -v "/$" | while read file ; do + grep -v "/$" $TMP/tmplist$$ | while read file ; do if [ -L "$ROOT/$file" ]; then rm -f "$ROOT/$file" fi @@ -422,13 +425,13 @@ echo "PACKAGE LOCATION: $package" >> $ADM_DIR/packages/$shortname # echo "PACKAGE MD5SUM: $MD5SUM" >> $ADM_DIR/packages/$shortname echo "PACKAGE DESCRIPTION:" >> $ADM_DIR/packages/$shortname - cat $DESCRIPTION | grep "^$packagebase:" >> $ADM_DIR/packages/$shortname 2> /dev/null + grep "^$packagebase:" $DESCRIPTION >> $ADM_DIR/packages/$shortname 2> /dev/null if [ "$shortname" != "$packagebase" ]; then - cat $DESCRIPTION | grep "^$shortname:" >> $ADM_DIR/packages/$shortname 2> /dev/null + grep "^$shortname:" $DESCRIPTION >> $ADM_DIR/packages/$shortname 2> /dev/null fi echo "FILE LIST:" >> $ADM_DIR/packages/$shortname ( cd $ROOT/ ; $TAR -xzlUpvf - ) < $package >> $TMP/$shortname 2> /dev/null - if [ "`cat $TMP/$shortname | grep '^\./' | wc -l | tr -d ' '`" = "1" ]; then + if [ "`grep '^./' $TMP/$shortname | wc -l | tr -d ' '`" = "1" ]; then # Good. We have a package that meets the Slackware spec. cat $TMP/$shortname >> $ADM_DIR/packages/$shortname else @@ -446,7 +449,10 @@ if [ "$MODE" = "install" ]; then echo "Executing install script for $shortname..." fi - ( cd $ROOT/ ; sh install/doinst.sh -install; ) + # This tonne of sed is to avoid spawning subshells which is slow on ARM: + # the /proc/self stuff is because I couldn't work out how to specify '-install' as an argument + # when piping code into the shell. + ( cd $ROOT/ ; sed -e's?^( cd \([^;]*\);\(.*\) )$?pushd \1 \&\> /dev/null ; \2 ; popd \&\> /dev/null?g ' install/doinst.sh | sh /proc/self/fd/0 -install ; ) fi # Clean up the mess... if [ -d $ROOT/install ]; then