--- installpkg.orig 2004-05-30 01:20:34.000000000 +0100 +++ sbin/installpkg 2006-07-12 22:22:40.000000000 +0100 @@ -194,8 +194,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" @@ -314,12 +314,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` @@ -353,9 +353,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 @@ -397,7 +397,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 @@ -411,20 +411,20 @@ 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 # Some dumb bunny built a package with something other than makepkg. Bad! # Oh well. Bound to happen. Par for the course. Fix it and move on... echo './' >> $ADM_DIR/packages/$shortname - cat $TMP/$shortname | grep -v '^./$' | cut -b3- >> $ADM_DIR/packages/$shortname + grep -v '^./$' $TMP/$shortname | cut -b3- >> $ADM_DIR/packages/$shortname fi rm -f $TMP/$shortname @@ -435,7 +435,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