Added encription support

This commit is contained in:
Erik Foris 2021-01-06 20:18:36 +00:00
parent deebd51de5
commit 8d6e755be5

View File

@ -2,18 +2,36 @@
if [ "$1" = "-h" ]
then
echo "do-plication <option> [directory to back up]"
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"
echo "-c checks (lists) the contents of the n'th arcive {do-plication <option> <n>"
echo "-f Override the n'th arcive {do-plication <option> <n> [directory to back up]}"
echo "-l Load the n'th arcive {do-plication <option> <n> [directory to back up]}"
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"
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"
exit 0
fi
if [ "$2" = "-e" ]
then
ls "$4" > /dev/null
if [$? -gt 0]
then
echo "key not fount creating key"
stenc -g 256 -k "$5" -kd "$6";
stenc -f /dev/nst0 -e on -k "$5" -a 1 --ckod
else
echo "key fount using key"
stenc -f /dev/nst0 -e on -k "$5" -a 1 --ckod
fi
fi
# Going to the right directory
# cd /media
@ -23,26 +41,26 @@ case "$1" in
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 "$2"
sudo screen -dmS do-plication tar -cvf /dev/nst0 "$3"
true
;;
-c)
sudo mt -f /dev/nst0 asf "$2";
sudo mt -f /dev/nst0 asf "$3";
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"
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 "$2";
sudo screen -dmS do-plication tar xvf /dev/nst0 -C "$3"
sudo mt -f /dev/nst0 asf "$3";
sudo screen -dmS do-plication tar xvf /dev/nst0 -C "$4"
true
esac
exit $?