Fix problems with pass.
This commit is contained in:
parent
4183969b68
commit
7e7853f050
@ -37,7 +37,6 @@ while getopts "${args}" i ; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Functions
|
|
||||||
help() {
|
help() {
|
||||||
echo "fleacollar.sh"
|
echo "fleacollar.sh"
|
||||||
echo "Released under the terms of the WTFPL: http://wtfpl.net"
|
echo "Released under the terms of the WTFPL: http://wtfpl.net"
|
||||||
@ -50,6 +49,23 @@ help() {
|
|||||||
exit 0
|
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()
|
check_dependancies()
|
||||||
{
|
{
|
||||||
local dep
|
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
|
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
|
configure_gpg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Initialize the password store if needed
|
||||||
|
initialize_pass
|
||||||
}
|
}
|
||||||
|
|
||||||
inputbox() {
|
inputbox() {
|
||||||
@ -255,6 +274,9 @@ add_email_address()
|
|||||||
fi
|
fi
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Initialize pass before using it
|
||||||
|
initialize_pass
|
||||||
|
|
||||||
# Password storage with pass
|
# Password storage with pass
|
||||||
passOne=a
|
passOne=a
|
||||||
passTwo=b
|
passTwo=b
|
||||||
|
Loading…
x
Reference in New Issue
Block a user