merge the formfield patch from ooo-build
[ooovba.git] / setup_native / scripts / unpack_update.sh
blobd93bb2749c070ef66573cfad62414f1301156f86
1 #!/bin/sh
3 EXTENSION=`expr "//$1" : '.*\/.*\.\(t.*\)'`
4 [ -z $EXTENSION ] && ( echo "Unable to determine file type"; exit 2 )
6 BASEDIR=`dirname "$1"`
7 FOLDER=`basename "$1" ".$EXTENSION"`
8 NUM=1
10 DESTPATH="$BASEDIR/$FOLDER"
12 while [ -d "$DESTPATH" ]; do
13 NUM=`expr $NUM + 1`
14 DESTPATH="$BASEDIR/$FOLDER-$NUM"
15 done
17 mkdir "$DESTPATH"
18 cd "$DESTPATH"
20 if [ "$EXTENSION" = "tar.gz" -o "$EXTENSION" = "tgz" ]; then
21 if [ -x /usr/bin/gzcat ]; then
22 /usr/bin/gzcat "$1" | tar -xf -
23 else
24 tar -xzf "$1"
26 elif [ "$EXTENSION" = "tar.bz2" -o "$EXTENSION" = "tbz2" ]; then
27 /usr/bin/bzcat "$1" | tar -xf -
28 else
29 echo "Unsupported type of archive"
30 exit 2
33 UPDATE=`eval ls */update` && SUBFOLDER=`dirname $UPDATE` && mv $SUBFOLDER/* . && rmdir $SUBFOLDER && echo "$DESTPATH/update"