From d562390407eec6ecc83a9f19635258fbe83b6695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sun, 14 Oct 2018 17:31:02 +0200 Subject: alpine: move it to templates and try to add qemu support --- templates/alpine.conf | 2 ++ templates/alpine.run | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 templates/alpine.conf create mode 100755 templates/alpine.run (limited to 'templates') diff --git a/templates/alpine.conf b/templates/alpine.conf new file mode 100644 index 0000000..4c3a13f --- /dev/null +++ b/templates/alpine.conf @@ -0,0 +1,2 @@ +TAGS=heavy +TIMEOUT=3600 diff --git a/templates/alpine.run b/templates/alpine.run new file mode 100755 index 0000000..0e11b12 --- /dev/null +++ b/templates/alpine.run @@ -0,0 +1,77 @@ +#!/bin/sh +# vim: ft=sh +. "$(dirname "$(readlink -f "$0")")/../job.common" + +# Lock for execution +if [ "$1" != "--locked" ]; then + flock --exclusive "$WORKSPACE/root.lock" "$0" "$@" --locked + exit +fi + +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.8.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 <