3 EXTENSION
=`expr "//$1" : '.*\/.*\.\(t.*\)'`
4 [ -z $EXTENSION ] && ( echo "Unable to determine file type"; exit 2 )
7 FOLDER
=`basename "$1" ".$EXTENSION"`
10 DESTPATH
="$BASEDIR/$FOLDER"
12 while [ -d "$DESTPATH" ]; do
14 DESTPATH
="$BASEDIR/$FOLDER-$NUM"
20 if [ "$EXTENSION" = "tar.gz" -o "$EXTENSION" = "tgz" ]; then
21 if [ -x /usr
/bin
/gzcat
]; then
22 /usr
/bin
/gzcat
"$1" |
tar -xf -
26 elif [ "$EXTENSION" = "tar.bz2" -o "$EXTENSION" = "tbz2" ]; then
27 /usr
/bin
/bzcat
"$1" |
tar -xf -
29 echo "Unsupported type of archive"
33 UPDATE
=`eval ls */update` && SUBFOLDER
=`dirname $UPDATE` && mv $SUBFOLDER/* .
&& rmdir $SUBFOLDER && echo "$DESTPATH/update"