From 54f8063d2cd5492f393d7935c406c9e3f0c7f643 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Mon, 11 Nov 2024 11:02:53 -0500 Subject: [PATCH] add guard to all scripts --- apps.sh | 7 ++++++- cli.sh | 6 +++++- dots.sh | 6 +++++- install.sh | 2 ++ non_pac.sh | 7 ++++++- post_setup.sh | 5 +++++ 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/apps.sh b/apps.sh index 943821a..0739dd1 100755 --- a/apps.sh +++ b/apps.sh @@ -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(){ diff --git a/cli.sh b/cli.sh index 7ea5a47..25dac76 100755 --- a/cli.sh +++ b/cli.sh @@ -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(){ diff --git a/dots.sh b/dots.sh index 885ebb2..4974b08 100755 --- a/dots.sh +++ b/dots.sh @@ -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(){ diff --git a/install.sh b/install.sh index 79573b6..2f32619 100755 --- a/install.sh +++ b/install.sh @@ -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 diff --git a/non_pac.sh b/non_pac.sh index 1f29707..a9241f4 100755 --- a/non_pac.sh +++ b/non_pac.sh @@ -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(){ diff --git a/post_setup.sh b/post_setup.sh index e9996e4..3252804 100755 --- a/post_setup.sh +++ b/post_setup.sh @@ -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