From db8ea819cba2c52394ca5265c225eb68579161fe Mon Sep 17 00:00:00 2001 From: Mario Voigt Date: Sat, 15 Mar 2025 14:53:11 +0100 Subject: [PATCH] more convenient build scripts for debian --- debian/create-packages.sh | 8 ++++++++ debian/install-requirements.sh | 30 ++++++++++++++++-------------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/debian/create-packages.sh b/debian/create-packages.sh index 81c7a40..812c524 100755 --- a/debian/create-packages.sh +++ b/debian/create-packages.sh @@ -108,6 +108,14 @@ for ARCH_L in "${!ARCHES_LR[@]}"; do # - some environment vars (ARCH_LINUX, ARCH_RUST, required by the debian packager) sudo podman run --replace -d --tty --interactive -v ${SRCDIR}:/srcdir -v ${DOWNLOAD}:/download -e ARCH_LINUX=${ARCH_L} -e ARCH_RUST=${ARCH_R} --name fabinfra_deb_${ARCH_L} --platform linux/${ARCH_D} localhost/fabinfra/debianpackage_${ARCH_D} + #test the container + sudo podman exec -u 0 --tty --interactive fabinfra_deb_${ARCH_L} bash -c "echo" + if [ $? -ne 0 ]; then + echo -e "Error creating or attaching to container 'fabinfra_deb_"${ARCH_L}"'. You might need to re-run 'install-requirements.sh'." + sudo podman logs fabinfra_deb_${ARCH_L} + exit 1 + fi + # now attach to that container and start building the packages #sudo podman exec -u 0 --tty --interactive fabinfra_deb_${ARCH_L} bash sudo podman exec -u 0 --tty --interactive fabinfra_deb_${ARCH_L} bash -c " diff --git a/debian/install-requirements.sh b/debian/install-requirements.sh index 988e339..7db70b0 100755 --- a/debian/install-requirements.sh +++ b/debian/install-requirements.sh @@ -12,22 +12,24 @@ sudo systemctl daemon-reload # Please note: we need to install these images as root user! pack="fabinfra/debianpackage" -arch="arm64/v8" -echo -e "\n+++++++++++++++++++++++++++++++++++++++++++" -echo -e "creating local podman container registry $pack. This may take a while ..." -echo -e "+++++++++++++++++++++++++++++++++++++++++++\n" -sudo time podman build --platform=linux/${arch} -f Dockerfile -t ${pack}_${arch} #this should get ubuntu:noble - -arch="arm/v7" -echo -e "\n+++++++++++++++++++++++++++++++++++++++++++" -echo -e "creating local podman container registry $pack. This may take a while ..." -echo -e "+++++++++++++++++++++++++++++++++++++++++++\n" -sudo time podman build --platform=linux/${arch} -f Dockerfile -t ${pack}_${arch} #this should get alpine:latest +echo -e "\n\nThis script will (re)-create podman images for bffh builds. This may take a lot of time.\n\n" +read -p "Do you really want to continue? y/n?" -n 1 -r +echo +if [[ $REPLY =~ ^[Yy]$ ]]; then + for arch in arm64/v8 arm/v7; do + sudo podman image rm localhost/${pack}_${arch} --force + echo -e "\n+++++++++++++++++++++++++++++++++++++++++++" + echo -e "creating local podman container registry for ${pack}_${arch}. This may take a while ..." + echo -e "++++++++++++++++++++++++++++++++++++++++++\n" + sudo time podman build --platform=linux/${arch} -f Dockerfile -t ${pack}_${arch} #this should get ubuntu:noble + if [ $? != 0 ]; then + echo -e "\nBuild did no finish. Probably you got an error like 'container process (missing dynamic library?)'. In this case a system restart should fix!" + fi + done echo -e "\n+++++++++++++++++++++++++++++++++++++++++++" echo "listing installed images ..." echo -e "+++++++++++++++++++++++++++++++++++++++++++\n" -sudo podman images | grep localhost/fabinfra/ -# note: unrequired images can be removed again by: -# sudo su && podman image rm localhost/fabinfra/ +PACK=${pack} sudo podman images | grep localhost/$PACK +fi