69 lines
1.7 KiB
Bash
Executable File
69 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ "$1" = "-h" ]
|
|
then
|
|
echo
|
|
echo
|
|
echo "do-plication <option> (<n>) [directory to back up]"
|
|
echo
|
|
echo "Options:"
|
|
echo
|
|
echo "-a append arcive to the back of the tape no n needed"
|
|
echo "-c checks (lists) the contents of the n'th arcive put - as argument for directory to back up "
|
|
echo "-f Override the n'th arcive"
|
|
echo "-l Load the n'th arcive"
|
|
echo
|
|
echo "-e enable encription {do-plication -e [path to key file] [ key file descriptoin(only if key not alreadey created)}"
|
|
echo
|
|
echo
|
|
echo
|
|
exit 0
|
|
fi
|
|
|
|
if [ "$1" = "-e" ]
|
|
then
|
|
sudo ls "$4" > /dev/null
|
|
if [ $? == 0 ]
|
|
then
|
|
echo "key fount using key"
|
|
sudo stenc -f /dev/nst0 -e on -k "$2" -a 1 --ckod
|
|
else
|
|
echo "key not fount creating key"
|
|
sudo stenc -g 256 -k "$2" -kd "$3";
|
|
sudo stenc -f /dev/nst0 -e on -k "$2" -a 1 --ckod
|
|
fi
|
|
exit 0
|
|
fi
|
|
|
|
# Going to the right directory
|
|
# cd /media
|
|
|
|
case "$1" in
|
|
# overwrite the tape from the begining
|
|
-a)
|
|
sudo mt -f /dev/nst0 eod;
|
|
sudo mt -f /dev/nst0 status;
|
|
echo "your arcive will be the file number"
|
|
sudo screen -dmS do-plication tar -cvf /dev/nst0 "$3"
|
|
true
|
|
;;
|
|
|
|
-c)
|
|
sudo mt -f /dev/nst0 asf "$2";
|
|
sudo tar tvf /dev/st0
|
|
true
|
|
;;
|
|
|
|
-f)
|
|
sudo mt -f /dev/nst0 asf "$2";
|
|
echo "your arcive wil be $2";
|
|
sudo screen -dmS do-plication tar -cvf /dev/nst0 "$3"
|
|
true
|
|
;;
|
|
|
|
-l)
|
|
sudo mt -f /dev/nst0 asf "$2";
|
|
sudo screen -dmS do-plication tar xvf /dev/nst0 -C "$3"
|
|
true
|
|
esac
|
|
exit $? |