From 2920a7bc45bc8ec3c3e46dbe0f6610cef60fe6b9 Mon Sep 17 00:00:00 2001 From: Daniel Collins Date: Wed, 23 Oct 2024 15:53:54 +0100 Subject: [PATCH] Fix issues when building via the chroot_build.sh script. - Remove dependency on sudo when already running as root - not available in all environments. - Remove unnecessary use of `find` to copy build artifacts as build-runtime.sh already puts them in a known place and the find command chokes under the current Ubuntu kernel while iterating over the /proc/ filesystem. --- scripts/chroot/chroot_build.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/chroot/chroot_build.sh b/scripts/chroot/chroot_build.sh index 7c8f624..58c0565 100755 --- a/scripts/chroot/chroot_build.sh +++ b/scripts/chroot/chroot_build.sh @@ -8,6 +8,10 @@ if [ -z "${ALPINE_ARCH}" ]; then exit 2 fi +if [ "$(whoami)" = "root" ]; then + alias sudo= +fi + # build in a temporary directory # this makes sure that subsequent runs do not influence each other # also makes cleaning up easier: just dump the entire directory @@ -89,5 +93,5 @@ esac cd "$repo_root_dir" mkdir -p ./out/ -sudo find "$tempdir"/miniroot/ -type f -executable -name 'runtime' -exec cp {} "out/runtime-${appimage_arch}" \; -sudo find "$tempdir"/miniroot/ -type f -executable -name 'runtime.debug' -exec cp {} "out/runtime-${appimage_arch}.debug" \; +cp "${tempdir}/miniroot/out/runtime-${appimage_arch}" out/ +cp "${tempdir}/miniroot/out/runtime-${appimage_arch}.debug" out/