add guard to all scripts

This commit is contained in:
Triston Armstrong 2024-11-11 11:02:53 -05:00
parent 4d6863c16b
commit 54f8063d2c
6 changed files with 29 additions and 4 deletions

View File

@ -1,6 +1,11 @@
#!/bin/bash
main(){
run_apps_install;
if [[ "$(whoami)" != "root" ]];then
bash ./error.sh "Must be root (current: $USER)";
exit 1;
fi
run_apps_install;
}
_install_app(){

6
cli.sh
View File

@ -1,7 +1,11 @@
#!/bin/bash
main(){
run_cli_install;
if [[ "$(whoami)" != "root" ]];then
bash ./error.sh "Must be root (current: $USER)";
exit 1;
fi
run_cli_install;
}
_install_cli(){

View File

@ -1,7 +1,11 @@
#!/bin/bash
main(){
run_dotfiles_install;
if [[ "$(whoami)" != "root" ]];then
bash ./error.sh "Must be root (current: $USER)";
exit 1;
fi
run_dotfiles_install;
}
_install_dotfiles(){

View File

@ -3,6 +3,8 @@
# TODO should be applicable to other package managers (dnf, apt, ..)
# v--- this is for potential future ideas
# flatpak uninstall $(flatpak list --columns=application | grep -i turtle)
# power management (install this first) https://github.com/FlyGoat/RyzenAdj
# power management (install this second) https://github.com/aarron-lee/SimpleDeckyTDP

View File

@ -1,7 +1,12 @@
#!/bin/bash
main(){
run_non_pac_install;
if [[ "$(whoami)" != "root" ]];then
bash ./error.sh "Must be root (current: $USER)";
exit 1;
fi
run_non_pac_install;
}
_install_non_pacman(){

View File

@ -1,5 +1,10 @@
#!/bin/bash
if [[ "$(whoami)" != "root" ]];then
bash ./error.sh "Must be root (current: $USER)";
exit 1;
fi
xdg-settings set default-web-browser io.github.zen_browser.zen.desktop
if [[ $(which $SHELL) != "/bin/fish" ]]; then