-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall
executable file
·40 lines (35 loc) · 906 Bytes
/
uninstall
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
#!/bin/bash
subcommand() {
# Run the command and indent it but return the original exit status
$@ |& sed 's/^/ /'
return ${PIPESTATUS[0]}
}
echo "This will uninstall cryptIC driver and its components."
read -r -p "Do you wish to continue? [y/N] " response
echo ""
if [[ ! "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
then
echo -e "Uninstallation cancelled, quitting"
exit 0
fi
sudo -v
# Remove installed modules
echo "Removing modules"
modules=(cryptic crypticintf crypticusb softwareHash)
for module in ${modules[@]}
do
subcommand sudo rmmod "$module"
if (( $? != 0 ))
then
subcommand echo "ERROR: could not remove module '$module'. A system reboot may be necessary"
else
subcommand echo "- Removed '$module'"
fi
done
echo "Done!"
# Clean compilation files
cd driver
echo "Cleaning compilation files"
subcommand make clean
echo "Done!"
exit 0