]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change builder script with submethods
authorBastian Dehn <hhaalo@arcor.de>
Thu, 23 Apr 2026 15:42:22 +0000 (17:42 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Thu, 23 Apr 2026 15:42:22 +0000 (17:42 +0200)
builder/build-in-container

index b2478513fe6c355f52ef6f0f813545c349192deb..db18b3cc73d76c5492b85531fa4fbf88225bc6eb 100755 (executable)
@@ -1,26 +1,47 @@
 #!/bin/bash
 
-main()
+create_containerfile()
 {
+       local distro="$1"
        local scriptpath=$(echo $0 | xargs dirname | xargs realpath)
+
+       cat $scriptpath/Containerfile.template \
+               | sed "s/\$distro/$distro/" \
+               > build/Containerfile-$distro_postfix
+}
+
+build_container_image()
+{
+       local distro_postfix="$1"
+
+       podman build \
+               -f build/Containerfile-$distro_postfix \
+               -t sane-kds-s2000w-net-builder-$distro_postfix
+}
+
+run_builder_container()
+{
+       local distro_postfix="$1"
+
+       podman run \
+               --rm \
+               -v ./:/source \
+               -e EXTRA_VERSION=$distro_postfix \
+               sane-kds-s2000w-net-builder-$distro_postfix \
+               || return $?
+}
+
+main()
+{
        local distros="debian:bookworm debian:trixie debian:forky ubuntu:noble"
        mkdir -p build
        cp builder/run build/
 
        for distro in $distros; do
                local distro_postfix=${distro/:/-}
-               cat $scriptpath/Containerfile.template \
-                       | sed "s/\$distro/$distro/" \
-                       > build/Containerfile-$distro_postfix
-               podman build \
-                       -f build/Containerfile-$distro_postfix \
-                       -t sane-kds-s2000w-net-builder-$distro_postfix
-               podman run \
-                       --rm \
-                       -v ./:/source \
-                       -e EXTRA_VERSION=$distro_postfix \
-                       sane-kds-s2000w-net-builder-$distro_postfix \
-                       || return $?
+               create_containerfile "$distro"
+               build_container_image "$distro_postfix"
+               run_builder_container "$distro_postfix"
        done
 }