From 7e7853f050b74c60d2b197645724eaaf797d1363 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Wed, 9 Apr 2025 21:28:47 -0400 Subject: [PATCH] Fix problems with pass. --- fleacollar.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/fleacollar.sh b/fleacollar.sh index 5ad3ee4..d7882d2 100755 --- a/fleacollar.sh +++ b/fleacollar.sh @@ -37,7 +37,6 @@ while getopts "${args}" i ; do esac done -# Functions help() { echo "fleacollar.sh" echo "Released under the terms of the WTFPL: http://wtfpl.net" @@ -50,6 +49,23 @@ help() { exit 0 } +initialize_pass() { + # Check if password store is initialized + if [ ! -f ~/.password-store/.gpg-id ]; then + # Get the GPG key ID that we already have in the script + keyName="$(gpg2 --list-secret-keys --keyid-format short | grep -B1 ^uid | head -n1 | rev | cut -c -8 | rev)" + + # If we have a key, initialize the password store + if [ -n "$keyName" ]; then + echo "Initializing password store with GPG key: $keyName" + pass init "$keyName" + else + msgbox "No GPG key found. Please run 'pass init your-gpg-id' manually after creating a GPG key." + exit 1 + fi + fi +} + check_dependancies() { local dep @@ -63,6 +79,9 @@ check_dependancies() read -p "No configuration for GPG was found. To have Fleacollar configure this for you press enter. If you would like to configure GPG manually, press control+c. " continue configure_gpg fi + + # Initialize the password store if needed + initialize_pass } inputbox() { @@ -255,6 +274,9 @@ add_email_address() fi esac + # Initialize pass before using it + initialize_pass + # Password storage with pass passOne=a passTwo=b