Add new option to specify tag information

Previously, tag information automatically is added from
/etc/{redhat,system}-release in image (target directory).

But I want to specify any tag informtion when using mkimage-yum.sh.
Because a Linux distribution based RHEL (It's Asianux Server) uses
SPn notation (e.g. SP3) instead of period notaion (e.g. 7.6).

Signed-off-by: Noriki Nakamura <noriki.nakamura@miraclelinux.com>
This commit is contained in:
Noriki Nakamura 2019-03-01 19:27:02 +09:00
parent 9c83848fc9
commit 57c2228cc1

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"