From a0d749b03c91bb1fecc41276a05d39ef0886713c Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sun, 14 Aug 2022 20:54:44 +0200 Subject: [PATCH] Added fast settings and changed root warning --- sos-git.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/sos-git.sh b/sos-git.sh index c95866d..33fe2bf 100755 --- a/sos-git.sh +++ b/sos-git.sh @@ -274,13 +274,25 @@ function checkRootUser() { echo " Please switch to a normal account, unless" echo " the repository asks for these permissions." echo "" - echo " To disable this warning, create a file at" - echo " \"$HOME/.sostools/git/sos-git.conf.d/norootwarning.conf\" or" - echo " \"/etc/sostools/git/sos-git.conf.d/norootwarning.conf\" with" - echo " the content \"SOSGIT_NOROOTWARNING=true\"." + echo " To disable this warning, create a file" + echo " at \"$HOME/.sostools/git/norootwarn\"" + echo " or \"/etc/sostools/git/norootwarn\"" + fi +} +function checkFastSettings() { + if [ -f "$HOME/.sostools/git/norootwarn" ] || [ -d "$HOME/.sostools/git/norootwarn" ]; then + rm -rf "$HOME/.sostools/git/norootwarn" + echo -e "# This file has been generated by sos-git\n# because of the use of fast settings.\nSOSGIT_NOROOTWARN=true" &> "$HOME/.sostools/git/sos-git.conf.d/norootwarning.conf" + fi + if [ "$(whoami)" == "root" ]; then + if [ -f "/etc/sostools/git/norootwarn" ] || [ -d "/etc/sostools/git/norootwarn" ]; then + rm -rf "/etc/sostools/git/norootwarn" + echo -e "# This file has been generated by sos-git\n# because of the use of fast settings.\nSOSGIT_NOROOTWARN=true" &> "/etc/sostools/git/sos-git.conf.d/norootwarning.conf" + fi fi } loadDefaultConfiguration +checkFastSettings loadSystemConfiguration loadUserConfiguration doSystemSetup