diff --git a/functions/wrapper.sh b/functions/wrapper.sh index 6abb5909f..cadf59f72 100755 --- a/functions/wrapper.sh +++ b/functions/wrapper.sh @@ -12,15 +12,21 @@ Apt () { local CHROOT="${1}" - shift + local MODE="${2}" + shift 2 case "${LB_APT}" in apt|apt-get) - Chroot ${CHROOT} apt-get ${APT_OPTIONS} "${@}" + if [ "${MODE}" = "update" ] + then + Chroot ${CHROOT} apt-get ${APT_OPTIONS} ${APT_UPDATE_OPTIONS} ${MODE} "${@}" + else + Chroot ${CHROOT} apt-get ${APT_OPTIONS} ${MODE} "${@}" + fi ;; aptitude) - Chroot ${CHROOT} aptitude ${APTITUDE_OPTIONS} "${@}" + Chroot ${CHROOT} aptitude ${APTITUDE_OPTIONS} ${MODE} "${@}" ;; esac } diff --git a/manpages/en/lb_config.1 b/manpages/en/lb_config.1 index c51d5781e..7123e3ac9 100644 --- a/manpages/en/lb_config.1 +++ b/manpages/en/lb_config.1 @@ -23,6 +23,8 @@ [\fB\-\-apt\-secure\fR true|false] .br [\fB\-\-apt\-source\-archives\fR true|false] +.br + [\fB\-\-apt\-update\-options\fR \fIOPTION\fR|"\fIOPTIONS\fR"] .br [\fB\-\-aptitude\-options\fR \fIOPTION\fR|"\fIOPTIONS\fR"] .br @@ -256,6 +258,8 @@ defines if apt should install recommended packages automatically. By default, th defines if apt should check repository signatures. This is true by default. .IP "\fB\-\-apt\-source\-archives\fR true|false" 4 defines if deb-src entries should be included in the resulting live image's apt sources.list or not, defaults to true. +.IP "\fB\-\-apt\-update\-options\fR \fIOPTION\fR|""\fIOPTIONS\fR""" 4 +defines the default options that will be appended to 'apt update' calls that are made inside of the chroot during building of the image. Empty by default. Useful if you want to set options such as '\-\-error\-on=any'. Note that this option does not apply to aptitude calls. .IP "\fB\-\-aptitude\-options\fR \fIOPTION\fR|""\fIOPTIONS\fR""" 4 defines the default options that will be appended to every aptitude call that is made inside chroot during building of the image. By default, this is set to '\-\-assume\-yes' to allow non-interactive installation of packages. .IP "\fB\-a\fR|\fB\-\-architecture\fR \fIARCHITECTURE\fR" 4 diff --git a/scripts/build/bootstrap_archives b/scripts/build/bootstrap_archives index 3dcb032bd..db4124190 100755 --- a/scripts/build/bootstrap_archives +++ b/scripts/build/bootstrap_archives @@ -128,7 +128,7 @@ fi # Installing aptitude if [ "${LB_APT}" = "aptitude" ] && [ ! -x chroot/usr/bin/aptitude ] then - Chroot chroot "apt-get ${APT_OPTIONS} update" + Chroot chroot "apt-get ${APT_OPTIONS} ${APT_UPDATE_OPTIONS} update" Chroot chroot "apt-get ${APT_OPTIONS} install aptitude" fi @@ -143,7 +143,7 @@ Apt chroot update # Installing keyring packages if [ -n "${LB_KEYRING_PACKAGES}" ] then - Apt chroot "install ${LB_KEYRING_PACKAGES}" + Apt chroot install "${LB_KEYRING_PACKAGES}" fi rm -rf chroot/var/cache/apt/*.bin diff --git a/scripts/build/chroot_archives b/scripts/build/chroot_archives index 952fbea22..227729a90 100755 --- a/scripts/build/chroot_archives +++ b/scripts/build/chroot_archives @@ -259,7 +259,7 @@ case "${_ACTION}" in if [ "${LB_APT}" = "aptitude" ] && ! command -v aptitude >/dev/null then - Chroot chroot "apt-get ${APT_OPTIONS} update" + Chroot chroot "apt-get ${APT_OPTIONS} ${APT_UPDATE_OPTIONS} update" Chroot chroot "apt-get ${APT_OPTIONS} install aptitude" fi else # Get fresh indices @@ -277,7 +277,7 @@ case "${_ACTION}" in # Installing aptitude if [ "${LB_APT}" = "aptitude" ] && [ ! $(Chroot chroot "which aptitude") ] then - Chroot chroot "apt-get ${APT_OPTIONS} update" + Chroot chroot "apt-get ${APT_OPTIONS} ${APT_UPDATE_OPTIONS} update" Chroot chroot "apt-get ${APT_OPTIONS} install aptitude" fi diff --git a/scripts/build/config b/scripts/build/config index 680fde01e..277e3b10c 100755 --- a/scripts/build/config +++ b/scripts/build/config @@ -24,6 +24,7 @@ USAGE="${PROGRAM} [--apt apt|apt-get|aptitude]\n\ \t [--apt-recommends true|false]\n\ \t [--apt-secure true|false]\n\ \t [--apt-source-archives true|false]\n\ +\t [--apt-update-options OPTION|\"OPTIONS\"]\n\ \t [--aptitude-options OPTION|\"OPTIONS\"]\n\ \t [-a|--architecture ARCHITECTURE]\n\ \t [--archive-areas ARCHIVE_AREA|\"ARCHIVE_AREAS\"]\n\ @@ -137,7 +138,8 @@ Local_arguments () LONG_OPTIONS=" apt:,apt-http-proxy:,apt-indices:,aptitude-options:, apt-options:,apt-pipeline:,apt-recommends:,apt-secure:, - apt-source-archives:,architecture:,architectures:,archive-areas:, + apt-source-archives:,apt-update-options:,architecture:, + architectures:,archive-areas:, backports:,binary-filesystem:,binary-image:,binary-images:, bootappend-install:,bootappend-live:,bootappend-live-failsafe:, bootloader:,bootloaders:,bootstrap-qemu-arch:,bootstrap-qemu-exclude:, @@ -321,6 +323,11 @@ Local_arguments () shift 2 ;; + --apt-update-options) + APT_UPDATE_OPTIONS="${2}" + shift 2 + ;; + --aptitude-options) APTITUDE_OPTIONS="${2}" shift 2 @@ -998,6 +1005,9 @@ LB_APT_SECURE="${LB_APT_SECURE}" # Set apt/aptitude source entries in sources.list LB_APT_SOURCE_ARCHIVES="${LB_APT_SOURCE_ARCHIVES}" +# Set options that should only be used during apt updates +APT_UPDATE_OPTIONS="${APT_UPDATE_OPTIONS}" + # Control cache LB_CACHE="${LB_CACHE}"