blob: a5c88524421e8313d8d34046dafb1f2eb223e636 (
plain) (
tree)
|
|
unpack_tar_gz() {
local dir
echo
echo -n "# Unpacking given tar file $1, using extra options $2 ..."
# Check whether the given directory (via -C) exists; if not mkdir it:
if [ "${2:0:2}" == "-C" ]; then
dir="${2:3}"
if [ "${dir:0:1}" != '/' ]; then
echo -n " (Warning: Path $dir has no preceding slash - not an absolute path!) "
fi
[ ! -d "$dir" ] && mkdir -p "$dir" # well, mkdir it.
fi
tar xzf "$1" $2
ERR=$?
if [ "$ERR" -ne 0 ]; then
echo
echo "# Could not unpack tar file $1!"
# Fehlerbehandlung?
else
echo "ok."
fi
}
|