| Newsgroups |
gmane.linux.lfs.automated |
| Message-ID |
<[email protected]> |
This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch trunk
in repository jhalfs.
commit 262e174aa1abfc72a0148d94a32ccfc88b269817
Author: Pierre Labastie <[email protected]>
AuthorDate: Thu Oct 6 10:39:09 2022 +0200
systemd: copy /etc/resolv.conf from the host
when entering chroot. This allows using the network in chroot.
---
LFS/master.sh | 51 +++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 47 insertions(+), 4 deletions(-)
diff --git a/LFS/master.sh b/LFS/master.sh
index 0013c0f..f83bafb 100644
--- a/LFS/master.sh
+++ b/LFS/master.sh
@@ -293,6 +293,21 @@ build_Makefile() { #
all: ck_UID ck_terminal mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL mk_CUSTOM_TOOLS
@sudo env LFS=\$(MOUNT_PT) kernfs-scripts/teardown.sh
+EOF
+) >> $MKFILE
+# With systemd, the commands in chapter 9 do not create a
+# valid /etc/resolv.conf, so that if blfs_tools are installed, and
+# make-ca is run, it cannot connect. In this case, resolv.conf
+# from the host has been copied, and we need to remove it now.
+if [ "$INITSYS" = systemd ]; then
+(
+ cat << EOF
+ @sudo rm -v \$(MOUNT_PT)/etc/resolv.conf
+EOF
+) >> $MKFILE
+fi
+(
+ cat << EOF
@sudo make do_housekeeping
@echo $VERSION > lfs-release && \\
sudo mv lfs-release \$(MOUNT_PT)/etc && \\
@@ -380,11 +395,17 @@ devices: ck_UID
sudo env LFS=\$(MOUNT_PT) kernfs-scripts/devices.sh
EOF
) >> $MKFILE
+# With systemd, the commands in chapter 9 do not create a
+# valid /etc/resolv.conf, so that if we want to enter chroot,
+# and systemd has not yet been run (otherwise /etc/resolv.conf
+# exists), we just copy resolv.conf from the host.
if [ "$INITSYS" = systemd ]; then
(
cat << EOF
- sudo mkdir -pv \$(MOUNT_PT)/run/systemd/resolve
- sudo cp -v /etc/resolv.conf \$(MOUNT_PT)/run/systemd/resolve
+ if ! [ -e \$(MOUNT_PT)/etc/resolv.conf ]; then \\
+ sudo cp -v /etc/resolv.conf \$(MOUNT_PT)/etc; \\
+ sudo touch \$(MOUNT_PT)/etc/.host-resolvconf; \\
+ fi
EOF
) >> $MKFILE
fi
@@ -393,6 +414,25 @@ fi
teardown:
sudo env LFS=\$(MOUNT_PT) kernfs-scripts/teardown.sh
+EOF
+) >> $MKFILE
+# With systemd, the commands in chapter 9 do not create a
+# valid /etc/resolv.conf, so that if we want to enter chroot,
+# and systemd has not yet been run (otherwise /etc/resolv.conf
+# exists), we just copy resolv.conf from the host.
+# We need to remove it now, if it has been created.
+if [ "$INITSYS" = systemd ]; then
+(
+ cat << EOF
+ if [ -e \$(MOUNT_PT)/etc/.host-resolvconf ]; then \\
+ sudo rm -v \$(MOUNT_PT)/etc/resolv.conf; \\
+ sudo rm -v \$(MOUNT_PT)/etc/.host-resolvconf; \\
+ fi
+EOF
+) >> $MKFILE
+fi
+(
+ cat << EOF
chroot1: devices
sudo \$(CHROOT1)
@@ -407,11 +447,14 @@ LUSER: $LUSER_TGT
SUDO: $SUDO_TGT
EOF
) >> $MKFILE
+# With systemd, the commands in chapter 9 do not create a
+# valid /etc/resolv.conf, so that if blfs_tools are installed, and
+# make-ca is run, it cannot connect. We just copy resolv.conf
+# from the host. We'll remove it at the end.
if [ "$INITSYS" = systemd ]; then
(
cat << EOF
- mkdir -pv \$(MOUNT_PT)/run/systemd/resolve
- cp -v /etc/resolv.conf \$(MOUNT_PT)/run/systemd/resolve
+ @cp -v /etc/resolv.conf \$(MOUNT_PT)/etc
EOF
) >> $MKFILE
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
--
http://lists.linuxfromscratch.org/sympa/info/alfs-discuss
Unsubscribe: See the above information page