Add secmount wrapper for securefs

This commit is contained in:
Talia 2023-04-03 15:48:46 +02:00
parent f06cbc94b1
commit a52f17606a
1 changed files with 20 additions and 0 deletions

20
bin/secmount Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
target=$(realpath "$1")
if ! [ -d "$target" ]
then
echo "Directory '$(basename "$target")' does not exist!"
exit 1
fi
back="$(dirname "$target")/.$(basename "$target")"
if ! [ -d "$back" ]
then
mkdir -p "$back"
passwd=$(zenity --password)
echo $passwd | secret-tool store --label "SecureFS $target" application securefs directory "$target"
echo $passwd | securefs c "$back"
else
passwd=$(secret-tool lookup application securefs directory "$target")
fi
exec echo $passwd | securefs mount "$back" "$target"