2023-05-04 10:57:36 +02:00
|
|
|
#!/bin/sh
|
|
|
|
clear
|
|
|
|
sudo modprobe fuse
|
2023-09-27 09:48:14 +02:00
|
|
|
rep="/home/$USER/"
|
2023-05-04 10:57:36 +02:00
|
|
|
rep1=$rep".encrypted"
|
|
|
|
rep2=$rep"decrypted"
|
2023-09-27 09:48:14 +02:00
|
|
|
file="/media/$USER/SECURE/passphrase.bin"
|
2023-05-04 10:57:36 +02:00
|
|
|
|
|
|
|
#Close Coffre fort numérique
|
|
|
|
if [ "$1" = "close" ] && [ ! -f "$rep2" ]
|
|
|
|
then
|
|
|
|
fusermount -u "$rep2"
|
|
|
|
echo "Closed"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
#Installation du coffre fort numérique
|
|
|
|
if [ "$1" = "install" ] && [ ! -f "$rep1" ]
|
|
|
|
then
|
|
|
|
mkdir "$rep1" "$rep2"
|
|
|
|
sudo apt install encfs
|
|
|
|
echo "Usage coffre open or close"
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
#Aide
|
|
|
|
if [ "$1" = "" ]
|
|
|
|
then
|
|
|
|
echo "Usage: $0 |open|close|install"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
#Open Coffre fort numérique
|
|
|
|
if [ "$1" = "open" ] && [ ! -f "$rep2" ]
|
|
|
|
then
|
|
|
|
|
|
|
|
echo "Trying to get the key from USB keychain ..."
|
|
|
|
|
|
|
|
if [ -f "$file" ]
|
|
|
|
then
|
|
|
|
base64 -w 0 "$file" | encfs -S $rep1 $rep2
|
|
|
|
else
|
|
|
|
echo "FAILED to find suitable USB keychain ..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
exit 0
|