2014-09-18 20:52:32 +08: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
|
2015-06-17 10:59:01 +08:00
|
|
|
DST="$(pwd)/sys/osx-pkg/radare2.unpkg"
|
2016-03-01 06:38:27 +08:00
|
|
|
VERSION="`./configure --version| head -n 1|awk '{print $1}'|cut -d - -f 2`"
|
|
|
|
[ -z "${VERSION}" ] && VERSION=0.10.0
|
2014-09-18 20:52:32 +08:00
|
|
|
|
2015-03-11 22:28:39 +08:00
|
|
|
rm -rf "${SRC}"
|
2014-09-18 20:52:32 +08:00
|
|
|
make mrproper
|
2015-03-11 22:28:39 +08:00
|
|
|
./configure --prefix=/usr || exit 1
|
|
|
|
make -j4 || exit 1
|
2014-09-18 20:52:32 +08:00
|
|
|
# TODO: run sys/install.sh
|
2015-03-11 22:28:39 +08:00
|
|
|
make install PREFIX=/usr DESTDIR=${SRC} || exit 1
|
|
|
|
if [ -d "${SRC}" ]; then
|
|
|
|
(
|
|
|
|
cd ${SRC} && \
|
2015-06-17 10:59:01 +08:00
|
|
|
find . | cpio -o --format odc | gzip -c > "${DST}/Payload"
|
2015-03-11 22:28:39 +08:00
|
|
|
)
|
|
|
|
mkbom ${SRC} "${DST}/Bom"
|
2014-09-18 20:52:32 +08:00
|
|
|
|
2015-03-11 22:28:39 +08:00
|
|
|
# Repackage
|
2014-09-18 20:52:32 +08:00
|
|
|
|
2015-03-11 22:28:39 +08:00
|
|
|
pkgutil --flatten "${DST}" "${DST}/../radare2-${VERSION}.pkg"
|
|
|
|
else
|
|
|
|
echo "Failed install. DESTDIR is empty"
|
|
|
|
exit 1
|
|
|
|
fi
|