#!/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 # TODO get latest uri from latest-releases.yml file echo_stage "Setting up new root" wget "http://dl-cdn.alpinelinux.org/alpine/edge/releases/$ARCH/alpine-minirootfs-3.9.0-$ARCH.tar.gz" -O alpine.tar.gz # TODO verify signature gunzip alpine.tar.gz # tar is not able to change compressed files tar -f alpine.tar --delete ./dev/null mkdir "$ROOT" uroot tar -xf 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 <