From 64fb1fc344872679a867a4fc1c3fee8b871364a9 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 31 Oct 2023 15:01:53 +0100 Subject: [PATCH] Move all the config file and scripts into conf/ folder. Use single COPY command for all. --- build.containerfile | 11 ++++++----- .../etc/apt/preferences.d/local-pkgs | 0 .../etc/apt/sources.list.d/debian-src.sources | 0 .../etc/apt/sources.list.d/local-pkgs.list | 0 pkgs => conf/tmp/pkgs | 0 setup_native => conf/tmp/setup_native | 0 build => conf/usr/local/bin/build | 0 build_archdep => conf/usr/local/bin/build_archdep | 0 build_indep => conf/usr/local/bin/build_indep | 0 build_source => conf/usr/local/bin/build_source | 0 crossbuild.containerfile | 14 +++++++------- mini_sudo.c => misc/mini_sudo.c | 0 12 files changed, 13 insertions(+), 12 deletions(-) rename local-pkgs => conf/etc/apt/preferences.d/local-pkgs (100%) rename debian-src.sources => conf/etc/apt/sources.list.d/debian-src.sources (100%) rename local-pkgs.list => conf/etc/apt/sources.list.d/local-pkgs.list (100%) rename pkgs => conf/tmp/pkgs (100%) rename setup_native => conf/tmp/setup_native (100%) rename build => conf/usr/local/bin/build (100%) rename build_archdep => conf/usr/local/bin/build_archdep (100%) rename build_indep => conf/usr/local/bin/build_indep (100%) rename build_source => conf/usr/local/bin/build_source (100%) rename mini_sudo.c => misc/mini_sudo.c (100%) diff --git a/build.containerfile b/build.containerfile index 63da734..c13bbfa 100755 --- a/build.containerfile +++ b/build.containerfile @@ -5,7 +5,7 @@ ARG arch=amd64 # Stage 1: Build and install mini_sudo FROM $arch/$image AS mini_sudo WORKDIR /tmp -COPY mini_sudo.c ./ +COPY misc/mini_sudo.c ./ RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install \ --no-install-recommends -y gcc libc-dev \ @@ -17,14 +17,15 @@ FROM $arch/$image WORKDIR /tmp # Copy repository configration files for apt -COPY debian-src.sources local-pkgs.list /etc/apt/sources.list.d/ -COPY local-pkgs /etc/apt/preferences.d/ +COPY conf/ / +#COPY debian-src.sources local-pkgs.list /etc/apt/sources.list.d/ +#COPY local-pkgs /etc/apt/preferences.d/ # Create a directory for local packages and touch the Packages file RUN mkdir /pkgs && touch /pkgs/Packages # Copy the package list file -COPY pkgs ./ +#COPY pkgs ./ # Install packages from pkgs list and mark them as held, test gcc and cleanup RUN apt-get update \ @@ -38,7 +39,7 @@ RUN apt-get update \ && find /tmp -mindepth 1 -delete # Copy the build scripts to /usr/local/bin -COPY build_source build_indep build_archdep build /usr/local/bin/ +#COPY build_source build_indep build_archdep build /usr/local/bin/ # Copy mini_sudo from stage 1 COPY --from=mini_sudo /usr/local/bin/sudo /usr/local/bin/sudo diff --git a/local-pkgs b/conf/etc/apt/preferences.d/local-pkgs similarity index 100% rename from local-pkgs rename to conf/etc/apt/preferences.d/local-pkgs diff --git a/debian-src.sources b/conf/etc/apt/sources.list.d/debian-src.sources similarity index 100% rename from debian-src.sources rename to conf/etc/apt/sources.list.d/debian-src.sources diff --git a/local-pkgs.list b/conf/etc/apt/sources.list.d/local-pkgs.list similarity index 100% rename from local-pkgs.list rename to conf/etc/apt/sources.list.d/local-pkgs.list diff --git a/pkgs b/conf/tmp/pkgs similarity index 100% rename from pkgs rename to conf/tmp/pkgs diff --git a/setup_native b/conf/tmp/setup_native similarity index 100% rename from setup_native rename to conf/tmp/setup_native diff --git a/build b/conf/usr/local/bin/build similarity index 100% rename from build rename to conf/usr/local/bin/build diff --git a/build_archdep b/conf/usr/local/bin/build_archdep similarity index 100% rename from build_archdep rename to conf/usr/local/bin/build_archdep diff --git a/build_indep b/conf/usr/local/bin/build_indep similarity index 100% rename from build_indep rename to conf/usr/local/bin/build_indep diff --git a/build_source b/conf/usr/local/bin/build_source similarity index 100% rename from build_source rename to conf/usr/local/bin/build_source diff --git a/crossbuild.containerfile b/crossbuild.containerfile index 0d231e6..8c2da32 100644 --- a/crossbuild.containerfile +++ b/crossbuild.containerfile @@ -6,7 +6,7 @@ ARG target_arch=arm64v8 # Stage 1: Build and install mini_sudo FROM $native_arch/$image AS mini_sudo WORKDIR /tmp -COPY mini_sudo.c ./ +COPY conf/ / RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install \ --no-install-recommends -y gcc libc-dev \ @@ -17,7 +17,7 @@ RUN apt-get update \ FROM $native_arch/$image AS native ARG gnu_arch=aarch64 WORKDIR /tmp -COPY pkgs setup_native ./ +#COPY pkgs setup_native ./ RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install \ --no-install-recommends -y bbe patchelf \ @@ -30,11 +30,11 @@ FROM $target_arch/$image WORKDIR /tmp # Copy repository configration files for apt -COPY debian-src.sources local-pkgs.list /etc/apt/sources.list.d/ -COPY local-pkgs /etc/apt/preferences.d/ +#COPY debian-src.sources local-pkgs.list /etc/apt/sources.list.d/ +#COPY local-pkgs /etc/apt/preferences.d/ # Install packages from pkgs list and mark them as held, test gcc -COPY pkgs ./ +i#COPY pkgs ./ RUN mkdir /pkgs \ && touch /pkgs/Packages \ && apt-get update \ @@ -51,14 +51,14 @@ RUN mkdir /pkgs \ COPY --from=native /native /native # Copy setup_native script and execute it -COPY setup_native ./ +#COPY setup_native ./ RUN [ "/native/bash", "-c", "PATH=/native:$PATH ./setup_native import $(awk '{ print $1 }' pkgs)" ] # Clean up /tmp RUN find /tmp -mindepth 1 -delete # Copy the build scripts to /usr/local/bin -COPY build_source build_indep build_archdep build /usr/local/bin/ +#COPY build_source build_indep build_archdep build /usr/local/bin/ # Copy mini_sudo from stage 1 COPY --from=mini_sudo /usr/local/bin/sudo /usr/local/bin/sudo diff --git a/mini_sudo.c b/misc/mini_sudo.c similarity index 100% rename from mini_sudo.c rename to misc/mini_sudo.c