diff options
author | Karel Kočí <cynerd@email.cz> | 2018-10-14 17:31:02 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2018-10-14 20:59:19 +0200 |
commit | d562390407eec6ecc83a9f19635258fbe83b6695 (patch) | |
tree | 922364534f2a031f8b76cc67229c287016ed5c1a /templates | |
parent | 4ddbc0c658e65fb14f4c22b63fff2e56032ccf7f (diff) | |
download | laminar-cnf-d562390407eec6ecc83a9f19635258fbe83b6695.tar.gz laminar-cnf-d562390407eec6ecc83a9f19635258fbe83b6695.tar.bz2 laminar-cnf-d562390407eec6ecc83a9f19635258fbe83b6695.zip |
alpine: move it to templates and try to add qemu support
Diffstat (limited to 'templates')
-rw-r--r-- | templates/alpine.conf | 2 | ||||
-rwxr-xr-x | templates/alpine.run | 77 |
2 files changed, 79 insertions, 0 deletions
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 <<EOF + set -e + apk update + apk add alpine-sdk lua-aports + adduser -s /bin/sh -D -h /build build + addgroup build abuild + su -l build -c 'mkdir .abuild aports packages' + su -l build -c 'echo "PACKAGER_PRIVKEY=\"/build/.abuild/cynerd@email.cz-5b8aeb6d.rsa\"" > .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 <<EOF + set -e + chgrp abuild /var/cache/distfiles + chmod g+w /var/cache/distfiles + chown build:build /build/packages + chown build:build "/build/.abuild/cynerd@email.cz-5b8aeb6d.rsa" +EOF +fi + +echo_stage "Update system" +uchroot root 'apk update && apk upgrade' + +echo_stage "Get packages source" +git_clone "git@cynerd.cz:alpine-personal-pkgs" "$ROOT/pkgs" +uchroot root "rm -rf /build/aports/personal && chown -R build:build /pkgs && mv /pkgs /build/aports/personal" + +echo_stage "Build packages" +uroot cp "$FILES/alpine/abuild.conf" "$ROOT/etc/abuild.conf" +uchroot build 'buildrepo --purge personal' + +echo_stage "Deploy" +ssh upload rm -rf "deploy-alpine" +scp -r "$WORKSPACE/packages/personal" upload:deploy-alpine +ssh upload /bin/sh -e <<EOF + rm -rf /var/www/repo/alpine + mv deploy-alpine /var/www/repo/alpine +EOF +scp "$FILES"/alpine/setup.sh{,.gpg} upload:/var/www/repo/alpine/ |