From 91160b721efb5515d5074239d01e1c166a77e19f Mon Sep 17 00:00:00 2001 From: mollusk Date: Tue, 30 Jan 2018 21:11:07 -0700 Subject: [PATCH] Add: Main file --- gkmanager.sh | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100755 gkmanager.sh diff --git a/gkmanager.sh b/gkmanager.sh new file mode 100755 index 0000000..2ca5276 --- /dev/null +++ b/gkmanager.sh @@ -0,0 +1,94 @@ +#!/bin/bash +# Colors +RED='\033[0;31m' +LRED="\033[1;31m" +BLUE="\033[0;34m" +LBLUE="\033[1;34m" +GREEN="\033[0;32m" +LGREEN="\033[1;32m" +YELLOW="\033[1;33m" +CYAN="\033[0;36m" +LCYAN="\033[1;36m" +PURPLE="\033[0;35m" +LPURPLE="\033[1;35m" +BWHITE="\e[1m" +NC='\033[0m' # No Color + +passwordRepo="http://gitbutter.pw/mollusk/vault.git" + +function installGit(){ + + if [ ! -f /usr/bin/git ];then + sudo apt update && sudo apt install -y git + fi +} + +function gitSetup(){ + +printf "${LCYAN} ===============${NC}\n" +printf "${LCYAN}| Git Config |${NC}\n" +printf "${LCYAN} ===============${NC}\n" + +printf "\n\n${YELLOW}The following information will be displayed when you \n commit changes to you repository...${NC}\n\n" +printf "${LGREEN}E-mail Address (required): ${NC}" +read email +printf "${LGREEN}Desired Username (required): ${NC}" +read name + +printf "\n${YELLOW}Review and confirm your details${NC}\n\n" + +printf "${LGREEN}Email Address: ${email}${NC}\n" +printf "${LGREEN}Username: ${name}${NC}\n\n" + +printf "${YELLOW}Are these settings correct? (y/n): ${NC}" +read confirm + +if [ "${confirm}" = "n" ];then + echo + echo "Setup Cancelled!" + exit 0; +elif [ "${confirm}" = "y" ];then + git config --global user.email ${email} + git config --global user.name ${name} + echo + echo "Saved git config" + exit 0; +fi +} + +function gitButterSync(){ + domain="https://gitbutter.pw" + defaultRepoDir="/home/${USER}/keepass/" + + + printf "${YELLOW} Your keepass database is stored on: ${domain}.\n" + printf "If this is the first time running this script\n" + printf "you need to clone the repository which contains your password database${NC}\n\n" + + printf "${YELLOW}The following questions are asked so the script knows where to find your repository on gitbutter\n" + printf "As an example, the full URL would look similar to this:${NC}\n\n" + + + printf "${LPURPLE}${domain}/username/repository${NC}\n\n" + + + printf "${YELLOW}The script simply puts the Username and Repository name into the URL.${NC}\n\n" + printf "${LBLUE}Please enter your ${domain} Username: ${NC}" + read gbusername + printf "${LBLUE}Please enter the name of your repository: ${NC}" + read gbrepo + + printf "${LPURPLE}INFO: You can leave this question blank to use the default location${NC}\n" + printf "${LBLUE}Where do you want to save your repository?(default: ${defaultRepoDir}) " + + printf "\n\n${LPURPLE}INFO: Cloning your repository...${NC}\n" +} + + +function main(){ + installGit + #gitSetup + gitButterSync +} + +main \ No newline at end of file