From 9719e0b772eac7a38e203f4b735e56287edba0ce Mon Sep 17 00:00:00 2001 From: Arturo Rinaldi Date: Sun, 24 Jan 2021 17:38:33 +0100 Subject: [PATCH] adding remove and purge macros for APT packages --- README.md | 6 ++++++ build.sh | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/README.md b/README.md index 8b7f875af5..0d349a8b63 100644 --- a/README.md +++ b/README.md @@ -192,6 +192,12 @@ The following process is followed to build images: - **00-packages-nr** - As 00-packages, except these will be installed using the ```--no-install-recommends -y``` parameters to apt-get. + - **00-packages-rm** - As 00-packages, except these will be removed using + the ```remove -y``` parameters to apt-get. + + - **00-packages-pr** - As 00-packages, except these will be purged using + the ```purge -y``` parameters to apt-get. + - **00-patches** - A directory containing patch files to be applied, using quilt. If a file named 'EDIT' is present in the directory, the build process will be interrupted with a bash session, allowing an opportunity to create/revise diff --git a/build.sh b/build.sh index 6f720b1f50..0401489d1d 100755 --- a/build.sh +++ b/build.sh @@ -35,6 +35,27 @@ EOF fi log "End ${SUB_STAGE_DIR}/${i}-packages" fi + if [ -f "${i}-packages-rm" ]; then + log "Begin ${SUB_STAGE_DIR}/${i}-packages-rm" + PACKAGES="$(sed -f "${SCRIPT_DIR}/remove-comments.sed" < "${i}-packages-rm")" + if [ -n "$PACKAGES" ]; then + on_chroot << EOF +apt-get -o APT::Acquire::Retries=3 remove -y $PACKAGES +EOF + fi + log "End ${SUB_STAGE_DIR}/${i}-packages-rm" + fi + if [ -f "${i}-packages-pr" ]; then +Docker can be used to perform the build inside a container. This partially isolates + log "Begin ${SUB_STAGE_DIR}/${i}-packages-pr" + PACKAGES="$(sed -f "${SCRIPT_DIR}/remove-comments.sed" < "${i}-packages-pr")" + if [ -n "$PACKAGES" ]; then + on_chroot << EOF +apt-get -o APT::Acquire::Retries=3 purge -y $PACKAGES +EOF + fi + log "End ${SUB_STAGE_DIR}/${i}-packages-pr" + fi if [ -d "${i}-patches" ]; then log "Begin ${SUB_STAGE_DIR}/${i}-patches" pushd "${STAGE_WORK_DIR}" > /dev/null