Obsolete
/
packaging
Archived
3
0
Fork 0
This repository has been archived on 2022-01-17. You can view files and clone it, but cannot push or open issues/pull-requests.
packaging/assemble-apk.sh

36 lines
734 B
Bash
Raw Normal View History

2019-07-30 20:08:17 +02:00
#!/usr/bin/env zsh
2019-07-03 05:23:48 +02:00
# This script transforms the current directory into a full-blown apk package.
# It still requires a .PKGINFO file though.
set -e
# Output package name.
apk="$1"
# data.tar.gz
echo "Compressing data..."
set -- *
tar --xattrs -f - -c * | \
2019-07-03 05:23:48 +02:00
abuild-tar --hash | \
gzip -9 > data.tar.gz
echo "Create checksum..."
# append the hash for data.tar.gz
local sha256=$(sha256sum data.tar.gz | cut -f1 -d' ')
echo "datahash = $sha256" >> .PKGINFO
# control.tar.gz
cd "$dir"
metafiles=.PKGINFO
[ -f .metafiles ] && metafiles=$(cat .metafiles)
tar -f - -c ${metafiles[@]} | abuild-tar --cut \
| gzip -9 > control.tar.gz
2019-08-25 17:32:55 +02:00
abuild-sign -q control.tar.gz || exit 1
2019-07-03 05:23:48 +02:00
echo "Create $apk"
cat control.tar.gz data.tar.gz > $apk