#!/bin/sh # vim: ft=sh . "$(dirname "$(readlink -f "$0")")/../job.common" # Lock for execution if [ "$1" != "--locked" ]; then exec flock --exclusive "$WORKSPACE/root.lock" "$0" --locked "$@" fi shift # Shift --locked if [ -n "$CLEAN_ROOT" ]; then echo_stage "Remove root" uroot rm -rf "$WORKSPACE/root" fi if [ -n "$CLEAN" ]; then echo_stage "Remove packages" uroot rm -rf "$WORKSPACE/packages" echo_stage "Remove distfiles" uroot rm -rf "$WORKSPACE/distfiles" fi [ -n "$ARCH" ] || echo_fail "Variable ARCH has to be defined in configuration for job." export ROOT="$WORKSPACE/root" export MOUNT="$TWORKSPACE/distfiles:/var/cache/distfiles $WORKSPACE/packages:/build/packages" mkdir -p "$TWORKSPACE/distfiles" "$WORKSPACE/packages" if [ ! -d "$ROOT" ]; then # Prepare new root if there is none rootfs="$(curl http://dl-cdn.alpinelinux.org/alpine/edge/releases/x86_64/latest-releases.yaml | \ yq -r 'map(select(.flavor == "alpine-minirootfs")) | .[0].file')" echo_stage "Setting up new root" wget "http://dl-cdn.alpinelinux.org/alpine/edge/releases/$ARCH/$rootfs" -O alpine.tar.gz # TODO verify signature mkdir "$ROOT" uroot tar -xzf alpine.tar -C "$ROOT" chmod 755 "$ROOT" # This is intentional, tar changes access rights MOUNT="" uchroot root < .abuild/abuild.conf' EOF uroot cp ~/alpinelinux.rsa.key "$ROOT/build/.abuild/cynerd@email.cz-5b8aeb6d.rsa" uroot cp ~/alpinelinux.rsa.key.pub "$ROOT/etc/apk/keys/cynerd@email.cz-5b8aeb6d.rsa.pub" uchroot root <