chore(bootstrap): add checks to check if PREFIX/bin exists

This commit is contained in:
Andrei Jiroh Eugenio Halili 2021-07-04 16:39:57 +08:00 committed by GitHub
parent a0c9d56770
commit 0b828cdcd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 2 deletions

View File

@ -55,7 +55,8 @@ success() {
}
checkOs() {
# This step is required for different actions, like installing deps from system-wide package managers
# among other sorts of shitfuckery
if echo $OSTYPE | grep -qE "linux-android.*"; then
export DOTFILES_OS_NAME=android-termux
elif echo $OSTYPE | grep -qE '^linux-gnu.*' && [ -f '/etc/debian_version' ]; then
@ -93,6 +94,16 @@ installDeps() {
sleep 5
}
userspcaeBinDirCheck() {
echoStageName "checking if PREFIX/bin exists"
if [ ! -d $PREFIX/bin ]; then
warn "$PREFIX/bin doesn't exists, creating..."
mkdir -p $PREFIX/bin
else
success "Looks good!"
fi
}
cloneRepo() {
if [ ! -d "$HOME/.dotfiles" ]; then
echoStageName "Cloning the dotfiles repo"
@ -300,8 +311,9 @@ main() {
# step 1: check the OS first
checkOs
# step 2: install needed tools
# step 2: install needed tools and create ~/.local/bin
installDeps
userspcaeBinDirCheck
# step 3.1: then clone the repo
cloneRepo