From 1c48b6a633d9d45cbeaec1cd2bdf16a5bd1064f5 Mon Sep 17 00:00:00 2001 From: Pratham Patel Date: Mon, 20 Nov 2023 18:03:25 +0530 Subject: [PATCH] enable network access for the chroot, always --- includes/post/cleanup.ksi | 4 ++-- includes/post/expand-rootfs.ksi | 6 ------ includes/post/post-install.ksi | 3 +++ includes/post/rpm-repos-enable.ksi | 5 ----- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/includes/post/cleanup.ksi b/includes/post/cleanup.ksi index c977bee..902816d 100644 --- a/includes/post/cleanup.ksi +++ b/includes/post/cleanup.ksi @@ -1,8 +1,8 @@ %post set -x -echo "Packages within this disk image" -rpm -qa --qf '%{size}\t%{name}-%{version}-%{release}.%{arch}\n' | sort -rn +# Remove the temporary 'resolv.conf' file so that the user defines it +rm -v -f /etc/resolv.conf # Remove all network connections and/or links rm -v -f /etc/sysconfig/network-scripts/ifcfg-link diff --git a/includes/post/expand-rootfs.ksi b/includes/post/expand-rootfs.ksi index 0114d03..bc309a7 100644 --- a/includes/post/expand-rootfs.ksi +++ b/includes/post/expand-rootfs.ksi @@ -1,16 +1,10 @@ %post set -x -# Setup networking temporarily -[ -f /etc/resolv.conf ] || echo "nameserver 1.1.1.1" > /etc/resolv.conf - # The script that expands root partition [ -d /usr/local/bin ] || mkdir --verbose /usr/local/bin curl 'https://git.thefossguy.com/enterprise-linux/sbc-images/raw/branch/rocky-generic/scripts/expand-rootfs.sh' --output /usr/local/bin/expand-rootfs.sh || exit 1 [ -f /usr/local/bin/expand-rootfs.sh ] && \ chmod --verbose +x /usr/local/bin/expand-rootfs.sh -# Remove the temporary 'resolv.conf' file -rm -v -f /etc/resolv.conf - %end diff --git a/includes/post/post-install.ksi b/includes/post/post-install.ksi index d387836..ad3a521 100644 --- a/includes/post/post-install.ksi +++ b/includes/post/post-install.ksi @@ -1,3 +1,6 @@ +# enable network access in the chroot +[ -f /etc/resolv.conf ] || echo "nameserver 1.1.1.1" > /etc/resolv.conf + %include grub-setup.ksi %include rpm-repos-enable.ksi %include user-setup.ksi diff --git a/includes/post/rpm-repos-enable.ksi b/includes/post/rpm-repos-enable.ksi index be0a325..9ecc439 100644 --- a/includes/post/rpm-repos-enable.ksi +++ b/includes/post/rpm-repos-enable.ksi @@ -4,9 +4,6 @@ set -x MACHINE_ARCH="$(uname -m)" DNF_RELEASEVER="$(dnf config-manager --dump-variables | grep 'releasever' | awk '{print $3}')" -# Setup networking temporarily -[ -f /etc/resolv.conf ] || echo "nameserver 1.1.1.1" > /etc/resolv.conf - # This repository is a given since it provides 'uboot-images-armv8' and # 'uboot-tools', which are **required**. dnf config-manager --assumeyes --add-repo "https://download.rockylinux.org/pub/sig/${DNF_RELEASEVER}/altarch/${MACHINE_ARCH}/altarch-common" @@ -56,7 +53,5 @@ echo 'metadata_expire=2400' | tee -a '/etc/yum.repos.d/_copr:copr.fedorainfraclo dnf clean expire-cache dnf upgrade -y -# Remove the temporary 'resolv.conf' file -rm -v -f /etc/resolv.conf %end