70 lines
1.8 KiB
Bash
Executable File
70 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ "$1" = "-h" ]
|
|
then
|
|
echo
|
|
echo
|
|
echo "do-plication <option> <enable/disable Encryprion> <n> [directory to back up] [path to key file] [ key file descriptoin(only if key not alreadey created) ]"
|
|
echo
|
|
echo "Options:"
|
|
echo
|
|
echo "-a append arcive to the back of the tape put 0 as n"
|
|
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
|
|
echo "Enable/Disable Encryprion"
|
|
echo "-e Encrypt "
|
|
echo "-n noEncrypt"
|
|
echo
|
|
echo
|
|
exit 0
|
|
fi
|
|
|
|
if [ "$2" = "-e" ]
|
|
then
|
|
sudo ls "$4" > /dev/null
|
|
if [ $? -gt 0 ]
|
|
then
|
|
echo "key fount using key"
|
|
sudo stenc -f /dev/nst0 -e on -k "$5" -a 1 --ckod
|
|
else
|
|
echo "key not fount creating key"
|
|
sudo stenc -g 256 -k "$5" -kd "$6";
|
|
sudo stenc -f /dev/nst0 -e on -k "$5" -a 1 --ckod
|
|
fi
|
|
|
|
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 "$3";
|
|
sudo tar tvf /dev/st0
|
|
true
|
|
;;
|
|
|
|
-f)
|
|
sudo mt -f /dev/nst0 asf "$3";
|
|
echo "your arcive wil be $3";
|
|
sudo screen -dmS do-plication tar -cvf /dev/nst0 "$4"
|
|
true
|
|
;;
|
|
|
|
-l)
|
|
sudo mt -f /dev/nst0 asf "$3";
|
|
sudo screen -dmS do-plication tar xvf /dev/nst0 -C "$4"
|
|
true
|
|
esac
|
|
exit $? |