Skip to content

Commit

Permalink
check_uid function
Browse files Browse the repository at this point in the history
  • Loading branch information
1337kid committed Jan 11, 2024
1 parent 91d141d commit e06e835
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
8 changes: 8 additions & 0 deletions scripts/functions.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

check_uid() {
if [[ $(id -u) != "0" ]]
then
printf "\033[91mCurrent user does not have root perms\n"
exit
fi
}

update_grub_func() {
if [[ $(which dnf) != "" ]];then
fedora_version=$(cat /etc/fedora-release | awk '{print $3}')
Expand Down
7 changes: 1 addition & 6 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ cat <<EOF
EOF

if [[ $(id -u) != "0" ]]
then
printf "\033[91mCurrent user does not have root perms\n"
exit
fi

check_uid
get_path
THEME_PATH=$GRUB_PATH"themes/noicegrub"
printf "\033[1m\033[93m"
Expand Down
7 changes: 1 addition & 6 deletions scripts/remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@

GRUB_PATH=''

if [[ $(id -u) != "0" ]]
then
printf "\033[91mCurrent user does not have root perms\n"
exit
fi

source ./scripts/functions.sh

printf "\033[1m"
check_uid
get_path
THEME_PATH=$GRUB_PATH"themes/noicegrub"
printf "\033[92m[+] \033[94mRemoving NoiceGRUB theme\n\033[92m"
Expand Down

0 comments on commit e06e835

Please sign in to comment.