52 lines
1.3 KiB
Bash
Executable File
52 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
main(){
|
|
if [[ "$(whoami)" != "root" ]];then
|
|
bash ./error.sh "Must be root (current: $USER)";
|
|
exit 1;
|
|
fi
|
|
run_dotfiles_install;
|
|
}
|
|
|
|
_install_dotfiles(){
|
|
local out=$1; local url=$2; local post=$3;
|
|
|
|
bash ./warn.sh "Fetching $out ..."
|
|
if (curl "$url" -o "$out" --create-dirs);then
|
|
bash ./success.sh "Success: $out"
|
|
if [[ "$post" ]]; then
|
|
eval "$post"
|
|
fi
|
|
else
|
|
bash ./error.sh "Failed: $out"
|
|
fi
|
|
|
|
}
|
|
|
|
run_dotfiles_install(){
|
|
echo "########################### Dot Files #######################"
|
|
declare -A vim=(
|
|
["out"]="$HOME/.vimrc"
|
|
["url"]="http://git.klectr.dev/tristonarmstrong/dotfiles/raw/branch/main/.vimrc"
|
|
["post"]="vim -es -u vimrc -i NONE -c "PlugInstall" -c "qa"" # <-- runs pluginstall after
|
|
)
|
|
declare -A helix_config=(
|
|
["out"]="$HOME/.config/helix/config.toml"
|
|
["url"]="https://git.klectr.dev/tristonarmstrong/dotfiles/raw/branch/main/.config/helix/config.toml"
|
|
["post"]=""
|
|
)
|
|
declare -A helix_languages=(
|
|
["out"]="$HOME/.config/helix/languages.toml"
|
|
["url"]="https://git.klectr.dev/tristonarmstrong/dotfiles/raw/branch/main/.config/helix/languages.toml"
|
|
["post"]=""
|
|
)
|
|
|
|
dotfiles+=("vim" "helix_config" "helix_languages")
|
|
for tuple_name in "${dotfiles[@]}"; do
|
|
declare -n tuple="$tuple_name"
|
|
_install_dotfiles "${tuple["out"]}" "${tuple["url"]}" "${tuple["post"]}";
|
|
done;
|
|
}
|
|
|
|
main;
|