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" ] if [ "$1" = "-h" ]
then 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
echo "Options:" echo "Options:"
echo echo
echo "-a append arcive to the back of the tape" 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 {do-plication <option> <n>" echo "-c checks (lists) the contents of the n'th arcive"
echo "-f Override the n'th arcive {do-plication <option> <n> [directory to back up]}" echo "-f Override the n'th arcive"
echo "-l Load the n'th arcive {do-plication <option> <n> [directory to back up]}" echo "-l Load the n'th arcive"
echo echo
echo
echo "Enable/Disable Encryprion"
echo "-e Encrypt "
echo "-n noEncrypt"
exit 0 exit 0
fi 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 # Going to the right directory
# cd /media # cd /media
@ -23,26 +41,26 @@ case "$1" in
sudo mt -f /dev/nst0 eod; sudo mt -f /dev/nst0 eod;
sudo mt -f /dev/nst0 status; sudo mt -f /dev/nst0 status;
echo "your arcive will be the file number" 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 true
;; ;;
-c) -c)
sudo mt -f /dev/nst0 asf "$2"; sudo mt -f /dev/nst0 asf "$3";
sudo tar tvf /dev/st0 sudo tar tvf /dev/st0
true true
;; ;;
-f) -f)
sudo mt -f /dev/nst0 asf "$2"; sudo mt -f /dev/nst0 asf "$3";
echo "your arcive wil be $2"; echo "your arcive wil be $3";
sudo screen -dmS do-plication tar -cvf /dev/nst0 "$3" sudo screen -dmS do-plication tar -cvf /dev/nst0 "$4"
true true
;; ;;
-l) -l)
sudo mt -f /dev/nst0 asf "$2"; sudo mt -f /dev/nst0 asf "$3";
sudo screen -dmS do-plication tar xvf /dev/nst0 -C "$3" sudo screen -dmS do-plication tar xvf /dev/nst0 -C "$4"
true true
esac esac
exit $? exit $?