gns3-registry/packer/alpine-linux/files/docker-apk-build
Bernhard Ehlers 69aec6bfe5 Alpine packer updates
- Ostinato .apk building script generalized to use it for any package
- Reset terminal mode using /etc/motd
2021-05-25 14:47:24 +02:00

35 lines
876 B
Bash
Executable File

#!/bin/sh
package=$1
version=$2
if [ -z "$package" ]; then
echo "Usage: docker-apk-build <package> [<alpine version>]" >&2
exit 1
fi
[ -z "$version" ] && version="latest"
mkdir -p "$package"
docker run --rm -i -v "$PWD/$package:/package" -e "package=$package" alpine:$version << 'EOF'
apk add alpine-sdk
adduser -D builder
addgroup builder abuild
mkdir -p /var/cache/distfiles
su - builder << END_OF_SU
mkdir -p .abuild
echo 'PACKAGER="GNS3 Packer <packer@gns3-registry>"' > .abuild/abuild.conf
abuild-keygen -a -n -q
git clone --depth 1 git://git.alpinelinux.org/aports
cd aports/*/"$package"
abuild -r
END_OF_SU
alpine_version=$(cat /etc/alpine-release)
alpine_version=${alpine_version%.*}
mkdir -p "/package/${alpine_version}"
cp -p /home/builder/packages/*/*/*.apk "/package/${alpine_version}"
chown -R $(stat -c '%u:%g' /package) "/package/${alpine_version}"
EOF