Improve password-store installation script with RSA and GPG key checks

This commit is contained in:
2025-03-18 22:14:31 +00:00
parent 654b0368c7
commit b8fe413e2b

View File

@@ -141,17 +141,23 @@ else
fi fi
# Clone password-store # Clone password-store
if [ "$(whoami)" = "trude" ]; then if [ "$USER" = "trude" ]; then
if [ ! -d "$HOME/.password-store" ]; then if [ ! -f "$HOME/.ssh/id_rsa" ] || [ ! -f "$HOME/.ssh/id_rsa.pub" ]; then
printf "${YELLOW}Cloning password-store...${NC}\n" printf "${RED}RSA key not found. Please add your RSA key pair for password-store.${NC}\n"
git clone https://github.com/TrudeEH/password-store "$HOME/.password-store" elif ! gpg --list-keys "ehtrude@gmail.com" >/dev/null 2>&1; then
if [ $? -ne 0 ]; then printf "${RED}GPG key for ehtrude@gmail.com not found. Please import the key for password-store.${NC}\n"
printf "${RED}Error cloning password-store.${NC}\n"
else
printf "${GREEN}Password-store cloned successfully.${NC}\n"
fi
else else
printf "${CYAN}Password-store already present.${NC}\n" if [ ! -d "$HOME/.password-store" ]; then
printf "${YELLOW}Cloning password-store...${NC}\n"
git clone git@github.com:TrudeEH/password-store.git "$HOME/.password-store"
if [ $? -ne 0 ]; then
printf "${RED}Error cloning password-store.${NC}\n"
else
printf "${GREEN}Password-store cloned successfully.${NC}\n"
fi
else
printf "${CYAN}Password-store already present.${NC}\n"
fi
fi fi
fi fi