From 99d0125840020a6ff2a10673672e455be4f81707 Mon Sep 17 00:00:00 2001 From: Mathieu Le Marec - Pasquet Date: Sat, 12 Jul 2025 20:00:39 +0300 Subject: [PATCH] fix --- Dockerfile.squash | 4 ---- Dockerfile.squashexec | 4 ++++ helpers/cops_pkgmgr_install.sh | 2 +- helpers/up.sh | 6 ++++-- main.sh | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 Dockerfile.squashexec diff --git a/Dockerfile.squash b/Dockerfile.squash index 51485e4..6012c74 100644 --- a/Dockerfile.squash +++ b/Dockerfile.squash @@ -2,7 +2,3 @@ FROM $RSYNC AS squashed-rsync FROM $ANCESTOR AS squashed-ancestor ARG ROOTFS="/BASE_ROOTFS_TO_COPY_THAT_WONT_COLLIDE_1234567890" ARG PATH="${ROOTFS}_rsync/bin:$PATH" -SHELL ["busybox", "sh", "-c"] -RUN --mount=type=bind,from=final,target=$ROOTFS --mount=type=bind,from=squashed-rsync,target=${ROOTFS}_rsync \ -rsync -Aaz --delete ${ROOTFS}/ / --exclude=/proc --exclude=/sys --exclude=/etc/resolv.conf --exclude=/etc/hosts --exclude=$ROOTFS* --exclude=dev/shm --exclude=dev/pts --exclude=dev/mqueue -SHELL ["/bin/sh", "-c"] diff --git a/Dockerfile.squashexec b/Dockerfile.squashexec new file mode 100644 index 0000000..598dbe5 --- /dev/null +++ b/Dockerfile.squashexec @@ -0,0 +1,4 @@ +SHELL ["busybox", "sh", "-c"] +RUN --mount=type=bind,from=final,target=$ROOTFS --mount=type=bind,from=squashed-rsync,target=${ROOTFS}_rsync \ +rsync -Aaz --delete ${ROOTFS}/ / --exclude=/proc --exclude=/sys --exclude=/etc/resolv.conf --exclude=/etc/hosts --exclude=$ROOTFS* --exclude=dev/shm --exclude=dev/pts --exclude=dev/mqueue +SHELL ["/bin/sh", "-c"] diff --git a/helpers/cops_pkgmgr_install.sh b/helpers/cops_pkgmgr_install.sh index b6f5460..682fabb 100755 --- a/helpers/cops_pkgmgr_install.sh +++ b/helpers/cops_pkgmgr_install.sh @@ -277,7 +277,7 @@ is_debian_like() { echo $DISTRIB_ID | grep -E -iq "debian|ubuntu|mint"; } is_suse_like() { echo $DISTRIB_ID | grep -E -iq "suse"; } is_alpine_like() { echo $DISTRIB_ID | grep -E -iq "alpine" || test -e /etc/alpine-release; } is_redhat_like() { echo $DISTRIB_ID \ - | grep -E -iq "((^ol$)|rhel|redhat|red-hat|centos|fedora)"; } + | grep -E -iq "((^ol$)|rhel|redhat|red-hat|centos|fedora|amzn)"; } set_lang() { locale=${1:-C};export LANG=${locale};export LC_ALL=${locale}; } is_darwin () { if [ "x${FORCE_DARWIN-}" != "x" ];then return 0;fi diff --git a/helpers/up.sh b/helpers/up.sh index 69c27fb..577201d 100755 --- a/helpers/up.sh +++ b/helpers/up.sh @@ -85,8 +85,10 @@ if ( grep -q amzn /etc/os-release );then if ( amazon-linux-extras help >/dev/null 2>&1 );then amazon-linux-extras install -y epel else - yum install -y epel-release - yum-config-manager --enable epel + if ( yum list | grep -q epel );then + yum install -y epel-release + yum-config-manager --enable epel + fi fi fi if [ -e /etc/redhat-release ];then diff --git a/main.sh b/main.sh index c362f5e..4bec541 100755 --- a/main.sh +++ b/main.sh @@ -465,7 +465,7 @@ gen_image() { if [ -e "$df" ];then dockerfiles="$dockerfiles $df" && break;fi done local parts="" - for partsstep in squashpre from args argspost helpers pre base post postextra clean cleanpost predosquash squash postdosquash extra labels labelspost;do + for partsstep in squashpre from args argspost helpers pre base post postextra clean cleanpost predosquash squash squashpreexec squashexec postdosquash extra labels labelspost;do parts="$parts pre_${partsstep} ${partsstep} post_${partsstep}" done parts=$(echo "$parts"|xargs)