Make password storing optional in SecMount

This commit is contained in:
Talia 2023-04-03 16:01:39 +02:00
parent a52f17606a
commit 82477517c3

View file

@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
title="SecMount"
target=$(realpath "$1") target=$(realpath "$1")
if ! [ -d "$target" ] if ! [ -d "$target" ]
then then
@ -10,11 +12,16 @@ back="$(dirname "$target")/.$(basename "$target")"
if ! [ -d "$back" ] if ! [ -d "$back" ]
then then
mkdir -p "$back" mkdir -p "$back"
passwd=$(zenity --password) passwd=$(zenity --password --title $title)
echo $passwd | secret-tool store --label "SecureFS $target" application securefs directory "$target" if zenity --question --title $title --text "Save password in login keyring?"
then echo $passwd | secret-tool store --label "SecureFS $target" application securefs directory "$target"
fi
echo $passwd | securefs c "$back" echo $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" ]
then passwd=$(zenity --password --title $title)
fi
fi fi
exec echo $passwd | securefs mount "$back" "$target" exec echo $passwd | securefs mount "$back" "$target"