forked from gtri/scrimmage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clean-system.sh
executable file
·60 lines (53 loc) · 1.4 KB
/
clean-system.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
#!/bin/bash
usage()
{
cat << EOF
USAGE:
$0 [OPTIONS]
NO OPTIONS:
Without specifying any options, the script displays the
scrimmage files found on the system.
OPTIONS:
-r Remove scrimmage files from system
-p Specific the system prefix to search (default: /usr/local)
-h Display this help message
EOF
}
PREFIX=/usr/local
REMOVE_FILES=false
while getopts ":rp:h" opt; do
case $opt in
h)
usage
exit 0
;;
p)
PREFIX=${OPTARG}
;;
r)
REMOVE_FILES=true
;;
\?)
echo "Invalid option: -$OPTARG" >&2
usage
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
usage
exit 1
;;
esac
done
if [ $REMOVE_FILES == true ]; then
find ${PREFIX}/bin -iname "*scrimmage*" | xargs sudo rm -rf
find ${PREFIX}/etc -iname "*scrimmage*" | xargs sudo rm -rf
find ${PREFIX}/include -iname "*scrimmage*" | xargs sudo rm -rf
find ${PREFIX}/lib -iname "*scrimmage*" | xargs sudo rm -rf
else
find ${PREFIX}/bin -iname "*scrimmage*"
find ${PREFIX}/etc -iname "*scrimmage*"
find ${PREFIX}/include -iname "*scrimmage*"
find ${PREFIX}/lib -iname "*scrimmage*"
#find ${PREFIX}/share -iname "*scrimmage*"
fi