-
Notifications
You must be signed in to change notification settings - Fork 1
/
compatmgr.sh
executable file
·158 lines (145 loc) · 3.79 KB
/
compatmgr.sh
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/bin/sh
export DIR=$(pwd)
if echo ${LANG} | grep -q "^zh_CN"; then
. ${DIR}/i18n/zh_CN.sh
else
. ${DIR}/i18n/en_US.sh
fi
if ! command -v bsddialog > /dev/null 2>&1; then
echo $(trans BSDDIALOG_NOT_FOUND)
exit 1
fi
if [ ! "`whoami`" = "root" ]; then
echo $(trans NOT_RUN_BY_ROOT)
exit 1
fi
case $(sysctl -n hw.machine_arch) in
amd64)
MACHINE_ARCH=amd64
;;
aarch64)
MACHINE_ARCH=arm64
;;
i386)
MACHINE_ARCH=i386
;;
*)
echo $(trans ARCH_NOT_SUPPORTED)
exit 1
;;
esac
export MACHINE_ARCH
while true; do
CHOICE=$(bsddialog --cancel-label "$(trans EXIT)" \
--ok-label "$(trans OK)" \
--menu "$(trans WELCOME)" \
0 60 3 \
"$(trans CHOICE_CHECK)" "$(trans CHOICE_CHECK_DESCRIPTION)" \
"$(trans CHOICE_INSTALL)" "$(trans CHOICE_INSTALL_DESCRIPTION)" \
"$(trans CHOICE_REMOVE)" "$(trans CHOICE_REMOVE_DESCRIPTION)" \
3>&2 2>&1 1>&3)
case ${CHOICE} in
"$(trans CHOICE_CHECK)")
echo ""
${DIR}/scripts/check.sh
STATUS=${?}
case ${STATUS} in
0)
bsddialog --msgbox "$(trans CHECK_SUCCESS)" 0 0
;;
1)
bsddialog --msgbox "$(trans CHECK_FAILED_LINUX_NOT_STARTED)" 0 0
;;
2)
bsddialog --msgbox "$(trans CHECK_FAILED_DBUS_NOT_INSTALLED)" 0 0
;;
3)
bsddialog --msgbox "$(trans CHECK_FAILED_DBUS_NOT_STARTED)" 0 0
;;
4)
bsddialog --msgbox "$(trans CHECK_FAILED_NULLFS_NOT_LOADED)" 0 0
;;
5)
bsddialog --msgbox "$(trans CHECK_FAILED_CANCELED)" 0 0
esac
;;
"$(trans CHOICE_INSTALL)")
while true; do
CHOICE=$(bsddialog --cancel-label "$(trans RETURN)" \
--ok-label "$(trans OK)" \
--no-description \
--menu "$(trans INSTALL_SELECT)" \
0 0 7 \
Debian debian \
Ubuntu ubuntu \
Kali kali \
Fedora fedora \
openSUSE opensuse \
Gentoo gentoo \
"Arch Linux" "arch linux" \
3>&2 2>&1 1>&3)
case ${CHOICE} in
"Debian")
${DIR}/scripts/debian.sh
STATUS=${?}
;;
"Ubuntu")
${DIR}/scripts/ubuntu.sh
STATUS=${?}
;;
"Kali")
${DIR}/scripts/kali.sh
STATUS=${?}
;;
"Fedora")
${DIR}/scripts/fedora.sh
STATUS=${?}
;;
"openSUSE")
${DIR}/scripts/suse.sh
STATUS=${?}
;;
"Gentoo")
${DIR}/scripts/gentoo.sh
STATUS=${?}
;;
"Arch Linux")
${DIR}/scripts/arch.sh
STATUS=${?}
;;
*)
break
;;
esac
case ${STATUS} in
0)
break
;;
5)
;;
2)
bsddialog --msgbox "$(trans CANCEL_INSTALLATION)" 0 0
;;
3)
bsddialog --msgbox "$(trans CANCEL_SETUP)" 0 0
;;
esac
done
;;
"$(trans CHOICE_REMOVE)")
${DIR}/scripts/remove.sh
STATUS=${?}
case ${STATUS} in
0)
;;
2)
bsddialog --msgbox "$(trans ABORT)" 0 0
;;
esac
;;
*)
echo $(trans GOODBYE)
exit 0
;;
esac
done