Move scripts dir inside hm
And remove weird path contraptions
This commit is contained in:
parent
050901da2f
commit
edeef96133
49 changed files with 2 additions and 11 deletions
30
hm/scripts/cached_pass
Executable file
30
hm/scripts/cached_pass
Executable 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}"
|
Loading…
Add table
Add a link
Reference in a new issue