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:
commit
5a7d6dcf21
1 changed files with 16 additions and 9 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Reference in a new issue