-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathclean.sh
66 lines (54 loc) · 1006 Bytes
/
clean.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
#!/bin/bash
EXIT_CODE=0
SCRIPT_DIR="$(dirname $(readlink -f "${BASH_SOURCE}"))"
Usage() {
echo ""
echo "Deletes build artifacts from the repo."
echo ""
echo "Usage:"
echo "---------------------"
echo "clean.sh"
echo ""
echo "Examples"
echo "---------------------"
echo "user@system:~/repo$ chmod +x *.sh"
echo "user@system:~/repo$ ./clean.sh"
echo ""
Finish
}
Error() {
EXIT_CODE=1
End
}
End() {
echo ""
echo "Clean Stage Exit Code: $EXIT_CODE"
echo ""
Finish
}
Finish() {
exit $EXIT_CODE
}
if [ "${1,,}" == "/?" ] || [ "${1,,}" == "-?" ] || [ "${1,,}" == "--help" ]; then
Usage
fi
echo ""
for dir in $SCRIPT_DIR/out/*/
do
echo "Clean: $dir"
rm -rfd $dir
result=$?
if [ $result -ne 0 ]; then
Error
fi
done
for dir in $(find $SCRIPT_DIR/src -type d | grep obj$)/
do
echo "Clean: $dir"
rm -rfd $dir
result=$?
if [ $result -ne 0 ]; then
Error
fi
done
End