-
Notifications
You must be signed in to change notification settings - Fork 33
/
cleanup_after_start.sh
executable file
·74 lines (64 loc) · 1.88 KB
/
cleanup_after_start.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
67
68
69
70
71
72
73
74
#!/bin/bash
#
# Cleanup the environment after scope start
#
PRELOAD_PATH="/etc/ld.so.preload"
LIBSCOPE_PATH="/usr/lib/libscope.so"
PROFILE_SCOPE_SCRIPT="/etc/profile.d/scope.sh"
USR_APPSCOPE_DIR="/usr/lib/appscope/"
TMP_APPSCOPE_DIR="/tmp/appscope/"
CRIBL_APPSCOPE_DIR="$CRIBL_HOME/appscope/"
echo "Following script will try to remove following files:"
echo "- $PRELOAD_PATH"
echo "- $LIBSCOPE_PATH"
echo "- $PROFILE_SCOPE_SCRIPT"
echo "- $USR_APPSCOPE_DIR"
echo "- $TMP_APPSCOPE_DIR"
echo "- \$CRIBL_HOME/appscope/"
read -p "Continue (y/n)?" choice
case "$choice" in
y|Y ) echo "Yes selected - Continuing";;
n|N ) echo "No selected - Exiting"; exit;;
* ) echo "Unknown choice - Exiting"; exit;;
esac
if [ "$EUID" -ne 0 ]
then echo "Please run script with sudo"
exit
fi
if [ -f $PRELOAD_PATH ] ; then
rm $PRELOAD_PATH
echo "$PRELOAD_PATH file was removed"
else
echo "$PRELOAD_PATH file was missing. Continue..."
fi
# This one is a symbolic link
if [ -L $LIBSCOPE_PATH ] ; then
rm $LIBSCOPE_PATH
echo "$LIBSCOPE_PATH file was removed"
else
echo "$LIBSCOPE_PATH file was missing. Continue..."
fi
if [ -f $PROFILE_SCOPE_SCRIPT ] ; then
rm $PROFILE_SCOPE_SCRIPT
echo "$PROFILE_SCOPE_SCRIPT file was removed"
else
echo "$PROFILE_SCOPE_SCRIPT file was missing. Continue..."
fi
if [ -d "$USR_APPSCOPE_DIR" ] ; then
rm -r $USR_APPSCOPE_DIR
echo "$USR_APPSCOPE_DIR directory was removed"
else
echo "$USR_APPSCOPE_DIR directory was missing. Continue..."
fi
if [ -d "$TMP_APPSCOPE_DIR" ] ; then
rm -r $TMP_APPSCOPE_DIR
echo "$TMP_APPSCOPE_DIR directory was removed"
else
echo "$TMP_APPSCOPE_DIR directory was missing."
fi
if [ -f $CRIBL_HOME ] && [ -d "$CRIBL_APPSCOPE_DIR" ] ; then
rm -r $CRIBL_APPSCOPE_DIR
echo "$CRIBL_APPSCOPE_DIR directory was removed"
else
echo "\$CRIBL_HOME was not set or \$CRIBL_HOME/appscope directory was missing."
fi