enable network access for the chroot, always

This commit is contained in:
Pratham Patel 2023-11-20 18:03:25 +05:30
parent 041f5bc97d
commit 1c48b6a633
No known key found for this signature in database
4 changed files with 5 additions and 13 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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