2023-04-03 13:48:46 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-04-03 14:01:39 +00:00
|
|
|
title="SecMount"
|
|
|
|
|
2023-04-03 13:48:46 +00:00
|
|
|
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"
|
2023-04-03 14:01:39 +00:00
|
|
|
passwd=$(zenity --password --title $title)
|
|
|
|
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
|
2023-04-03 13:48:46 +00:00
|
|
|
echo $passwd | securefs c "$back"
|
|
|
|
else
|
|
|
|
passwd=$(secret-tool lookup application securefs directory "$target")
|
2023-04-03 14:01:39 +00:00
|
|
|
if [ -z "$passwd" ]
|
|
|
|
then passwd=$(zenity --password --title $title)
|
|
|
|
fi
|
2023-04-03 13:48:46 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
exec echo $passwd | securefs mount "$back" "$target"
|