2017-10-03 21:40:13 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
archiv=$2
|
|
|
|
|
|
|
|
if [ "make" == "$1" ]; then
|
|
|
|
while (( "$(expr $# - 2)" ))
|
|
|
|
do
|
|
|
|
|
|
|
|
dateien="$3 ${dateien}"
|
|
|
|
|
|
|
|
shift
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
tar -cf ${archiv}.tar ${dateien}
|
|
|
|
pixz ${archiv}.tar ${archiv}.tar.pxz
|
2017-10-03 21:57:48 +02:00
|
|
|
|
|
|
|
# säuberung
|
|
|
|
rm ${archiv}.tar
|
2017-10-03 21:40:13 +02:00
|
|
|
elif [ "restore" == "$1" ]; then
|
2017-10-03 21:57:48 +02:00
|
|
|
|
2017-10-03 21:40:13 +02:00
|
|
|
pixz -d ${archiv} ${archiv/.pxz*}
|
|
|
|
|
|
|
|
tar -xf ${archiv/.pxz*}
|
2017-10-03 21:57:48 +02:00
|
|
|
|
|
|
|
# säuberung
|
|
|
|
rm ${archiv/.pxz*}
|
2017-10-03 21:40:13 +02:00
|
|
|
else
|
2017-10-03 21:57:48 +02:00
|
|
|
echo "tar.pxz compress-script"
|
2017-10-03 21:44:32 +02:00
|
|
|
echo "./compress.sh make/restore archivname input/output"
|
2017-10-03 21:57:48 +02:00
|
|
|
echo "./compress.sh make archivname daten"
|
|
|
|
echo "./compress.sh restore archivname"
|
2017-10-03 22:07:19 +02:00
|
|
|
echo "or use"
|
|
|
|
echo "tar -Ipixz -cf output.tpxz dir # Make tar use pixz automatically"
|
2017-10-03 21:40:13 +02:00
|
|
|
fi
|