Get virtual kernel filesystem commands from the book, and really add
/run/systemd/resolve/resolv.conf after creating the kernel FS in chapter 6
This commit is contained in:
parent
49ba78d711
commit
13c475babc
4 changed files with 100 additions and 31 deletions
|
@ -445,12 +445,32 @@ build_Makefile() { #
|
||||||
i=`expr $i + 1`
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Store virtual kernel file systems commands:
|
||||||
|
devices=`cat ../kernfs-scripts/devices.sh | \
|
||||||
|
sed -e 's|^| |' \
|
||||||
|
-e 's|mount|sudo &|' \
|
||||||
|
-e 's|mkdir|sudo &|' \
|
||||||
|
-e 's|\\$|&&|g' \
|
||||||
|
-e 's|\$\$LFS|$(MOUNT_PT)|g'`
|
||||||
|
teardown=`cat ../kernfs-scripts/teardown.sh | \
|
||||||
|
sed -e 's|^| |' \
|
||||||
|
-e 's|umount|sudo &|' \
|
||||||
|
-e 's|\$LFS|$(MOUNT_PT)|'`
|
||||||
|
teardownat=`cat ../kernfs-scripts/teardown.sh | \
|
||||||
|
sed -e 's|^| |' \
|
||||||
|
-e 's|umount|@-sudo &|' \
|
||||||
|
-e 's|\$LFS|$(MOUNT_PT)|'`
|
||||||
|
#echo [DEBUG]
|
||||||
|
#echo devices=$devices
|
||||||
|
#echo teardown=$teardown
|
||||||
|
#echo teardownat=$teardownat
|
||||||
# Drop in the main target 'all:' and the chapter targets with each sub-target
|
# Drop in the main target 'all:' and the chapter targets with each sub-target
|
||||||
# as a dependency.
|
# as a dependency.
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
|
||||||
all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL mk_CUSTOM_TOOLS
|
all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL mk_CUSTOM_TOOLS
|
||||||
|
$teardownat
|
||||||
@sudo make do_housekeeping
|
@sudo make do_housekeeping
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE
|
) >> $MKFILE
|
||||||
|
@ -533,14 +553,7 @@ mk_CUSTOM_TOOLS: mk_BLFS_TOOL
|
||||||
@touch \$@
|
@touch \$@
|
||||||
|
|
||||||
devices: ck_UID
|
devices: ck_UID
|
||||||
sudo mount -v --bind /dev \$(MOUNT_PT)/dev
|
$devices
|
||||||
sudo mount -vt devpts devpts \$(MOUNT_PT)/dev/pts
|
|
||||||
sudo mount -vt proc proc \$(MOUNT_PT)/proc
|
|
||||||
sudo mount -vt sysfs sysfs \$(MOUNT_PT)/sys
|
|
||||||
sudo mount -vt tmpfs tmpfs \$(MOUNT_PT)/run
|
|
||||||
if [ -h \$(MOUNT_PT)/dev/shm ]; then \\
|
|
||||||
sudo mkdir -p \$(MOUNT_PT)/\$\$(readlink \$(MOUNT_PT)/dev/shm); \\
|
|
||||||
fi
|
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE
|
) >> $MKFILE
|
||||||
if [ "$INITSYS" = systemd ]; then
|
if [ "$INITSYS" = systemd ]; then
|
||||||
|
@ -553,12 +566,9 @@ EOF
|
||||||
fi
|
fi
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
|
||||||
teardown:
|
teardown:
|
||||||
sudo umount -v \$(MOUNT_PT)/dev/pts
|
$teardown
|
||||||
sudo umount -v \$(MOUNT_PT)/dev
|
|
||||||
sudo umount -v \$(MOUNT_PT)/run
|
|
||||||
sudo umount -v \$(MOUNT_PT)/proc
|
|
||||||
sudo umount -v \$(MOUNT_PT)/sys
|
|
||||||
|
|
||||||
chroot1: devices
|
chroot1: devices
|
||||||
sudo \$(CHROOT1)
|
sudo \$(CHROOT1)
|
||||||
|
@ -571,6 +581,19 @@ chroot: devices
|
||||||
SETUP: $chapter4
|
SETUP: $chapter4
|
||||||
LUSER: $chapter5
|
LUSER: $chapter5
|
||||||
SUDO: $runasroot
|
SUDO: $runasroot
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE
|
||||||
|
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
|
||||||
|
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE
|
||||||
|
fi
|
||||||
|
(
|
||||||
|
cat << EOF
|
||||||
CHROOT: SHELL=/tools/bin/bash
|
CHROOT: SHELL=/tools/bin/bash
|
||||||
CHROOT: $chapter6
|
CHROOT: $chapter6
|
||||||
BOOT: $chapter78
|
BOOT: $chapter78
|
||||||
|
@ -597,26 +620,12 @@ restore-luser-env:
|
||||||
@\$(call housekeeping)
|
@\$(call housekeeping)
|
||||||
|
|
||||||
do_housekeeping:
|
do_housekeeping:
|
||||||
@-umount \$(MOUNT_PT)/sys
|
|
||||||
@-umount \$(MOUNT_PT)/proc
|
|
||||||
@-if mountpoint -q \$(MOUNT_PT)/run; then \\
|
|
||||||
umount \$(MOUNT_PT)/run; \\
|
|
||||||
elif [ -h \$(MOUNT_PT)/dev/shm ]; then \\
|
|
||||||
link=\$\$(readlink \$(MOUNT_PT)/dev/shm); \\
|
|
||||||
umount \$(MOUNT_PT)/\$\$link; \\
|
|
||||||
unset link; \\
|
|
||||||
else \\
|
|
||||||
umount \$(MOUNT_PT)/dev/shm; \\
|
|
||||||
fi
|
|
||||||
@-umount \$(MOUNT_PT)/dev/pts
|
|
||||||
@-umount \$(MOUNT_PT)/dev
|
|
||||||
@-rm /tools
|
@-rm /tools
|
||||||
@-if [ ! -f luser-exist ]; then \\
|
@-if [ ! -f luser-exist ]; then \\
|
||||||
userdel \$(LUSER); \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf \$(LUSER_HOME); \\
|
rm -rf \$(LUSER_HOME); \\
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE
|
) >> $MKFILE
|
||||||
|
|
||||||
|
|
23
common/kernfs.xsl
Normal file
23
common/kernfs.xsl
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
|
||||||
|
<!-- $Id: kernfs.xsl 3776 2014-01-12 21:43:04Z pierre $ -->
|
||||||
|
|
||||||
|
<xsl:stylesheet
|
||||||
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
version="1.0">
|
||||||
|
|
||||||
|
<xsl:output method="text"/>
|
||||||
|
|
||||||
|
<xsl:template match="/">
|
||||||
|
<xsl:apply-templates select="//userinput[contains(string(),'--bind') or
|
||||||
|
contains(string(),'/proc') or
|
||||||
|
contains(string(),'readlink')]"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="userinput">
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
<xsl:text>
|
||||||
|
</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
|
@ -211,7 +211,10 @@ extract_commands() { #
|
||||||
|
|
||||||
# Create the packages file. We need it for proper Makefile creation
|
# Create the packages file. We need it for proper Makefile creation
|
||||||
create_package_list
|
create_package_list
|
||||||
create_chroot_scripts
|
if [ "${PROGNAME}" = lfs ]; then
|
||||||
|
create_chroot_scripts
|
||||||
|
create_kernfs_scripts
|
||||||
|
fi
|
||||||
|
|
||||||
# Done. Moving on...
|
# Done. Moving on...
|
||||||
get_sources
|
get_sources
|
||||||
|
@ -258,10 +261,10 @@ create_package_list() { #
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
create_chroot_scripts() { #
|
create_chroot_scripts() { #
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
|
|
||||||
rm -rf chroot_scripts
|
rm -rf chroot-scripts
|
||||||
echo -n "Creating chroot commands scripts from $BOOK"
|
echo -n "Creating chroot commands scripts from $BOOK"
|
||||||
if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
|
if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
|
||||||
echo -n "... "
|
echo -n "... "
|
||||||
|
@ -286,3 +289,37 @@ create_chroot_scripts() { #
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#----------------------------#
|
||||||
|
create_kernfs_scripts() { #
|
||||||
|
#----------------------------#
|
||||||
|
|
||||||
|
rm -rf kernfs-scripts
|
||||||
|
mkdir kernfs-scripts
|
||||||
|
echo -n "Creating virtual kernel FS commands scripts from $BOOK"
|
||||||
|
if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
|
||||||
|
echo -n "... "
|
||||||
|
case ${PROGNAME} in
|
||||||
|
clfs*)
|
||||||
|
xsltproc --nonet --xinclude \
|
||||||
|
-o kernfs-scripts/ kernfs.xsl \
|
||||||
|
$BOOK/BOOK/${ARCH}-index.xml >> $LOGDIR/$LOG 2>&1
|
||||||
|
;;
|
||||||
|
hlfs)
|
||||||
|
xsltproc --nonet --xinclude \
|
||||||
|
-o kernfs-scripts/ kernfs.xsl \
|
||||||
|
$BOOK/index.xml >> $LOGDIR/$LOG 2>&1
|
||||||
|
;;
|
||||||
|
lfs)
|
||||||
|
xsltproc --nonet \
|
||||||
|
-o kernfs-scripts/devices.sh kernfs.xsl \
|
||||||
|
$BOOK/chapter06/kernfs.xml >> $LOGDIR/$LOG 2>&1
|
||||||
|
xsltproc --nonet \
|
||||||
|
-o kernfs-scripts/teardown.sh kernfs.xsl \
|
||||||
|
$BOOK/chapter09/reboot.xml >> $LOGDIR/$LOG 2>&1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
esac
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
2
jhalfs
2
jhalfs
|
@ -381,7 +381,7 @@ if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
|
||||||
cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/
|
cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/
|
||||||
|
|
||||||
# Copy needed stylesheets
|
# Copy needed stylesheets
|
||||||
cp $COMMON_DIR/{packages.xsl,chroot.xsl} $JHALFSDIR/
|
cp $COMMON_DIR/{packages.xsl,chroot.xsl,kernfs.xsl} $JHALFSDIR/
|
||||||
|
|
||||||
# Fix the XSL book parser
|
# Fix the XSL book parser
|
||||||
case $PROGNAME in
|
case $PROGNAME in
|
||||||
|
|
Reference in a new issue