Script changes!

This commit is contained in:
Geoffrey Frogeye 2021-06-11 21:42:55 +02:00
parent 45e32adc61
commit 6b13214c4d
9 changed files with 69 additions and 7 deletions

29
config/scripts/cached_pass Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# 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 [ ! -f "${file}" ]
then
pass="$(pass ${name} | head -1)"
echo -n $pass > "${file}"
notify-send -u low "cached_pass" "Cached: ${name}"
fi
cat "${file}"