-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstaller
executable file
·114 lines (92 loc) · 2.46 KB
/
installer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
my_theme_name=gnapple-plymouth-theme
prefix_themes_path=/usr/share/plymouth/themes
my_theme_path=$prefix_themes_path/$my_theme_name
get_setup_help() {
sed -n '110,118p' $0
exit 1
}
create_new_initramfs() {
if type update-initramfs &>/dev/null; then
update-initramfs -u &>/dev/null
elif type mkinitcpio &>/dev/null; then
mkinitcpio -P &>/dev/null
else
echo "Warning: Could not rebuild initramfs!"
echo "Maybe you should do this manually!"
fi
}
no_plymouth_exit() {
if [ ! -d $prefix_themes_path ]; then
echo "Error: Could not found plymouth!"
echo "Please install plymouth and try again!"
exit 1
fi
}
not_root_exit() {
if ((UID != 0)); then
echo "Error: Permissions denied!"
echo "Please run as root or using sudo command!"
exit 1
fi
}
remove_plymouth_theme() {
if [ -d $my_theme_path ]; then
echo "Wait for uninstalling complete..."
if type plymouth-set-default-theme &>/dev/null; then
plymouth-set-default-theme -r &>/dev/null
else
update-alternatives --remove default.plymouth \
$my_theme_path/$my_theme_name.plymouth &>/dev/null
create_new_initramfs
fi
rm -rf $my_theme_path
echo "Uninstall success!"
else
echo "The $my_theme_name theme never installed!"
exit 1
fi
}
install_plymouth_theme() {
echo "Please wait until installation is complete..."
cp -r $my_theme_name $prefix_themes_path
mv $my_theme_path/$my_theme_name.js $my_theme_path/$my_theme_name.script
sed -i 's/function/fun/g' $my_theme_path/$my_theme_name.script
if type plymouth-set-default-theme &>/dev/null; then
plymouth-set-default-theme -R $my_theme_name &>/dev/null
else
update-alternatives --install $prefix_themes_path/default.plymouth default.plymouth \
$my_theme_path/$my_theme_name.plymouth 200 &>/dev/null
update-alternatives --set default.plymouth \
$my_theme_path/$my_theme_name.plymouth &>/dev/null
create_new_initramfs
fi
echo "The $my_theme_name theme has been Configured."
exit 0
}
no_plymouth_exit
not_root_exit
if [[ $1 ]]; then
case $1 in
-r*)
remove_plymouth_theme
;;
-R*)
remove_plymouth_theme
install_plymouth_theme
;;
*)
get_setup_help
;;
esac
else
install_plymouth_theme
fi
exit 0
usage:
sudo ./installer [ -r | -R ]
options:
-r remove GnApple Plymouth Theme
-R reinstall GnApple Plymouth Theme
no args to install theme
wrong to show this message