Changeset 262e174 for LFS/master.sh


Ignore:
Timestamp:
10/06/2022 08:39:09 AM (2 years ago)
Author:
Pierre Labastie <pierre.labastie@…>
Branches:
ablfs-more, trunk
Children:
fd90f80
Parents:
3722d31
Message:

systemd: copy /etc/resolv.conf from the host

when entering chroot. This allows using the network in chroot.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LFS/master.sh

    r3722d31 r262e174  
    294294all:    ck_UID ck_terminal mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL mk_CUSTOM_TOOLS
    295295        @sudo env LFS=\$(MOUNT_PT) kernfs-scripts/teardown.sh
     296EOF
     297) >> $MKFILE
     298# With systemd, the commands in chapter 9 do not create a
     299# valid /etc/resolv.conf, so that if blfs_tools are installed, and
     300# make-ca is run, it cannot connect. In this case, resolv.conf
     301# from the host has been copied, and we need to remove it now.
     302if [ "$INITSYS" = systemd ]; then
     303(
     304    cat << EOF
     305        @sudo rm -v \$(MOUNT_PT)/etc/resolv.conf
     306EOF
     307) >> $MKFILE
     308fi
     309(
     310    cat << EOF
    296311        @sudo make do_housekeeping
    297312        @echo $VERSION > lfs-release && \\
     
    381396EOF
    382397) >> $MKFILE
     398# With systemd, the commands in chapter 9 do not create a
     399# valid /etc/resolv.conf, so that if we want to enter chroot,
     400# and systemd has not yet been run (otherwise /etc/resolv.conf
     401# exists), we just copy resolv.conf from the host.
    383402if [ "$INITSYS" = systemd ]; then
    384403(
    385404    cat << EOF
    386         sudo mkdir -pv \$(MOUNT_PT)/run/systemd/resolve
    387         sudo cp -v /etc/resolv.conf \$(MOUNT_PT)/run/systemd/resolve
     405        if ! [ -e \$(MOUNT_PT)/etc/resolv.conf ]; then \\
     406          sudo cp -v /etc/resolv.conf \$(MOUNT_PT)/etc; \\
     407          sudo touch \$(MOUNT_PT)/etc/.host-resolvconf; \\
     408        fi
    388409EOF
    389410) >> $MKFILE
     
    394415teardown:
    395416        sudo env LFS=\$(MOUNT_PT) kernfs-scripts/teardown.sh
     417EOF
     418) >> $MKFILE
     419# With systemd, the commands in chapter 9 do not create a
     420# valid /etc/resolv.conf, so that if we want to enter chroot,
     421# and systemd has not yet been run (otherwise /etc/resolv.conf
     422# exists), we just copy resolv.conf from the host.
     423# We need to remove it now, if it has been created.
     424if [ "$INITSYS" = systemd ]; then
     425(
     426    cat << EOF
     427        if [ -e \$(MOUNT_PT)/etc/.host-resolvconf ]; then \\
     428          sudo rm -v \$(MOUNT_PT)/etc/resolv.conf; \\
     429          sudo rm -v \$(MOUNT_PT)/etc/.host-resolvconf; \\
     430        fi
     431EOF
     432) >> $MKFILE
     433fi
     434(
     435    cat << EOF
    396436
    397437chroot1: devices
     
    408448EOF
    409449) >> $MKFILE
     450# With systemd, the commands in chapter 9 do not create a
     451# valid /etc/resolv.conf, so that if blfs_tools are installed, and
     452# make-ca is run, it cannot connect. We just copy resolv.conf
     453# from the host. We'll remove it at the end.
    410454if [ "$INITSYS" = systemd ]; then
    411455(
    412456    cat << EOF
    413         mkdir -pv \$(MOUNT_PT)/run/systemd/resolve
    414         cp -v /etc/resolv.conf \$(MOUNT_PT)/run/systemd/resolve
     457        @cp -v /etc/resolv.conf \$(MOUNT_PT)/etc
    415458
    416459EOF
Note: See TracChangeset for help on using the changeset viewer.