-
Notifications
You must be signed in to change notification settings - Fork 2
/
vmware-unpatch.sh
61 lines (49 loc) · 1.32 KB
/
vmware-unpatch.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 -e
# Source common functions
. /usr/share/vmware-patch/common-functions.sh
# Help message
usage() {
echo "Usage: $(basename $0) [-v/-V|-h]"
echo "Revert the VMware modules sources."
echo
echo "Available options:"
echo " -v, -V, --version Print version information"
echo " -h, --help Print this help"
}
# Flags
while [[ $1 ]]; do
# Define actions
case "$1" in
-v | -V | --version) print_version; exit 0 ;;
-h | --help) usage; exit 0 ;;
-*) echo "$(basename $0): error: bad argument: $1"
echo
usage $1; exit 0 ;;
*) break ;;
esac
shift
done
# Make sure we are root
root_check
# Is a VMware product installed?
vmware_check
# Product name
set_product_name
# Remove leftover module locations
remove_leftover_module_dirs
cd /usr/lib/vmware/modules/
# Remove old backups
remove_old_backups
# Revert
cd /usr/lib/vmware/modules/
if [[ -d source-$ver ]]; then
msg "Reverting $name v$ver module sources.."
msg2 "Removing $(readlink -f source)/"
rm -r source/
msg2 "Renaming backup: $(readlink -f source-$ver)/ -> $(readlink -f source)/"
mv "source-$ver/" source/
msg3 "Done."
else # Nothing found
error "No backups found."
exit
fi