SpectreOS-old/compress.sh

41 lines
773 B
Bash
Raw Permalink Normal View History

2018-02-26 02:41:29 +01: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
# säuberung
rm ${archiv}.tar
elif [ "restore" == "$1" ]; then
2018-07-08 23:31:48 +02:00
pfad=$3
[[ -z "${pfad}" ]] && pfad="."
2018-07-08 23:23:07 +02:00
2018-02-26 02:41:29 +01:00
pixz -d ${archiv} ${archiv/.pxz*}
2018-07-08 23:31:48 +02:00
tar -xf ${archiv/.pxz*} -C ${pfad}
2018-02-26 02:41:29 +01:00
# säuberung
rm ${archiv/.pxz*}
else
echo "tar.pxz compress-script"
echo "./compress.sh make/restore archivname input/output"
echo "./compress.sh make archivname daten"
2018-07-08 23:23:07 +02:00
echo "./compress.sh restore archivname ort"
2018-02-26 02:41:29 +01:00
echo "or use"
echo "tar -Ipixz -cf output.tpxz dir # Make tar use pixz automatically"
fi