forked from nowsecure/fsmon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pkg.sh
executable file
·48 lines (42 loc) · 1.25 KB
/
pkg.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
#!/bin/sh
# based on
# http://blog.coolaj86.com/articles/how-to-unpackage-and-repackage-pkg-osx.html
# to uninstall:
# sudo pkgutil --forget com.nowsecure.fsmon
DESTDIR=/tmp/fsmon_pkg
PREFIX=/usr/local
PKGDIR="$(pwd)/fsmon.unpkg"
[ -z "${VERSION}" ] && VERSION=1.4
[ -z "${MAKE}" ] && MAKE=make
VERSION=1.4
rm -rf "${DESTDIR}"
${MAKE} clean
make || exit 1
${MAKE} install PREFIX="${PREFIX}" DESTDIR=${DESTDIR} || exit 1
rm -rf "${PKGDIR}"
mkdir -p "${PKGDIR}"
cat > "${PKGDIR}/PackageInfo" << EOF
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<pkg-info overwrite-permissions="true" relocatable="false" identifier="com.nowsecure.fsmon" postinstall-action="none" version="0" format-version="2" generator-version="InstallCmds-237 (11E53)" auth="root">
<payload numberOfFiles="2" installKBytes="31"/>
<bundle-version/>
<upgrade-bundle/>
<update-bundle/>
<atomic-update-bundle/>
<strict-identifier/>
<relocate/>
</pkg-info>
EOF
if [ -d "${DESTDIR}" ]; then
(
cd "${DESTDIR}" && \
find . | cpio -o --format odc | gzip -c > "${PKGDIR}/Payload"
)
mkbom "${DESTDIR}" "${PKGDIR}/Bom"
pkgutil --flatten "${PKGDIR}" "fsmon-${VERSION}.pkg"
rm -rf "${DESTDIR}"
rm -rf "${PKGDIR}"
else
echo "Failed install. DESTDIR is empty"
exit 1
fi