sane-private-unlock: fix perms

This commit is contained in:
2024-10-05 18:32:09 +00:00
parent 1e6123b32d
commit 6de31b7bc4

View File

@@ -1,6 +1,8 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash -p coreutils -p systemdMinimal
umask 027
if ! systemctl is-active private-storage.target > /dev/null; then
echo "unable to access encrypted data store."
echo "unlock it now or cancel with Ctrl+C."
@@ -10,7 +12,7 @@ while ! systemctl is-active private-storage.target > /dev/null; do
# see: <https://stackoverflow.com/a/2654096>
IFS= read -s -r -p "password: " line
echo
if [[ "$?" -eq 0 ]]; then
if [[ "$?" -eq 0 && -n "$line" ]]; then
echo -n "$line" > /run/gocryptfs/private.key
# give time for the store to be unlocked
timeout 3s systemctl start private-storage.target