mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #38957 from ajatkj/mkimage-yum-update
mkimage yum update
This commit is contained in:
commit
d7ab8ad145
1 changed files with 14 additions and 7 deletions
|
@ -13,9 +13,9 @@ usage() {
|
||||||
$(basename $0) [OPTIONS] <name>
|
$(basename $0) [OPTIONS] <name>
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
-p "<packages>" The list of packages to install in the container.
|
-p "<packages>" The list of packages to install in the container.
|
||||||
The default is blank.
|
The default is blank. Can use multiple times.
|
||||||
-g "<groups>" The groups of packages to install in the container.
|
-g "<groups>" The groups of packages to install in the container.
|
||||||
The default is "Core".
|
The default is "Core". Can use multiple times.
|
||||||
-y <yumconf> The path to the yum config to install packages from. The
|
-y <yumconf> The path to the yum config to install packages from. The
|
||||||
default is /etc/yum.conf for Centos/RHEL and /etc/dnf/dnf.conf for Fedora
|
default is /etc/yum.conf for Centos/RHEL and /etc/dnf/dnf.conf for Fedora
|
||||||
-t <tag> Specify Tag information.
|
-t <tag> Specify Tag information.
|
||||||
|
@ -30,7 +30,9 @@ if [ -f /etc/dnf/dnf.conf ] && command -v dnf &> /dev/null; then
|
||||||
yum_config=/etc/dnf/dnf.conf
|
yum_config=/etc/dnf/dnf.conf
|
||||||
alias yum=dnf
|
alias yum=dnf
|
||||||
fi
|
fi
|
||||||
install_groups="Core"
|
# for names with spaces, use double quotes (") as install_groups=('Core' '"Compute Node"')
|
||||||
|
install_groups=()
|
||||||
|
install_packages=()
|
||||||
version=
|
version=
|
||||||
while getopts ":y:p:g:t:h" opt; do
|
while getopts ":y:p:g:t:h" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
|
@ -41,10 +43,10 @@ while getopts ":y:p:g:t:h" opt; do
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
p)
|
p)
|
||||||
install_packages="$OPTARG"
|
install_packages+=("\"$OPTARG\"")
|
||||||
;;
|
;;
|
||||||
g)
|
g)
|
||||||
install_groups="$OPTARG"
|
install_groups+=("\"$OPTARG\"")
|
||||||
;;
|
;;
|
||||||
t)
|
t)
|
||||||
version="$OPTARG"
|
version="$OPTARG"
|
||||||
|
@ -62,6 +64,11 @@ if [[ -z $name ]]; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# default to Core group if not specified otherwise
|
||||||
|
if [ ${#install_groups[*]} -eq 0 ]; then
|
||||||
|
install_groups=('Core')
|
||||||
|
fi
|
||||||
|
|
||||||
target=$(mktemp -d --tmpdir $(basename $0).XXXXXX)
|
target=$(mktemp -d --tmpdir $(basename $0).XXXXXX)
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
@ -87,13 +94,13 @@ fi
|
||||||
if [[ -n "$install_groups" ]];
|
if [[ -n "$install_groups" ]];
|
||||||
then
|
then
|
||||||
yum -c "$yum_config" --installroot="$target" --releasever=/ --setopt=tsflags=nodocs \
|
yum -c "$yum_config" --installroot="$target" --releasever=/ --setopt=tsflags=nodocs \
|
||||||
--setopt=group_package_types=mandatory -y groupinstall "$install_groups"
|
--setopt=group_package_types=mandatory -y groupinstall "${install_groups[*]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$install_packages" ]];
|
if [[ -n "$install_packages" ]];
|
||||||
then
|
then
|
||||||
yum -c "$yum_config" --installroot="$target" --releasever=/ --setopt=tsflags=nodocs \
|
yum -c "$yum_config" --installroot="$target" --releasever=/ --setopt=tsflags=nodocs \
|
||||||
--setopt=group_package_types=mandatory -y install "$install_packages"
|
--setopt=group_package_types=mandatory -y install "${install_packages[*]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
yum -c "$yum_config" --installroot="$target" -y clean all
|
yum -c "$yum_config" --installroot="$target" -y clean all
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue