forked from a2o/snoopy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenable.sh
executable file
·42 lines (29 loc) · 1007 Bytes
/
enable.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
#!/bin/sh
# A script that enables snoopy system-wide.
# You have to run this script as a privileged user.
### Where is the library installed?
LIBDIR=$1
if [ "x$LIBDIR" = "x" ]; then
echo "ERROR: No argument given, libdir expected"
exit 1
fi
### Check snoopy installation
if [ ! -x $LIBDIR/snoopy.so ]; then
echo "ERROR: $LIBDIR/snoopy.so is not installed or is not executable"
exit 1
fi
### Check user that is running this script
touch /etc/ld.so.preload
if [ ! -w /etc/ld.so.preload ]; then
echo 'ERROR: /etc/ld.so.preload not writable - are you running this script as a unprivileged user?'
exit 1
fi
### Do the actual install
if [ "`grep -c "^$LIBDIR/snoopy.so" /etc/ld.so.preload`" = "0" ]; then
echo "$LIBDIR/snoopy.so" >> /etc/ld.so.preload
echo "Snoopy is now enabled in /etc/ld.so.preload."
echo "Check your syslog files for output."
else
echo "Snoopy is already enabled in /etc/ld.so.preload."
echo "Check your syslog files for output."
fi