Merge pull request #38820 from bynnchapu/mkimage-yum_add-new-tag-option

Add new option to specify tag information to mkimage-yum.sh
This commit is contained in:
Tianon Gravi 2019-03-05 16:23:16 -08:00 committed by GitHub
commit 5a7d6dcf21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,6 +18,8 @@ OPTIONS:
The default is "Core".
-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
-t <tag> 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"