Move scripts dir inside hm

And remove weird path contraptions
This commit is contained in:
Geoffrey Frogeye 2023-11-30 22:09:44 +01:00
parent 050901da2f
commit edeef96133
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
49 changed files with 2 additions and 11 deletions

30
hm/scripts/cached_pass Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash
#! nix-shell -p bash pass libnotify
# TODO Password changed?
set -euo pipefail
if [[ $# -ne 1 ]]
then
echo "Usage: $0 pass-name"
exit 2
fi
name="$1"
BASEDIR="/tmp/cached_pass_${UID}"
mkdir -p "$BASEDIR"
chmod 700 "$BASEDIR"
name_base64="$(echo "$name" | base64)"
file="${BASEDIR}/${name_base64}"
if [ ! -s "${file}" ]
then
notify-send -u low "cached_pass" "Asking to cache: ${name}"
pass ${name} > "${file}"
fi
cat "${file}"