-
Notifications
You must be signed in to change notification settings - Fork 7
/
uninstall.sh
executable file
·61 lines (48 loc) · 1.48 KB
/
uninstall.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
#!/bin/bash
# This script was partly inspired by https://github.com/atar-axis/xpadneo/blob/master/uninstall.sh
source _variables.sh
if [[ "$EUID" != 0 ]]; then
echo "The script need to be run as root."
exit 1
fi
modprobe -rq $MODULE_NAME
# Remove the module auto-loading
rm -f /etc/modules-load.d/acpi_ec.conf
mapfile -t VERSIONS < <(dkms status 2>/dev/null | sed -E -n "s#$MODULE_NAME.*(v[0-9]+.[0-9]+.[0-9]+).*#\1# p" | sort -u)
# FIX: v1.0.1 did not have a 'v' behind the version
if $(dkms status | grep -q "$MODULE_NAME.*1.0.1"); then
VERSIONS+=( "1.0.1" )
fi
for version in "${VERSIONS[@]}"; do
dkms uninstall "$MODULE_NAME/$version" --all
dkms remove "$MODULE_NAME/$version" --all
rm -rf "/usr/src/$MODULE_NAME-$version/"
echo "Uninstalled $MODULE_NAME $version"
done
if [[ -f "$SIGN_DIR/mok.der" ]]; then
echo -n "Do you want to remove the generated key? (y/N) "
read -r RES
echo
case $RES in
[yY]*)
mokutil --delete "$SIGN_DIR/mok.der" 2>/dev/null
rm -rf "$SIGN_DIR"
echo "Successfully deleted and revoked the key."
;;
*) ;;
esac
fi
# Fix wrong folder issue
if [[ -f /root/mok.der ]]; then
echo -n "Do you want to remove the generated key? (y/N) "
read -r RES
echo
case $RES in
[yY]*)
mokutil --delete "/root/mok.der" 2>/dev/null
rm -f /root/mok.der /root/mok.priv /root/keys-setup.sh
echo "Successfully deleted and revoked the key."
;;
*) ;;
esac
fi