forked from radareorg/radare2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·58 lines (49 loc) · 1.12 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
MAKE=make
gmake --help >/dev/null 2>&1
[ $? = 0 ] && MAKE=gmake
${MAKE} --help 2>&1 | grep -q gnu
if [ $? != 0 ]; then
echo "You need GNU Make to build me"
exit 1
fi
export MAKE="$MAKE"
[ -z "${INSTALL_TARGET}" ] && INSTALL_TARGET=symstall
# find root
cd "$(dirname "$0")" ; cd ..
# update
if [ "$1" != "--without-pull" ]; then
if [ -d .git ]; then
git branch | grep "^\* master" > /dev/null
if [ $? = 0 ]; then
echo "WARNING: Updating from remote repository"
git pull
fi
fi
else
shift
fi
export NOSUDO
if [ -n "${NOSUDO}" ]; then
SUDO=""
else
type sudo > /dev/null 2>&1 || NOSUDO=1
SUDO=sudo
[ -n "${NOSUDO}" ] && SUDO=
fi
if [ "$(id -u)" = 0 ]; then
SUDO=""
else
[ -n "${NOSUDO}" ] && SUDO="echo NOTE: sudo not found. Please run as root: "
fi
if [ "${M32}" = 1 ]; then
./sys/build-m32.sh $* && ${SUDO} ${MAKE} ${INSTALL_TARGET}
elif [ "${HARDEN}" = 1 ]; then
# shellcheck disable=SC2048
# shellcheck disable=SC2086
./sys/build-harden.sh $* && ${SUDO} ${MAKE} ${INSTALL_TARGET}
else
# shellcheck disable=SC2048
# shellcheck disable=SC2086
./sys/build.sh $* && ${SUDO} ${MAKE} ${INSTALL_TARGET}
fi