diff --git a/contrib/mkimage-yum.sh b/contrib/mkimage-yum.sh index 901280451b..49eeacc0cb 100755 --- a/contrib/mkimage-yum.sh +++ b/contrib/mkimage-yum.sh @@ -18,6 +18,8 @@ OPTIONS: The default is "Core". -y 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 + -t Specify Tag information. + default is reffered at /etc/{redhat,system}-release EOOPTS exit 1 } @@ -29,7 +31,8 @@ if [ -f /etc/dnf/dnf.conf ] && command -v dnf &> /dev/null; then alias yum=dnf fi install_groups="Core" -while getopts ":y:p:g:h" opt; do +version= +while getopts ":y:p:g:t:h" opt; do case $opt in y) yum_config=$OPTARG @@ -43,6 +46,9 @@ while getopts ":y:p:g:h" opt; do g) install_groups="$OPTARG" ;; + t) + version="$OPTARG" + ;; \?) echo "Invalid option: -$OPTARG" usage @@ -115,14 +121,15 @@ rm -rf "$target"/sbin/sln rm -rf "$target"/etc/ld.so.cache "$target"/var/cache/ldconfig mkdir -p --mode=0755 "$target"/var/cache/ldconfig -version= -for file in "$target"/etc/{redhat,system}-release -do - if [ -r "$file" ]; then - version="$(sed 's/^[^0-9\]*\([0-9.]\+\).*$/\1/' "$file")" - break - fi -done +if [ -z "$version" ]; then + for file in "$target"/etc/{redhat,system}-release + do + if [ -r "$file" ]; then + version="$(sed 's/^[^0-9\]*\([0-9.]\+\).*$/\1/' "$file")" + break + fi + done +fi if [ -z "$version" ]; then echo >&2 "warning: cannot autodetect OS version, using '$name' as tag"