identity.sh: added script

This commit is contained in:
dogeystamp 2023-03-05 13:14:04 -05:00
parent 52459f36a5
commit 5045970d3b
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38

26
src/.local/bin/identity.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
# Sets up environment variables for things I don't want to expose in my dotfiles
if [ -z "$XDG_CONFIG_HOME" ]; then
XDG_CONFIG_HOME="$HOME"/.config
fi
IDFILE="$XDG_CONFIG_HOME"/identity
cat << "EOF" > "$IDFILE"
#!/bin/sh
# Environment variables for personal information
EOF
fields=$(mktemp)
cat << "EOF" > "$fields"
export ID_REALNAME=
export ID_EMAIL=
EOF
keepassxc-cli show "$KEEPASSDB" meta/identity -a realname -a email | paste -d '' "$fields" - >> "$IDFILE"
rm "$fields"
cat << "EOF" >> "$IDFILE"
export ID_EMAIL_USER=$(basename "$ID_EMAIL" @gmail.com)
EOF