Understand the concept is not to automate everything. but I did find the constant checking for .tar.gz vs. .tar.bz2 annoying. So I came up with this.
Place it in /home/lfs during Chapter 5 and/or in $LFS/root for use during chapter 6. Invoke as: . ~/prep package-archive Don't forget the dot first (otherwise, the cd command doesn't stick - you'll find yourself doing a "huh what?" because you aren't in the directory you expect). Also, if you mess up the package-archive name, such as forgetting the extension, you can find the exit dropping you out of the shell. Finally, sure you can automate more & more . but you risk breaking things, missing errors, etc. Enjoy! if [ -z "$1" ]; then echo "" echo "Usage:" echo "" echo " prep package-archive" echo "" exit 1 fi if [ -f $1 ]; then echo "Processing $1" if [ "${1##*.}" = "gz" ] then tar xfvz $1 dir=`basename $1 .tar.gz` if [ -d $dir ]; then cd $dir else echo "...oops, $dir doesn't seem to exist..." fi elif [ "${1##*.}" = "bz2" ] then tar xfvj $1 dir=`basename $1 .tar.bz2` if [ -d $dir ]; then cd $dir else echo "...oops, $dir doesn't seem to exist..." fi else echo "...oops, $1 doesn't look like an archive..." fi echo "Ready!" else echo "Error: $1 not found" exit 1 fi
-- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page