2014-09-18 12:52:32 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# based on
|
|
|
|
# http://blog.coolaj86.com/articles/how-to-unpackage-and-repackage-pkg-osx.html
|
|
|
|
|
|
|
|
# to uninstall:
|
|
|
|
# sudo pkgutil --forget org.radare.radare2
|
|
|
|
|
|
|
|
SRC=/tmp/r2osx
|
2016-03-22 18:24:25 +00:00
|
|
|
PREFIX=/usr/local
|
2015-06-17 02:59:01 +00:00
|
|
|
DST="$(pwd)/sys/osx-pkg/radare2.unpkg"
|
2016-07-06 22:32:59 +00:00
|
|
|
if [ -n "$1" ]; then
|
|
|
|
VERSION="$1"
|
|
|
|
else
|
|
|
|
VERSION="`./configure --version| head -n 1|awk '{print $1}'|cut -d - -f 2`"
|
2016-12-20 01:28:26 +00:00
|
|
|
[ -z "${VERSION}" ] && VERSION=1.1.0
|
2016-07-06 22:32:59 +00:00
|
|
|
fi
|
2016-04-26 12:35:51 +00:00
|
|
|
[ -z "${MAKE}" ] && MAKE=make
|
2014-09-18 12:52:32 +00:00
|
|
|
|
2015-03-11 14:28:39 +00:00
|
|
|
rm -rf "${SRC}"
|
2016-12-10 00:39:27 +00:00
|
|
|
${MAKE} mrproper 2>/dev/null
|
2016-03-22 18:24:25 +00:00
|
|
|
./configure --prefix="${PREFIX}" || exit 1
|
2016-04-26 12:35:51 +00:00
|
|
|
${MAKE} -j4 || exit 1
|
2014-09-18 12:52:32 +00:00
|
|
|
# TODO: run sys/install.sh
|
2016-04-26 12:35:51 +00:00
|
|
|
${MAKE} install PREFIX="${PREFIX}" DESTDIR=${SRC} || exit 1
|
2015-03-11 14:28:39 +00:00
|
|
|
if [ -d "${SRC}" ]; then
|
|
|
|
(
|
|
|
|
cd ${SRC} && \
|
2015-06-17 02:59:01 +00:00
|
|
|
find . | cpio -o --format odc | gzip -c > "${DST}/Payload"
|
2015-03-11 14:28:39 +00:00
|
|
|
)
|
|
|
|
mkbom ${SRC} "${DST}/Bom"
|
|
|
|
# Repackage
|
|
|
|
pkgutil --flatten "${DST}" "${DST}/../radare2-${VERSION}.pkg"
|
|
|
|
else
|
|
|
|
echo "Failed install. DESTDIR is empty"
|
|
|
|
exit 1
|
|
|
|
fi
|