summaryrefslogtreecommitdiff
path: root/package.sh
diff options
context:
space:
mode:
Diffstat (limited to 'package.sh')
-rwxr-xr-xpackage.sh31
1 files changed, 30 insertions, 1 deletions
diff --git a/package.sh b/package.sh
index 6781b1538..74c838e16 100755
--- a/package.sh
+++ b/package.sh
@@ -2,6 +2,11 @@
set -e
shopt -s extglob nullglob
+if [[ $# == 0 ]]; then
+ echo "usage: $0 <package>"
+ exit
+fi
+
export PKG_MAKE=$0
export PKG_NAME=${1%_}
@@ -12,5 +17,29 @@ export PKG_BASE=$(realpath "$(dirname "$0")")
pkg: mkdir -p /DEBIAN
./control.sh "${PKG_NAME}" control >"$(pkg_ /DEBIAN/control)"
-dpkg-deb -b "${PKG_DEST}" "${PKG_PACK}"
+
+export PKG_HASH=$(util/catdir.sh "${PKG_DEST}" | md5sum | cut -d ' ' -f 1)
+echo "hashed dest ${PKG_NAME} to: ${PKG_HASH}"
+
+if [[ -e "${PKG_STAT}/dest-md5" && ${PKG_HASH} == $(cat "${PKG_STAT}/dest-md5" 2>/dev/null) ]]; then
+ echo "skipping re-package of ${PKG_NAME}"
+else
+ export PKG_RVSN=$(cat "${PKG_STAT}/dest-ver")
+ if [[ -z ${PKG_RVSN} ]]; then
+ PKG_RVSN=1
+ else
+ PKG_RVSN=$((${PKG_RVSN} + 1))
+ fi
+
+ export PKG_PACK=${PKG_BASE}/debs/${PKG_NAME}_${PKG_VRSN}-${PKG_RVSN}_darwin-arm.deb
+ if [[ -e ${PKG_PACK} ]]; then
+ echo "package ${PKG_PACK} already exists..."
+ else
+ ./control.sh "${PKG_NAME}" control "${PKG_VRSN}-${PKG_RVSN}" >"$(pkg_ /DEBIAN/control)"
+ dpkg-deb -b "${PKG_DEST}" "${PKG_PACK}"
+ echo "${PKG_HASH}" >"${PKG_STAT}/dest-md5"
+ echo "${PKG_RVSN}" >"${PKG_STAT}/dest-ver"
+ fi
+fi
+
pkg: rm -rf /DEBIAN