You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

36 lines
734 B

#!/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