-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·43 lines (33 loc) · 1 KB
/
install.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
#!/bin/sh
#
# Installation script for torCrawl. It tries to move $bin in one of the
# directories stored in $binpaths.
INSTALL_DIR=$(dirname $0)
echo "Compiling go binary.."
go build -o torMonger
bin="$INSTALL_DIR/torMonger"
binpaths="/usr/local/bin /usr/bin"
echo "Creating data location for PSQL database data: /var/tmp/tormonger_data "
mkdir /var/tmp/tormonger_data
# This variable contains a nonzero length string in case the script fails
# because of missing write permissions.
is_write_perm_missing=""
for binpath in $binpaths; do
if mv "$bin" "$binpath/$bin" ; then
echo "Moved $bin to $binpath"
exit 0
else
if [ -d "$binpath" ] && [ ! -w "$binpath" ]; then
is_write_perm_missing=1
fi
fi
done
echo "We cannot install $bin in one of the directories $binpaths"
if [ -n "$is_write_perm_missing" ]; then
echo "It seems that we do not have the necessary write permissions."
echo "Perhaps try running this script as a privileged user:"
echo
echo " sudo $0"
echo
fi
exit 1