Retab secmount script

This commit is contained in:
Talia 2023-05-13 10:33:49 +02:00
parent 25e31beaff
commit 2d3c72d3d3
1 changed files with 14 additions and 12 deletions

View File

@ -5,23 +5,25 @@ title="SecMount"
target=$(realpath "$1") target=$(realpath "$1")
if ! [ -d "$target" ] if ! [ -d "$target" ]
then then
echo "Directory '$(basename "$target")' does not exist!" echo "Directory '$(basename "$target")' does not exist!"
exit 1 exit 1
fi fi
back="$(dirname "$target")/.$(basename "$target")" back="$(dirname "$target")/.$(basename "$target")"
if ! [ -d "$back" ] if ! [ -d "$back" ]
then then
mkdir -p "$back" mkdir -p "$back"
passwd=$(zenity --password --title $title) passwd=$(zenity --password --title $title)
if zenity --question --title $title --text "Save password in login keyring?" if zenity --question --title $title --text "Save password in login keyring?"
then echo -n $passwd | secret-tool store --label "SecureFS $target" application securefs directory "$target" then
fi echo 'echo -n $passwd | secret-tool store --label "SecureFS $target" application securefs directory "$target"'
echo -n $passwd | securefs c "$back" echo -n $passwd | secret-tool store --label "SecureFS $target" application securefs directory "$target"
fi
echo -n $passwd | securefs c "$back"
else else
passwd=$(secret-tool lookup application securefs directory "$target") passwd=$(secret-tool lookup application securefs directory "$target")
if [ -z "$passwd" ] if [ -z "$passwd" ]
then passwd=$(zenity --password --title $title) then passwd=$(zenity --password --title $title)
fi fi
fi fi
exec echo -n $passwd | securefs mount "$back" "$target" exec echo -n $passwd | securefs mount "$back" "$target"