Nimbin[12]?Mirrors & Forks / jhalfs / commits / 3722d31

jhalfs git · trunk

jhalfs LFS build automation (mirror)

lfs mirror bash · first commit 2005-09-11 · last commit 2024-02-13 (2 years ago) · synced 3 days ago · upstream: git.linuxfromscratch.org/jhalfs

Python 78.4% Shell 19.8% Makefile 1.8%
git clone https://git.christianimmanuel.de/mirrors-forks/jhalfs.gitwget https://git.christianimmanuel.de/mirrors-forks/jhalfs/archive/jhalfs.tar.gz

Call kernel filesystem scripts from Makefile

Pierre Labastie · 2022-10-06 08:26 · 3722d3164c0c3215eeec0afdffaa6a37886c5fc7

Instead of having them inside the Makefile, which implies editing
them (automatically), which is not robust if anything changes:
it got broken when a test for a mountpoint was added...
 LFS/master.sh | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/LFS/master.sh b/LFS/master.sh
index a5d9913..0013c0f 100644
--- a/LFS/master.sh
+++ b/LFS/master.sh
@@ -286,30 +286,13 @@ build_Makefile() {           #
     i=`expr $i + 1`
   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|\$|; \\\\|' \
-                -e 's|then|& :|' \
-                -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)|'`
   # Drop in the main target 'all:' and the chapter targets with each sub-target
   # as a dependency.
 (
     cat << EOF
 
 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
-$teardownat
+	@sudo env LFS=\$(MOUNT_PT) kernfs-scripts/teardown.sh
 	@sudo make do_housekeeping
 	@echo $VERSION > lfs-release && \\
 	sudo mv lfs-release \$(MOUNT_PT)/etc && \\
@@ -394,7 +377,7 @@ mk_CUSTOM_TOOLS: mk_BLFS_TOOL
 	@touch \$@
 
 devices: ck_UID
-$devices
+	sudo env LFS=\$(MOUNT_PT) kernfs-scripts/devices.sh
 EOF
 ) >> $MKFILE
 if [ "$INITSYS" = systemd ]; then
@@ -409,7 +392,7 @@ fi
     cat << EOF
 
 teardown:
-$teardown
+	sudo env LFS=\$(MOUNT_PT) kernfs-scripts/teardown.sh
 
 chroot1: devices
 	sudo \$(CHROOT1)