2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-12-04 08:07:04 +00:00

refactor(netboot): generate standalone image policy helpers

This commit is contained in:
Vinícius Ferrão
2026-11-24 21:34:06 -03:00
parent 21f4e45020
commit 2e574cb4cf
16 changed files with 311 additions and 124 deletions
+24
View File
@@ -51,6 +51,7 @@ our @EXPORT_OK = qw(
genesis_dists genesis_dist_reason
fips_policy_artifacts fips_policy_plan sync_fips_policy
generated_policy_plan sync_generated_policy
netboot_policy_artifacts sync_netboot_policy
package_skip_reason
);
@@ -1472,6 +1473,29 @@ sub _fips_policy_options {
command => 'build-utils/sync-fips-policy', artifacts => [fips_policy_artifacts()]);
}
sub netboot_policy_artifacts {
return map { "xCAT-server/share/xcat/netboot/$_" } qw(
rh/compute.rhels7.ppc64.postinstall
rh/compute.rhels7.x86_64.postinstall
rh/compute.rhels8.ppc64le.postinstall
rh/compute.rhels8.x86_64.postinstall
rh/compute.rhels9.ppc64le.postinstall
rh/compute.rhels9.x86_64.postinstall
rh/compute.rhels10.aarch64.postinstall
rh/compute.rhels10.ppc64le.postinstall
rh/compute.rhels10.x86_64.postinstall
rh/service.postinstall
rocky/compute.rocky10.riscv64.postinstall
);
}
sub sync_netboot_policy {
my (%args) = @_;
return sync_generated_policy(%args, label => 'netboot',
source => 'build-utils/netboot-policy.sh', command => 'build-utils/sync-netboot-policy',
artifacts => [netboot_policy_artifacts()]);
}
#-------------------------------------------------------------------------------
=head3 fips_policy_plan
+18
View File
@@ -0,0 +1,18 @@
xcat_disable_image_selinux()
{
if [ -f "$1/etc/selinux/config" ]; then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$1/etc/selinux/config"
fi
}
xcat_disable_image_firewalld()
{
for xcat_firewalld_entry in \
"$1/etc/systemd/system/multi-user.target.wants/firewalld.service" \
"$1/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
do
if [ -f "$xcat_firewalld_entry" ] || [ -L "$xcat_firewalld_entry" ]; then
rm -f "$xcat_firewalld_entry"
fi
done
}
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/perl
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/lib";
use XCAT::BuildUtils qw(sync_netboot_policy);
my $mode = shift // '';
die "Usage: $0 --check|--write\n"
unless !@ARGV && ($mode eq '--check' || $mode eq '--write');
my $result = sync_netboot_policy(root => "$FindBin::Bin/..", mode => substr($mode, 2));
warn "$_\n" for @{$result->{messages}};
exit(@{$result->{stale}} && $result->{mode} eq 'check' ? 1 : 0);
+8
View File
@@ -120,6 +120,14 @@ if (grep { $_ eq 'xCAT' || $_ eq 'xCAT-genesis-scripts' } $opts{packages}->@*) {
}
}
if (grep { $_ eq 'xCAT-server' } $opts{packages}->@*) {
my $netboot = XCAT::BuildUtils::sync_netboot_policy(root => $FindBin::Bin, mode => 'check');
if (@{$netboot->{stale}}) {
warn "$_\n" for @{$netboot->{messages}};
die "FATAL: generated netboot policy is not current\n";
}
}
my $ROOT = abs_path($FindBin::Bin);
my $VERSION = read_line("$ROOT/Version") // die "Cannot read $ROOT/Version\n";
my $EPOCH = source_date_epoch();
+8
View File
@@ -993,6 +993,14 @@ sub main {
}
}
if (grep { $_ eq 'xCAT-server' } $opts{packages}->@*) {
my $netboot = XCAT::BuildUtils::sync_netboot_policy(root => $Bin, mode => 'check');
if (@{$netboot->{stale}}) {
warn "$_\n" for @{$netboot->{messages}};
die "FATAL: generated netboot policy is not current\n";
}
}
# ---- concurrency guard (mirrors cluster-test.pl's per-cluster lock) --------------------------
# Every per-package mock chroot/config for this run shares the "<pkg>-<target><ext>" namespace:
# /etc/mock/<cfg>.cfg, /var/lib/mock/<cfg>/ and its buildroot.lock. Two builds of the SAME
@@ -35,22 +35,30 @@ END
#-- Disable SELinux in the rootimg
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
if [ -f "$installroot/etc/selinux/config" ]
then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config"
fi
# BEGIN generated netboot policy: build-utils/sync-netboot-policy --write
xcat_disable_image_selinux()
{
if [ -f "$1/etc/selinux/config" ]; then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$1/etc/selinux/config"
fi
}
xcat_disable_image_firewalld()
{
for xcat_firewalld_entry in \
"$1/etc/systemd/system/multi-user.target.wants/firewalld.service" \
"$1/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
do
if [ -f "$xcat_firewalld_entry" ] || [ -L "$xcat_firewalld_entry" ]; then
rm -f "$xcat_firewalld_entry"
fi
done
}
# END generated netboot policy
xcat_disable_image_selinux "$installroot"
#--for redhat 8 and 8.1
#-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys
FIREWALLD="$installroot/etc/systemd/system/multi-user.target.wants/firewalld.service"
if [ -f "$FIREWALLD" ] || [ -L "$FIREWALLD" ]
then
rm -f "$FIREWALLD"
fi
FIREWALLD1="$installroot/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
if [ -f "$FIREWALLD1" ] || [ -L "$FIREWALLD1" ]
then
rm -f "$FIREWALLD1"
fi
xcat_disable_image_firewalld "$installroot"
#-- Example of booted image versioning
@@ -35,23 +35,31 @@ echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab
#-- Disable SELinux in the rootimg
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
if [ -f "$installroot/etc/selinux/config" ]
then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config"
fi
# BEGIN generated netboot policy: build-utils/sync-netboot-policy --write
xcat_disable_image_selinux()
{
if [ -f "$1/etc/selinux/config" ]; then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$1/etc/selinux/config"
fi
}
xcat_disable_image_firewalld()
{
for xcat_firewalld_entry in \
"$1/etc/systemd/system/multi-user.target.wants/firewalld.service" \
"$1/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
do
if [ -f "$xcat_firewalld_entry" ] || [ -L "$xcat_firewalld_entry" ]; then
rm -f "$xcat_firewalld_entry"
fi
done
}
# END generated netboot policy
xcat_disable_image_selinux "$installroot"
#--for redhat 8 and 8.1
#-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys
FIREWALLD="$installroot/etc/systemd/system/multi-user.target.wants/firewalld.service"
if [ -f "$FIREWALLD" ] || [ -L "$FIREWALLD" ]
then
rm -f "$FIREWALLD"
fi
FIREWALLD1="$installroot/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
if [ -f "$FIREWALLD1" ] || [ -L "$FIREWALLD1" ]
then
rm -f "$FIREWALLD1"
fi
xcat_disable_image_firewalld "$installroot"
#-- Example of booted image versioning
@@ -35,22 +35,30 @@ END
#-- Disable SELinux in the rootimg
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
if [ -f "$installroot/etc/selinux/config" ]
then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config"
fi
# BEGIN generated netboot policy: build-utils/sync-netboot-policy --write
xcat_disable_image_selinux()
{
if [ -f "$1/etc/selinux/config" ]; then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$1/etc/selinux/config"
fi
}
xcat_disable_image_firewalld()
{
for xcat_firewalld_entry in \
"$1/etc/systemd/system/multi-user.target.wants/firewalld.service" \
"$1/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
do
if [ -f "$xcat_firewalld_entry" ] || [ -L "$xcat_firewalld_entry" ]; then
rm -f "$xcat_firewalld_entry"
fi
done
}
# END generated netboot policy
xcat_disable_image_selinux "$installroot"
#--for redhat 8 and 8.1
#-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys
FIREWALLD="$installroot/etc/systemd/system/multi-user.target.wants/firewalld.service"
if [ -f "$FIREWALLD" ] || [ -L "$FIREWALLD" ]
then
rm -f "$FIREWALLD"
fi
FIREWALLD1="$installroot/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
if [ -f "$FIREWALLD1" ] || [ -L "$FIREWALLD1" ]
then
rm -f "$FIREWALLD1"
fi
xcat_disable_image_firewalld "$installroot"
#-- Example of booted image versioning
@@ -35,10 +35,27 @@ echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab
#-- Disable SELinux in the rootimg
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
if [ -f "$installroot/etc/selinux/config" ]
then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config"
fi
# BEGIN generated netboot policy: build-utils/sync-netboot-policy --write
xcat_disable_image_selinux()
{
if [ -f "$1/etc/selinux/config" ]; then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$1/etc/selinux/config"
fi
}
xcat_disable_image_firewalld()
{
for xcat_firewalld_entry in \
"$1/etc/systemd/system/multi-user.target.wants/firewalld.service" \
"$1/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
do
if [ -f "$xcat_firewalld_entry" ] || [ -L "$xcat_firewalld_entry" ]; then
rm -f "$xcat_firewalld_entry"
fi
done
}
# END generated netboot policy
xcat_disable_image_selinux "$installroot"
#-- Example of booted image versioning
#-- We want to know, with what configuration (version of the image) each node was booted.
@@ -35,10 +35,27 @@ END
#-- Disable SELinux in the rootimg
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
if [ -f "$installroot/etc/selinux/config" ]
then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config"
fi
# BEGIN generated netboot policy: build-utils/sync-netboot-policy --write
xcat_disable_image_selinux()
{
if [ -f "$1/etc/selinux/config" ]; then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$1/etc/selinux/config"
fi
}
xcat_disable_image_firewalld()
{
for xcat_firewalld_entry in \
"$1/etc/systemd/system/multi-user.target.wants/firewalld.service" \
"$1/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
do
if [ -f "$xcat_firewalld_entry" ] || [ -L "$xcat_firewalld_entry" ]; then
rm -f "$xcat_firewalld_entry"
fi
done
}
# END generated netboot policy
xcat_disable_image_selinux "$installroot"
#-- Example of booted image versioning
#-- We want to know, with what configuration (version of the image) each node was booted.
@@ -35,23 +35,31 @@ echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab
#-- Disable SELinux in the rootimg
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
if [ -f "$installroot/etc/selinux/config" ]
then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config"
fi
# BEGIN generated netboot policy: build-utils/sync-netboot-policy --write
xcat_disable_image_selinux()
{
if [ -f "$1/etc/selinux/config" ]; then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$1/etc/selinux/config"
fi
}
xcat_disable_image_firewalld()
{
for xcat_firewalld_entry in \
"$1/etc/systemd/system/multi-user.target.wants/firewalld.service" \
"$1/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
do
if [ -f "$xcat_firewalld_entry" ] || [ -L "$xcat_firewalld_entry" ]; then
rm -f "$xcat_firewalld_entry"
fi
done
}
# END generated netboot policy
xcat_disable_image_selinux "$installroot"
#--for redhat 8 and 8.1
#-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys
FIREWALLD="$installroot/etc/systemd/system/multi-user.target.wants/firewalld.service"
if [ -f "$FIREWALLD" ] || [ -L "$FIREWALLD" ]
then
rm -f "$FIREWALLD"
fi
FIREWALLD1="$installroot/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
if [ -f "$FIREWALLD1" ] || [ -L "$FIREWALLD1" ]
then
rm -f "$FIREWALLD1"
fi
xcat_disable_image_firewalld "$installroot"
#-- Example of booted image versioning
@@ -35,22 +35,30 @@ END
#-- Disable SELinux in the rootimg
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
if [ -f "$installroot/etc/selinux/config" ]
then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config"
fi
# BEGIN generated netboot policy: build-utils/sync-netboot-policy --write
xcat_disable_image_selinux()
{
if [ -f "$1/etc/selinux/config" ]; then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$1/etc/selinux/config"
fi
}
xcat_disable_image_firewalld()
{
for xcat_firewalld_entry in \
"$1/etc/systemd/system/multi-user.target.wants/firewalld.service" \
"$1/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
do
if [ -f "$xcat_firewalld_entry" ] || [ -L "$xcat_firewalld_entry" ]; then
rm -f "$xcat_firewalld_entry"
fi
done
}
# END generated netboot policy
xcat_disable_image_selinux "$installroot"
#--for redhat 8 and 8.1
#-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys
FIREWALLD="$installroot/etc/systemd/system/multi-user.target.wants/firewalld.service"
if [ -f "$FIREWALLD" ] || [ -L "$FIREWALLD" ]
then
rm -f "$FIREWALLD"
fi
FIREWALLD1="$installroot/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
if [ -f "$FIREWALLD1" ] || [ -L "$FIREWALLD1" ]
then
rm -f "$FIREWALLD1"
fi
xcat_disable_image_firewalld "$installroot"
#-- Example of booted image versioning
@@ -35,23 +35,31 @@ echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab
#-- Disable SELinux in the rootimg
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
if [ -f "$installroot/etc/selinux/config" ]
then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config"
fi
# BEGIN generated netboot policy: build-utils/sync-netboot-policy --write
xcat_disable_image_selinux()
{
if [ -f "$1/etc/selinux/config" ]; then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$1/etc/selinux/config"
fi
}
xcat_disable_image_firewalld()
{
for xcat_firewalld_entry in \
"$1/etc/systemd/system/multi-user.target.wants/firewalld.service" \
"$1/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
do
if [ -f "$xcat_firewalld_entry" ] || [ -L "$xcat_firewalld_entry" ]; then
rm -f "$xcat_firewalld_entry"
fi
done
}
# END generated netboot policy
xcat_disable_image_selinux "$installroot"
#--for redhat 8 and 8.1
#-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys
FIREWALLD="$installroot/etc/systemd/system/multi-user.target.wants/firewalld.service"
if [ -f "$FIREWALLD" ] || [ -L "$FIREWALLD" ]
then
rm -f "$FIREWALLD"
fi
FIREWALLD1="$installroot/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
if [ -f "$FIREWALLD1" ] || [ -L "$FIREWALLD1" ]
then
rm -f "$FIREWALLD1"
fi
xcat_disable_image_firewalld "$installroot"
#-- Example of booted image versioning
@@ -35,22 +35,30 @@ END
#-- Disable SELinux in the rootimg
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
if [ -f "$installroot/etc/selinux/config" ]
then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config"
fi
# BEGIN generated netboot policy: build-utils/sync-netboot-policy --write
xcat_disable_image_selinux()
{
if [ -f "$1/etc/selinux/config" ]; then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$1/etc/selinux/config"
fi
}
xcat_disable_image_firewalld()
{
for xcat_firewalld_entry in \
"$1/etc/systemd/system/multi-user.target.wants/firewalld.service" \
"$1/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
do
if [ -f "$xcat_firewalld_entry" ] || [ -L "$xcat_firewalld_entry" ]; then
rm -f "$xcat_firewalld_entry"
fi
done
}
# END generated netboot policy
xcat_disable_image_selinux "$installroot"
#--for redhat 8 and 8.1
#-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys
FIREWALLD="$installroot/etc/systemd/system/multi-user.target.wants/firewalld.service"
if [ -f "$FIREWALLD" ] || [ -L "$FIREWALLD" ]
then
rm -f "$FIREWALLD"
fi
FIREWALLD1="$installroot/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
if [ -f "$FIREWALLD1" ] || [ -L "$FIREWALLD1" ]
then
rm -f "$FIREWALLD1"
fi
xcat_disable_image_firewalld "$installroot"
#-- Example of booted image versioning
@@ -39,10 +39,27 @@ echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab
#-- Disable SELinux in the rootimg
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
if [ -f "$installroot/etc/selinux/config" ]
then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config"
fi
# BEGIN generated netboot policy: build-utils/sync-netboot-policy --write
xcat_disable_image_selinux()
{
if [ -f "$1/etc/selinux/config" ]; then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$1/etc/selinux/config"
fi
}
xcat_disable_image_firewalld()
{
for xcat_firewalld_entry in \
"$1/etc/systemd/system/multi-user.target.wants/firewalld.service" \
"$1/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
do
if [ -f "$xcat_firewalld_entry" ] || [ -L "$xcat_firewalld_entry" ]; then
rm -f "$xcat_firewalld_entry"
fi
done
}
# END generated netboot policy
xcat_disable_image_selinux "$installroot"
#-- Example of booted image versioning
#-- We want to know, with what configuration (version of the image) each node was booted.
@@ -35,22 +35,30 @@ END
#-- Disable SELinux in the rootimg
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
if [ -f "$installroot/etc/selinux/config" ]
then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config"
fi
# BEGIN generated netboot policy: build-utils/sync-netboot-policy --write
xcat_disable_image_selinux()
{
if [ -f "$1/etc/selinux/config" ]; then
sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$1/etc/selinux/config"
fi
}
xcat_disable_image_firewalld()
{
for xcat_firewalld_entry in \
"$1/etc/systemd/system/multi-user.target.wants/firewalld.service" \
"$1/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
do
if [ -f "$xcat_firewalld_entry" ] || [ -L "$xcat_firewalld_entry" ]; then
rm -f "$xcat_firewalld_entry"
fi
done
}
# END generated netboot policy
xcat_disable_image_selinux "$installroot"
#--for redhat 8 and 8.1
#-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys
FIREWALLD="$installroot/etc/systemd/system/multi-user.target.wants/firewalld.service"
if [ -f "$FIREWALLD" ] || [ -L "$FIREWALLD" ]
then
rm -f "$FIREWALLD"
fi
FIREWALLD1="$installroot/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service"
if [ -f "$FIREWALLD1" ] || [ -L "$FIREWALLD1" ]
then
rm -f "$FIREWALLD1"
fi
xcat_disable_image_firewalld "$installroot"
#-- Example of booted image versioning