Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/.gitlab/ci/build-inside-vm.sh
diff options
context:
space:
mode:
authorDavid Runge <dvzrv@archlinux.org>2021-01-31 16:23:04 +0100
committerDavid Runge <dvzrv@archlinux.org>2021-01-31 16:23:04 +0100
commit07239499a6cf8b731e1c06cca11e2b951c07a7e5 (patch)
tree269bd121bb18686456c644ad83dd028fc1666568 /.gitlab/ci/build-inside-vm.sh
parentf9a7b206a58a353eac2d26b464068cfe15f5e461 (diff)
Add scripts for continuous integration
.gitlab/ci/build-host.sh: Add script to be run in a container with access to qemu. It is a slight modification of arch-boxes' build-host.sh script to cater to the specific archiso requirements. .gitlab/ci/build-inside-vm.sh: Add script to be run in virtualized environment, established by build-host.sh. This script builds the actual archiso profiles and creates checksum for the resulting image files.
Diffstat (limited to '.gitlab/ci/build-inside-vm.sh')
-rwxr-xr-x.gitlab/ci/build-inside-vm.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/.gitlab/ci/build-inside-vm.sh b/.gitlab/ci/build-inside-vm.sh
new file mode 100755
index 0000000..dbaadea
--- /dev/null
+++ b/.gitlab/ci/build-inside-vm.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+#
+# This script is run within a virtual environment to build the available archiso profiles and create checksum files for
+# the resulting images.
+# The script needs to be run as root and assumes $PWD to be the root of the repository.
+
+readonly orig_pwd="${PWD}"
+readonly output="${orig_pwd}/output"
+readonly tmpdir="$(mktemp --dry-run --directory --tmpdir="${orig_pwd}/tmp")"
+
+cleanup() {
+ # clean up temporary directories
+ if [ -n "${tmpdir:-}" ]; then
+ rm -rf "${tmpdir}"
+ fi
+}
+
+create_checksums() {
+ # create checksums for a file
+ # $1: a file
+ sha256sum "${1}" >"${1}.sha256"
+ sha512sum "${1}" >"${1}.sha512"
+ b2sum "${1}" >"${1}.b2"
+ if [ -n "${SUDO_UID:-}" ]; then
+ chown "${SUDO_UID}:${SUDO_GID}" "${1}"{,.b2,.sha{256,512}}
+ fi
+}
+
+run_mkarchiso() {
+ # run mkarchiso
+ # $1: template name
+ mkdir -p "${output}/${1}" "${tmpdir}/${1}"
+ ./archiso/mkarchiso -o "${output}/${1}" -w "${tmpdir}/${1}" -v "configs/${1}"
+ create_checksums "${output}/${1}/"*.iso
+}
+
+trap cleanup EXIT
+
+run_mkarchiso "${1}"