chore(bootstrap): update cleanup script btw

Signed-off-by: Andrei Jiroh Eugenio Halili <andreijiroh@madebythepins.tk>
This commit is contained in:
Andrei Jiroh Eugenio Halili 2021-06-21 15:51:59 +08:00 committed by GitHub
parent 42ded61bbb
commit bb636bbc94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -69,15 +69,17 @@ installDeps() {
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
elif [[ $UPDATE_SYSTEM_PYTHON_INSTALL != "" ]]; then elif [[ $UPDATE_SYSTEM_PYTHON_INSTALL != "" ]]; then
echoStageName "Updating Python install" echoStageName "Updating Python install"
sudo apt install python3 python3-pip sudo apt install python3 python3-pip --yes
fi fi
fi fi
} }
cloneRepo() { cloneRepo() {
if [ ! -d "$HOME/.dotfiles" ]; then if [ ! -d "$HOME/.dotfiles" ]; then
echoStageName "Cloning the dotfiles repo"
git clone https://github.com/AndreiJirohHaliliDev2006/dotfiles.git $HOME/.dotfiles git clone https://github.com/AndreiJirohHaliliDev2006/dotfiles.git $HOME/.dotfiles
else else
echoStageName "Dotfiles repo found, pulling remote changes instead"
git -C "$HOME/.dotfiles" fetch --all git -C "$HOME/.dotfiles" fetch --all
git -C "$HOME/.dotfiles" pull origin git -C "$HOME/.dotfiles" pull origin
fi fi
@ -91,20 +93,22 @@ cloneRepo() {
error "Missing GitLab SaaS PAT! Check your Bitwarden vault for that key." && exit 1 error "Missing GitLab SaaS PAT! Check your Bitwarden vault for that key." && exit 1
fi fi
if [ ! -d "$HOME/.dotfiles/secrets" ]; then if [ ! -d "$HOME/.dotfiles/secrets" ]; then
echoStageName "Cloning secrets repo"
git clone https://$GITLAB_LOGIN:$GITLAB_TOKEN@gitlab.com/AndreiJirohHaliliDev2006/dotfiles-secrets $HOME/.dotfiles/secrets git clone https://$GITLAB_LOGIN:$GITLAB_TOKEN@gitlab.com/AndreiJirohHaliliDev2006/dotfiles-secrets $HOME/.dotfiles/secrets
[ $? == "0" ] && echo "error: That kinda sus, but either only Andrei Jiroh can proceed or maybe the PAT you used is invalid." && exit 1 [ $? == "0" ] && echo "error: That kinda sus, but either only Andrei Jiroh can proceed or maybe the PAT you used is invalid." && exit 1
chmod 600 $HOME/.dotfiles/secrets/{ssh,pgp} chmod 600 $HOME/.dotfiles/secrets/{ssh,pgp}
sleep 5 sleep 5
else else
git -C "$HOME/.dotfiles/secrets" fetch --all git -C "$HOME/.dotfiles/secrets" fetch --all
git -C "$HOME/.dotfiles/secrets" pull
fi fi
} }
cleanup() { cleanup() {
echoStageName "----> Bootstrapper successfully ran, cleaning up to ensure no secrets are leaked on env vars..." echoStageName "Bootstrapper successfully ran, cleaning up to ensure no secrets are leaked on env vars..."
# just add chaos to these secrets to avoid leaks # just add chaos to these secrets to avoid leaks
export GH_USERNAME=gildedguy export GITLAB_LOGIN=gildedguy
export GH_PAT=build-guid-sus-among-computers-moment export GITLAB_TOKEN=build-guid-sus-among-computers-moment
if echo $OSTYPE | grep -qE "linux-android.*"; then if echo $OSTYPE | grep -qE "linux-android.*"; then
rm -rfv ~/{shellcheck,flarectl,LICENSE,README.txt,README.md} rm -rfv ~/{shellcheck,flarectl,LICENSE,README.txt,README.md}
pkg uninstall clang --yes && apt autoremove --yes pkg uninstall clang --yes && apt autoremove --yes