Skip to content

Commit

Permalink
Merge pull request rhinstaller#1094 from rvykydal/update-rhelx-checks
Browse files Browse the repository at this point in the history
Update is_rhelX function to return 0/1 values
  • Loading branch information
rvykydal authored Mar 22, 2024
2 parents 7126161 + ff85495 commit 713e095
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 28 deletions.
5 changes: 4 additions & 1 deletion anaconda-conf.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ fi

%post --nochroot

if [[ "@KSTEST_OS_NAME@" == "rhel" ]]; then
@KSINCLUDE@ scripts-lib.sh

if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ || \
is_rhel9 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
LOG_MSG="Writing a temporary configuration loaded from"
else
LOG_MSG="Configuration loaded from:"
Expand Down
5 changes: 4 additions & 1 deletion anaconda-modules.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@

%post --nochroot

@KSINCLUDE@ scripts-lib.sh

# Get the activated Anaconda DBus modules.
cat /tmp/syslog | grep "Activating service name" | \
grep "org.fedoraproject.Anaconda.Modules" | cut -d"'" -f2 \
| sort > /tmp/generated.out

# Generate the expected output.
if [[ "@KSTEST_OS_NAME@" == "rhel" ]]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ || \
is_rhel9 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
cat > /tmp/expected.out << EOF
org.fedoraproject.Anaconda.Modules.Localization
org.fedoraproject.Anaconda.Modules.Network
Expand Down
2 changes: 1 addition & 1 deletion bindtomac-bridge-2devs-httpks.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ check_device_config_value bridge1 ONBOOT yes connection autoconnect __NONE

check_device_config_value bridge1_slave_1 ONBOOT yes connection autoconnect __NONE

if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
# RHEL-8-FAILURE: anaconda does not create default config file for enslaved device in RHEL8
check_config_exists @KSTEST_NETDEV2@ no
else
Expand Down
2 changes: 1 addition & 1 deletion bindtomac-bridge-2devs-pre.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ check_device_config_value bridge1 ONBOOT yes connection autoconnect __NONE

check_device_config_value bridge1_slave_1 ONBOOT yes connection autoconnect __NONE

if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
# RHEL-8-FAILURE: anaconda does not create default config file for enslaved device in RHEL8
check_config_exists @KSTEST_NETDEV2@ no
else
Expand Down
4 changes: 2 additions & 2 deletions bond-ks-initramfs.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ network --device bond0 --bootproto dhcp --bondslaves=@KSTEST_NETDEV1@,@KSTEST_NE
@KSINCLUDE@ post-lib-network.sh
@KSINCLUDE@ scripts-lib.sh

if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
# Ifcfg files for the kickstart configuration are created in initramfs
check_config_exists bond0 yes
check_config_exists bond0_slave_1 yes
Expand Down Expand Up @@ -61,7 +61,7 @@ check_gui_configurations @KSTEST_NETDEV1@ @KSTEST_NETDEV2@ bond0
@KSINCLUDE@ scripts-lib.sh

check_device_config_value bond0 ONBOOT yes connection autoconnect __NONE
if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
check_device_config_value bond0_slave_1 ONBOOT yes connection autoconnect __NONE
check_device_config_value bond0_slave_1 SLAVE yes connection slave-type bond
check_device_config_value bond0_slave_2 ONBOOT yes connection autoconnect __NONE
Expand Down
2 changes: 1 addition & 1 deletion bridge-2devs-httpks.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ check_device_config_value bridge1 ONBOOT yes connection autoconnect __NONE

check_device_config_value bridge1_slave_1 ONBOOT yes connection autoconnect __NONE

if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
# RHEL-8-FAILURE: anaconda does not create default config file for enslaved device in RHEL8
check_config_exists @KSTEST_NETDEV2@ no
else
Expand Down
2 changes: 1 addition & 1 deletion bridge-2devs-pre.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ check_device_config_value bridge1 ONBOOT yes connection autoconnect __NONE

check_device_config_value bridge1_slave_1 ONBOOT yes connection autoconnect __NONE

if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
# RHEL-8-FAILURE: anaconda does not create default config file for enslaved device in RHEL8
check_config_exists @KSTEST_NETDEV2@ no
else
Expand Down
2 changes: 1 addition & 1 deletion bridge-2devs.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ check_device_config_value bridge1 ONBOOT yes connection autoconnect __NONE

check_device_config_value bridge1_slave_1 ONBOOT yes connection autoconnect __NONE

if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
# RHEL-8-FAILURE: anaconda does not create default config file for enslaved device in RHEL8
check_config_exists @KSTEST_NETDEV2@ no
else
Expand Down
2 changes: 1 addition & 1 deletion bridge-no-bootopts-net.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ check_gui_configurations @KSTEST_NETDEV1@ bridge0
check_device_connected bridge0 yes
check_device_connected @KSTEST_NETDEV1@ yes

if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
# RHEL-8-FAILURE: in rhel 8 the ifcfg is generated in initramfs by Anaconda
check_device_config_value bridge0_slave_1 BRIDGE bridge0 connection master bridge0
check_device_config_value bridge0_slave_1 BRIDGE bridge0 connection slave-type bridge
Expand Down
2 changes: 1 addition & 1 deletion network-addr-gen-mode.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ check_gui_configurations @KSTEST_NETDEV1@ @KSTEST_NETDEV2@ @KSTEST_NETDEV3@ @KST
check_device_config_value @KSTEST_NETDEV1@ IPV6_ADDR_GEN_MODE eui64 ipv6 addr-gen-mode eui64
check_connection_setting "@KSTEST_NETDEV1@" ipv6.addr-gen-mode eui64
check_device_config_value @KSTEST_NETDEV2@ IPV6_ADDR_GEN_MODE __NONE ipv6 addr-gen-mode eui64
if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
# In rhel8 ifcfg from kickstart is generated in initramfs
check_connection_setting "System @KSTEST_NETDEV2@" ipv6.addr-gen-mode default-or-eui64
else
Expand Down
8 changes: 4 additions & 4 deletions network-autoconnections-dhcpall-httpks.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ shutdown
@KSINCLUDE@ scripts-lib.sh

check_config_exists @KSTEST_NETDEV1@ no
if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
check_config_exists @KSTEST_NETDEV2@ yes
else
check_config_exists @KSTEST_NETDEV2@ no
Expand All @@ -38,7 +38,7 @@ check_device_connected @KSTEST_NETDEV1@ yes
check_device_connected @KSTEST_NETDEV2@ yes
check_device_connected @KSTEST_NETDEV3@ yes

if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
check_number_of_connections 2
else
# includes "lo" connection
Expand All @@ -47,7 +47,7 @@ fi

check_connection_device "Wired Connection" @KSTEST_NETDEV1@
check_connection_device "Wired Connection" @KSTEST_NETDEV2@
if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
check_connection_device "System @KSTEST_NETDEV2@"
fi
check_connection_device "Wired Connection" @KSTEST_NETDEV3@
Expand Down Expand Up @@ -89,7 +89,7 @@ check_device_connected @KSTEST_NETDEV3@ yes
check_connection_device "Wired Connection" @KSTEST_NETDEV2@
check_connection_device @KSTEST_NETDEV2@

if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
check_number_of_connections 4
else
# includes "lo" connection
Expand Down
8 changes: 4 additions & 4 deletions network-autoconnections-httpks.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ shutdown
# check_config_exists @KSTEST_NETDEV1@ yes
check_config_exists @KSTEST_NETDEV1@ no
# In RHEL8 ifcfg files are created from kickstart already in initramfs
if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
check_config_exists @KSTEST_NETDEV2@ yes
else
check_config_exists @KSTEST_NETDEV2@ no
Expand All @@ -40,7 +40,7 @@ check_config_exists @KSTEST_NETDEV3@ no

check_device_connected @KSTEST_NETDEV1@ yes
check_connection_device @KSTEST_NETDEV1@ @KSTEST_NETDEV1@
if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
check_connection_device "System @KSTEST_NETDEV2@"
fi

Expand All @@ -53,7 +53,7 @@ check_connection_setting "@KSTEST_NETDEV1@" 802-3-ethernet.mac-address --
detect_nm_has_autoconnections_off
nm_has_autoconnections_off=$?
if [[ $nm_has_autoconnections_off -eq 0 ]]; then
if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
check_number_of_connections 2
else
# includes "lo" connection
Expand Down Expand Up @@ -103,7 +103,7 @@ detect_nm_has_autoconnections_off
nm_has_autoconnections_off=$?
if [[ $nm_has_autoconnections_off -eq 0 ]]; then
check_device_config_value @KSTEST_NETDEV3@ ONBOOT no connection autoconnect false
if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
check_number_of_connections 3
else
# includes "lo" connection
Expand Down
2 changes: 1 addition & 1 deletion network-device-mac.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ shutdown
# discoverable in sysfs yet so it picks its own name ksdevX and uses infname= to
# name the device which results in binding also to HWADDR (because of ifname=
# being used).
if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
# RHEL-8-FAILURE mac binding for ifname= is not applied when updating connection,
# fixed upstream in commit a5cb6311e22587b539248bd5d2a227d08c0bb581
check_device_config_value ksdev0 HWADDR __NONE ethernet mac-address __NONE
Expand Down
4 changes: 2 additions & 2 deletions repo-install.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ repo --name=test05 --baseurl=EMPTY_REPO_URL --includepkgs=p1,p2 --excludepkgs=p3
@KSINCLUDE@ scripts-lib.sh

# Define patterns for repo options.
if [ $(is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ] || \
[ $(is_rhel9 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@) == "yes" ]; then
if is_rhel8 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ || \
is_rhel9 @KSTEST_OS_NAME@ @KSTEST_OS_VERSION@ ; then
cost='^cost=25$'
sslverify='^sslverify=0$'
includepkgs='^includepkgs=p1,p2$'
Expand Down
10 changes: 4 additions & 6 deletions scripts-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@

# is_rhel8 KSTESTS_OS_NAME KSTESTS_OS_VERSION
# Are we testing rhel 8 (based on the name and version detected from boot.iso) ?
# Returns "yes" or "no".
function is_rhel8 {
local os_name=$1
local os_version=$2
if [ ${os_name} == "rhel" ] && [ ${os_version:0:1} == "8" ] ; then
echo "yes"
return 0
else
echo "no"
return 1
fi
}

# is_rhel9 KSTESTS_OS_NAME KSTESTS_OS_VERSION
# Are we testing rhel 9 (based on the name and version detected from boot.iso) ?
# Returns "yes" or "no".
function is_rhel9 {
local os_name=$1
local os_version=$2
if [ ${os_name} == "rhel" ] && [ ${os_version:0:1} == "9" ] ; then
echo "yes"
return 0
else
echo "no"
return 1
fi
}

0 comments on commit 713e095

Please sign in to comment.