Add option to skip update packages

in same cases it is required to avoid update all existing packages,
doing so can result in release update which is currently not possible
unless you not include "base" element.

"base" element used for most distribution (rhel, debain), and is
necessary for most cloud operations, this patch add 
"DIB_AVOID_PACKAGES_UPDATE" parameter to skip updating all packages.

usecases for this patch can be:
 * Avoid release update when building old release ex. RHEL7.5.
 * build on network-less environment.

usage:
DIB_AVOID_PACKAGES_UPDATE=1

or
DIB_AVOID_PACKAGES_UPDATE=0

Change-Id: I71192b23c8f0bc48b348fe7377bf8a2399b53792
This commit is contained in:
Noam Angel 2019-02-10 14:07:06 +00:00
parent 25ba034a0e
commit 8b83196024
3 changed files with 12 additions and 1 deletions

View File

@ -20,6 +20,14 @@ customize cloud-init's management of `/etc/hosts`:
preserve diskimage-builder's current default behavior in the
future, set the variable to "localhost" explicitly.)
The 'DIB_AVOID_PACKAGES_UPDATE' environment variable can be used to
avoid updating all packages, useful when wanting to avoid release
update.
* 'DIB_AVOID_PACKAGES_UPDATE' default is '0', all packages will be updated.
* set 'DIB_AVOID_PACKAGES_UPDATE' to '1' to avoid updating all packages.
Notes:
* If you are getting warnings during the build about your locale

View File

@ -0,0 +1 @@
export DIB_AVOID_PACKAGES_UPDATE=${DIB_AVOID_PACKAGES_UPDATE:-0}

View File

@ -8,4 +8,6 @@ fi
set -eu
set -o pipefail
install-packages -u
if [ ${DIB_AVOID_PACKAGES_UPDATE} -eq 0 ]; then
install-packages -u
fi