43 lines
1.1 KiB
Bash
43 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
## Script Location
|
|
SCRIPTDIR=$(dirname $0)
|
|
source "$SCRIPTDIR/common/colors.sh"
|
|
source "$SCRIPTDIR/common/functions.sh"
|
|
|
|
load_defaults=""
|
|
case "$1" in
|
|
defaults) load_defaults="defaults";;
|
|
"") load_defaults="";;
|
|
*) echo "'$1' is not a valid template-setup command";;
|
|
esac
|
|
if [ "$load_defaults" == "defaults" ]; then
|
|
source $SCRIPTDIR/defaults-dbb.sh
|
|
else
|
|
source $SCRIPTDIR/defaults-blank.sh
|
|
fi
|
|
|
|
BASHRCFILE="$HOME/.bashrc"
|
|
|
|
custom_bash_aliases_path="/etc/bash_aliases"
|
|
custom_bash_aliases_git="https://git.deathbybandaid.net/deathbybandaid/bash_aliases.git"
|
|
git_update "topgrade" "$custom_bash_aliases_path" "$custom_bash_aliases_git"
|
|
|
|
printf "$COL_LIGHT_BLUE" "* Checking if bash aliases are setup in ~/.bashrc"
|
|
if [[ $(grep -L "$custom_bash_aliases_path" $BASHRCFILE) ]]; then
|
|
printf "$COL_YELLOW" "** Linking bash aliases"
|
|
cat <<EOT >> $BASHRCFILE
|
|
|
|
# Aliases
|
|
if [ -f $custom_bash_aliases_path/main.aliases ]; then
|
|
. $custom_bash_aliases_path/main.aliases
|
|
fi
|
|
EOT
|
|
|
|
else
|
|
printf "$COL_YELLOW" "** bash aliases already linked"
|
|
fi
|
|
|
|
printf "$COL_LIGHT_BLUE" "* Importing Bash Aliases"
|
|
source $BASHRCFILE
|