Add scripts/initiategui.sh
This commit is contained in:
42
scripts/initiategui.sh
Normal file
42
scripts/initiategui.sh
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
NO_FORMAT="\e[0m"
|
||||||
|
C_RED="\e[38;5;9m"
|
||||||
|
|
||||||
|
if [ "$UID" -ne 0 ]; then
|
||||||
|
echo -e "${C_RED}This script must be run as root.${NO_FORMAT}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
guardband(){
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo -e "${C_RED}The GUI seems either active or have background processes.${NO_FORMAT}"
|
||||||
|
read -r -p "Would you like to reset the GUI ? [y/N]" response
|
||||||
|
case "$response" in
|
||||||
|
[yY][eE][sS]|[yY])
|
||||||
|
resetgui
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
systemctl enable sddm
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
verifyguipresence(){
|
||||||
|
systemctl is-active sddm
|
||||||
|
if [ $? -ne 1 ]; then
|
||||||
|
echo -e "${C_RED}SDDM seems present.{NO_FORMAT}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if pgrep -i "lxqt" > /dev/null; then
|
||||||
|
echo -e "${C_RED}LXQT seems present.{NO_FORMAT}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
verifyguipresence
|
||||||
|
sleep 1
|
||||||
|
guardband
|
||||||
Reference in New Issue
Block a user