radare2/sys/install.sh

62 lines
1.2 KiB
Bash
Raw Normal View History

#!/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
2016-05-04 04:29:56 +08:00
export MAKE="$MAKE"
[ -z "${INSTALL_TARGET}" ] && INSTALL_TARGET=symstall
# find root
2015-06-17 11:47:36 +08:00
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
2014-11-24 05:11:41 +08:00
fi
else
export WITHOUT_PULL=1
shift
fi
umask 0002
2017-05-15 21:36:37 +08:00
export NOSUDO
if [ -n "${NOSUDO}" ]; then
SUDO=""
else
type sudo > /dev/null 2>&1 || NOSUDO=1
SUDO=sudo
[ -n "${NOSUDO}" ] && SUDO=
fi
2017-05-15 21:32:03 +08:00
2017-04-18 07:09:30 +08:00
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
2015-06-17 11:47:36 +08:00
# shellcheck disable=SC2048
# shellcheck disable=SC2086
./sys/build-harden.sh $* && ${SUDO} ${MAKE} ${INSTALL_TARGET}
else
2015-06-17 11:47:36 +08:00
# shellcheck disable=SC2048
# shellcheck disable=SC2086
./sys/build.sh $* && ${SUDO} ${MAKE} ${INSTALL_TARGET}
fi