sfs-duplication-glitches/do-plication

69 lines
1.7 KiB
Plaintext
Raw Normal View History

2021-01-05 23:41:51 +01:00
#!/bin/bash
2021-01-06 00:37:09 +01:00
if [ "$1" = "-h" ]
2021-01-05 23:41:51 +01:00
then
echo
echo
2021-01-06 22:33:00 +01:00
echo "do-plication <option> (<n>) [directory to back up]"
2021-01-05 23:41:51 +01:00
echo
echo "Options:"
echo
2021-01-06 22:33:00 +01:00
echo "-a append arcive to the back of the tape no n needed"
2021-01-06 21:41:54 +01:00
echo "-c checks (lists) the contents of the n'th arcive put - as argument for directory to back up "
2021-01-06 21:18:36 +01:00
echo "-f Override the n'th arcive"
echo "-l Load the n'th arcive"
2021-01-05 23:41:51 +01:00
echo
2021-01-06 22:33:00 +01:00
echo "-e enable encription {do-plication -e [path to key file] [ key file descriptoin(only if key not alreadey created)}"
2021-01-06 21:18:36 +01:00
echo
echo
echo
2021-01-05 23:41:51 +01:00
exit 0
2021-01-06 00:35:07 +01:00
fi
2021-01-05 23:41:51 +01:00
2021-01-06 22:33:00 +01:00
if [ "$1" = "-e" ]
2021-01-06 21:18:36 +01:00
then
2021-01-06 22:50:39 +01:00
sudo ls "$2" > /dev/null
2021-01-06 21:44:07 +01:00
if [ $? == 0 ]
2021-01-06 21:18:36 +01:00
then
2021-01-06 21:36:47 +01:00
echo "key fount using key"
2021-01-06 22:33:00 +01:00
sudo stenc -f /dev/nst0 -e on -k "$2" -a 1 --ckod
2021-01-06 21:18:36 +01:00
else
2021-01-06 21:36:47 +01:00
echo "key not fount creating key"
2021-01-06 22:33:00 +01:00
sudo stenc -g 256 -k "$2" -kd "$3";
sudo stenc -f /dev/nst0 -e on -k "$2" -a 1 --ckod
2021-01-06 21:18:36 +01:00
fi
2021-01-06 22:33:00 +01:00
exit 0
2021-01-06 21:18:36 +01:00
fi
2021-01-06 22:33:00 +01:00
2021-01-05 23:41:51 +01:00
# Going to the right directory
# cd /media
case "$1" in
# overwrite the tape from the begining
-a)
2021-01-06 00:35:07 +01:00
sudo mt -f /dev/nst0 eod;
2021-01-06 00:10:56 +01:00
sudo mt -f /dev/nst0 status;
2021-01-06 00:35:07 +01:00
echo "your arcive will be the file number"
2021-01-06 21:18:36 +01:00
sudo screen -dmS do-plication tar -cvf /dev/nst0 "$3"
2021-01-05 23:41:51 +01:00
true
;;
-c)
2021-01-06 22:33:00 +01:00
sudo mt -f /dev/nst0 asf "$2";
2021-01-05 23:41:51 +01:00
sudo tar tvf /dev/st0
true
;;
-f)
2021-01-06 22:33:00 +01:00
sudo mt -f /dev/nst0 asf "$2";
echo "your arcive wil be $2";
sudo screen -dmS do-plication tar -cvf /dev/nst0 "$3"
2021-01-05 23:41:51 +01:00
true
;;
-l)
2021-01-06 22:33:00 +01:00
sudo mt -f /dev/nst0 asf "$2";
sudo screen -dmS do-plication tar xvf /dev/nst0 -C "$3"
2021-01-05 23:41:51 +01:00
true
esac
exit $?