File tree 5 files changed +73
-30
lines changed
5 files changed +73
-30
lines changed Original file line number Diff line number Diff line change 11
11
from rich .panel import Panel
12
12
import os
13
13
14
+ init ()
14
15
console = Console ()
15
16
16
17
richprint (Panel ("[cyan bold]" + banner + "[/cyan bold]" ,width = 65 ,border_style = "cyan" ))
17
18
table ,preset_dict = preset_table ()
18
19
console .print (table )
19
20
richprint ("[cyan bold][ 0 ][/cyan bold] [green bold]Instructions for creating a preset[/green bold]" )
21
+ richprint ("[cyan bold][ 99 ][/cyan bold] [green bold]Remove installed NoiceGRUB theme[/green bold]" )
20
22
21
- choice = IntPrompt .ask ("[yellow]Choice[/yellow]" ,choices = [ str ( i ) for i in range ( len ( preset_dict )+ 1 )] )
23
+ choice = IntPrompt .ask ("[yellow]Choice[/yellow]" ,choices = gen_choices ( preset_dict ))
22
24
if choice == 0 :
23
25
console .print (Markdown (open ('noicegrub/createpreset.md' ).read ()))
24
26
exit ()
27
+ elif choice == 99 :
28
+ richprint ('\n [green bold]Executing scripts/remove.sh ... [/green bold]' )
29
+ os .system ('sudo ./scripts/remove.sh' )
30
+ richprint ('[green bold]Done[/green bold]' )
31
+ exit ()
25
32
26
33
print ()
27
34
preset = get_preset (preset_dict [choice ])
50
57
choice = Confirm .ask ("[yellow bold]Would you like to install the theme ?[/yellow bold]" )
51
58
if choice :
52
59
richprint ('\n [green bold]Executing scripts/install.sh ... [/green bold]' )
53
- os .system ('chmod +x ./scripts/install.sh' )
54
60
os .system ('sudo ./scripts/install.sh' )
55
61
richprint ('[green bold]Done[/green bold]' )
Original file line number Diff line number Diff line change @@ -5,6 +5,15 @@ def get_preset(name):
5
5
data = toml .load (open (f'./presets/{ name } .toml' ))
6
6
return [data [i ] for i in data ]
7
7
8
+ def gen_choices (presetDict ):
9
+ ch_list = [str (i ) for i in range (len (presetDict )+ 1 )]
10
+ ch_list .append ('99' )
11
+ return ch_list
12
+
13
+ def init ():
14
+ os .system ('chmod +x ./scripts/functions.sh' )
15
+ os .system ('chmod +x ./scripts/install.sh' )
16
+ os .system ('chmod +x ./scripts/remove.sh' )
8
17
9
18
#================= rich tables
10
19
def preset_table ():
@@ -56,4 +65,4 @@ def gen_font_name(font_name,size):
56
65
8 `b8 8 8 8 8 . 8. 8 8 8 8 8 8 8 8
57
66
8 `8 `YooP' 8 `YooP' `Yooo' `YooP8 8 8 `YooP' 8oooP'
58
67
..:::..:.....::..:.....::.....::....8 :..:::..:.....::......:
59
- :::::::: @1337kid ::::::::::::::::::8 :::::::: v2.0 :: :::::::\n '''
68
+ :::::::: @1337kid ::::::::::::::::::8 :::::::: v2.0.1 :::::::\n '''
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ check_uid () {
4
+ if [[ $( id -u) != " 0" ]]
5
+ then
6
+ printf " \033[91mCurrent user does not have root perms\n"
7
+ exit
8
+ fi
9
+ }
10
+
11
+ update_grub_func () {
12
+ if [[ $( which dnf) != " " ]]; then
13
+ fedora_version=$( cat /etc/fedora-release | awk ' {print $3}' )
14
+ if [[ fedora_version -gt 34 ]]; then
15
+ grub2-mkconfig -o /boot/grub2/grub.cfg
16
+ else
17
+ grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
18
+ fi
19
+ else
20
+ update-grub
21
+ fi
22
+ }
23
+
24
+ get_path () {
25
+ if [[ -d " /boot/grub2" ]]; then
26
+ GRUB_PATH=' /boot/grub2/'
27
+ elif [[ -d " /boot/grub" ]]; then
28
+ GRUB_PATH=' /boot/grub/'
29
+ elif [[ -d " /boot/efi/EFI/fedora" ]]; then
30
+ GRUB_PATH=' /boot/efi/EFI/fedora/'
31
+ fi
32
+ }
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
3
GRUB_PATH=' '
4
- THEMES_PATH =' '
4
+ THEME_PATH =' '
5
5
6
- get_path () {
7
- if [[ -d " /boot/grub2" ]]; then
8
- GRUB_PATH=' /boot/grub2/'
9
- elif [[ -d " /boot/grub" ]]; then
10
- GRUB_PATH=' /boot/grub/'
11
- elif [[ -d " /boot/efi/EFI/fedora" ]]; then
12
- GRUB_PATH=' /boot/efi/EFI/fedora/'
13
- fi
14
- }
6
+ source ./scripts/functions.sh
15
7
16
8
makefont () {
17
9
font=$( ls ./export | grep -E ' .ttf|.otf' )
@@ -42,16 +34,7 @@ install() {
42
34
# ========= GRUB update
43
35
#
44
36
printf " \033[92m[+] \033[94mUpdating GRUB config\n\033[92m"
45
- if [[ $( which dnf) != " " ]]; then
46
- fedora_version=$( cat /etc/fedora-release | awk ' {print $3}' )
47
- if [[ fedora_version -gt 34 ]]; then
48
- grub2-mkconfig -o /boot/grub2/grub.cfg
49
- else
50
- grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
51
- fi
52
- else
53
- update-grub
54
- fi
37
+ update_grub_func
55
38
}
56
39
# =========================
57
40
@@ -66,14 +49,9 @@ cat <<EOF
66
49
67
50
EOF
68
51
69
- if [[ $( id -u) != " 0" ]]
70
- then
71
- printf " \033[91mCurrent user does not have root perms\n"
72
- exit
73
- fi
74
-
52
+ check_uid
75
53
get_path
76
54
THEME_PATH=$GRUB_PATH " themes/noicegrub"
77
55
printf " \033[1m\033[93m"
78
- echo " Generated theme will be placed in $THEMES_PATH "
56
+ echo " Generated theme will be placed in $THEME_PATH "
79
57
install
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ GRUB_PATH=' '
4
+
5
+ source ./scripts/functions.sh
6
+
7
+ printf " \033[1m"
8
+ check_uid
9
+ get_path
10
+ THEME_PATH=$GRUB_PATH " themes/noicegrub"
11
+ printf " \033[92m[+] \033[94mRemoving NoiceGRUB theme\n\033[92m"
12
+ rm -rf $THEME_PATH 2> /dev/null
13
+ # ===== grub config
14
+ sed -i ' s/.*GRUB_THEME=.*//' /etc/default/grub
15
+ sed -i ' s/.*GRUB_FONT=.*//' /etc/default/grub
16
+ # =====
17
+ printf " \033[92m[+] \033[94mUpdating GRUB config\n\033[92m"
18
+ update_grub_func
You can’t perform that action at this time.
0 commit comments