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
Executable File

#!/usr/bin/env zsh
# 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 * | \
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
abuild-sign -q control.tar.gz || exit 1
echo "Create $apk"
cat control.tar.gz data.tar.gz > $apk