r3110 - in jhalfs/branches/experimental: . CLFS CLFS2 HLFS LFS common

georgeb at linuxfromscratch.org georgeb at linuxfromscratch.org
Wed Sep 13 13:04:47 PDT 2006


Author: georgeb
Date: 2006-09-13 14:04:46 -0600 (Wed, 13 Sep 2006)
New Revision: 3110

Modified:
   jhalfs/branches/experimental/CLFS/master.sh
   jhalfs/branches/experimental/CLFS2/master.sh
   jhalfs/branches/experimental/Config.in
   jhalfs/branches/experimental/HLFS/master.sh
   jhalfs/branches/experimental/LFS/master.sh
   jhalfs/branches/experimental/common/common-functions
   jhalfs/branches/experimental/common/makefile-functions
Log:
Changes made to allow the generated makefile to be run from any account (with sudo privs) 

Modified: jhalfs/branches/experimental/CLFS/master.sh
===================================================================
--- jhalfs/branches/experimental/CLFS/master.sh	2006-09-12 21:38:16 UTC (rev 3109)
+++ jhalfs/branches/experimental/CLFS/master.sh	2006-09-13 20:04:46 UTC (rev 3110)
@@ -171,6 +171,7 @@
 	echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
 	@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
 	touch envars && \\
+	chmod -R a+wt \$(MOUNT_PT) && \\
 	chown -R \$(LUSER) \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
@@ -319,9 +320,9 @@
     # First append each name of the script files to a list (this will become
     # the names of the targets in the Makefile
     case "${this_script}" in
-      *util-linux) : ;;
-      *kernfs) orphan_scripts="${orphan_scripts} ${this_script}"  ;;
-      *)          chroottools="$chroottools $this_script"         ;;
+      *util-linux) orphan_scripts="${orphan_scripts} ${this_script}"  ;;
+      *kernfs)     orphan_scripts="${orphan_scripts} ${this_script}"  ;;
+      *)           chroottools="$chroottools $this_script"            ;;
     esac    
 
     # Grab the name of the target, strip id number, XXX-script
@@ -1181,9 +1182,18 @@
 (
 cat << EOF
 
-all: mk_SETUP mk_CROSS mk_TEMP restore_luser_env mk_SYSTOOLS mk_FINAL mk_BOOTSCRIPT mk_BOOTABLE do-housekeeping
+all: ck_UID mk_SETUP mk_CROSS mk_TEMP mk_SUDO mk_SYSTOOLS mk_FINAL mk_BOOTSCRIPT mk_BOOTABLE
+	@sudo make do-housekeeping
 	@\$(call echo_finished,$VERSION)
 
+ck_UID:
+	@if [ \`id -u\` = "0" ]; then \\
+	  echo "--------------------------------------------------"; \\
+	  echo "You cannot run this makefile from the root account"; \\
+	  echo "--------------------------------------------------"; \\
+	  exit 1; \\
+	fi
+
 #---------------AS ROOT
 mk_SETUP:
 	@\$(call echo_SU_request)
@@ -1193,14 +1203,18 @@
 #---------------AS LUSER
 mk_CROSS: mk_SETUP
 	@\$(call echo_PHASE,Cross Tool)
-	@( \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make CROSS" )
+	@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make CROSS" )
 	@touch \$@
 
 mk_TEMP: mk_CROSS
 	@\$(call echo_PHASE,Temporary Tools)
-	@( \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make TEMP" )
+	@(sudo  \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make TEMP" )
+	@sudo make restore-luser-env
 	@touch \$@
 
+mk_SUDO: mk_TEMP
+	@sudo make SUDO
+	@touch \$@
 #
 # The convoluted piece of code below is necessary to provide 'make' with a valid shell in the
 # chroot environment. (Unless someone knows a different way)
@@ -1209,7 +1223,7 @@
 #  pre-existing links.
 
 #---------------CHROOT JAIL
-mk_SYSTOOLS: mk_TEMP $orphan_scripts
+mk_SYSTOOLS: mk_SUDO 
 	@mkdir \$(MOUNT_PT)/bin && \\
 	cd \$(MOUNT_PT)/bin && \\
 	ln -sf /tools/bin/bash bash; ln -sf bash sh
@@ -1245,12 +1259,22 @@
 (
 cat << EOF
 
-all:	mk_SETUP mk_CROSS mk_TEMP mk_SYSTOOLS $orphan_scripts restore-luser-env
+all:	ck_UID mk_SETUP mk_CROSS mk_TEMP mk_SYSTOOLS mk_SUDO
+	@sudo make restore-luser-env
 	@\$(call echo_boot_finished,$VERSION)
 
 makesys: mk_FINAL mk_BOOTSCRIPT mk_BOOTABLE
 	@\$(call echo_finished,$VERSION)
 
+
+ck_UID:
+	@if [ \`id -u\` = "0" ]; then \\
+	  echo "--------------------------------------------------"; \\
+	  echo "You cannot run this makefile from the root account"; \\
+	  echo "--------------------------------------------------"; \\
+	  exit 1; \\
+	fi
+
 #---------------AS ROOT
 
 mk_SETUP:
@@ -1262,19 +1286,23 @@
 	
 mk_CROSS: mk_SETUP
 	@\$(call echo_PHASE,Cross Tool)
-	@( \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make CROSS" )
+	@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make CROSS" )
 	@touch \$@
 
 mk_TEMP: mk_CROSS
 	@\$(call echo_PHASE,Temporary Tools)
-	@( \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make TEMP" )
+	@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make TEMP" )
 	@touch \$@
 
 mk_SYSTOOLS: mk_TEMP
 	@\$(call echo_PHASE,Minimal Boot system)
-	@( \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make SYSTOOLS" )
+	@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make SYSTOOLS" )
 	@touch \$@
 
+mk_SUDO: mk_SYSTOOLS
+	@sudo make SUDO
+	@touch \$@
+
 #---------------AS ROOT
 
 mk_FINAL:
@@ -1302,6 +1330,7 @@
 SETUP:      $host_prep
 CROSS:      $cross_tools
 TEMP:       $temptools
+SUDO:	    $orphan_scripts
 SYSTOOLS:   ${chroottools}${boottools}
 FINAL:      $testsuitetools $basicsystem
 BOOTSCRIPT: $bootscripttools

Modified: jhalfs/branches/experimental/CLFS2/master.sh
===================================================================
--- jhalfs/branches/experimental/CLFS2/master.sh	2006-09-12 21:38:16 UTC (rev 3109)
+++ jhalfs/branches/experimental/CLFS2/master.sh	2006-09-13 20:04:46 UTC (rev 3110)
@@ -65,7 +65,8 @@
 	echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
 	@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
 	touch envars && \\
-	chown \$(LUSER):\$(LGROUP) envars
+	chown \$(LUSER):\$(LGROUP) envars && \\
+	chmod -R a+wt \$(MOUNT_PT)
 	@touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)
@@ -465,9 +466,18 @@
 (
 cat << EOF
 
-all:	mk_SETUP mk_LUSER mk_ROOT
+all:	ck_UID mk_SETUP mk_LUSER mk_ROOT
+	@sudo do_housekeeping
 	@\$(call echo_finished,$VERSION)
 
+ck_UID:
+	@if [ \`id -u\` = "0" ]; then \\
+	  echo "--------------------------------------------------"; \\
+	  echo "You cannot run this makefile from the root account"; \\
+	  echo "--------------------------------------------------"; \\
+	  exit 1; \\
+	fi
+
 mk_SETUP:
 	@\$(call echo_SU_request)
 	@sudo make SETUP
@@ -475,7 +485,8 @@
 
 mk_LUSER: mk_SETUP
 	@\$(call echo_SULUSER_request)
-	@( \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" )
+	@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" )
+	@sudo restore-luser-env
 	@touch \$@
 
 mk_ROOT:

Modified: jhalfs/branches/experimental/Config.in
===================================================================
--- jhalfs/branches/experimental/Config.in	2006-09-12 21:38:16 UTC (rev 3109)
+++ jhalfs/branches/experimental/Config.in	2006-09-13 20:04:46 UTC (rev 3110)
@@ -707,6 +707,7 @@
 	#--- End ICA/farce
 
 	#--- Optimizations
+if !BOOK_CLFS2
 	config	CONFIG_OPTIMIZE
 		bool	"Use optimization (see help)"
 		default	n
@@ -740,6 +741,7 @@
 		default	"0"	if !CONFIG_OPTIMIZE
 		default	"1"	if OPT_1
 		default	"2"	if OPT_2
+endif
 	#--- End Optimizations
 
 	#-- Internal Settings

Modified: jhalfs/branches/experimental/HLFS/master.sh
===================================================================
--- jhalfs/branches/experimental/HLFS/master.sh	2006-09-12 21:38:16 UTC (rev 3109)
+++ jhalfs/branches/experimental/HLFS/master.sh	2006-09-13 20:04:46 UTC (rev 3110)
@@ -153,6 +153,7 @@
 	echo "export target ldso" >> /home/\$(LUSER)/.bashrc && \\
 	echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\
 	chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
+	chmod -R a+wt \$(MOUNT_PT) && \\
 	touch envars && \\
 	chown \$(LUSER) envars && \\
 	touch \$@ && \\
@@ -555,9 +556,17 @@
 (
   cat << EOF
 
-all:	mk_SETUP mk_LUSER mk_CHROOT mk_BOOT do-housekeeping
+all:	ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT
+	@sudo make do-housekeeping
 	@\$(call echo_finished,$VERSION)
 
+ck_UID:
+	@if [ \`id -u\` = "0" ]; then \\
+	  echo "--------------------------------------------------"; \\
+	  echo "You cannot run this makefile from the root account"; \\
+	  echo "--------------------------------------------------"; \\
+	  exit 1; \\
+	fi
 
 mk_SETUP:
 	@\$(call echo_SU_request)
@@ -566,10 +575,15 @@
 	
 mk_LUSER: mk_SETUP
 	@\$(call echo_SULUSER_request)
-	@( \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" )
+	@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" )
+	@sudo make restore-luser-env
 	@touch \$@
 
-mk_CHROOT: mk_LUSER 060-kernfs 062-changingowner
+mk_SUDO: mk_LUSER
+	@sudo make SUDO
+	@touch \$@
+	
+mk_CHROOT: mk_SUDO 
 	@mkdir \$(MOUNT_PT)/bin && \
 	cd \$(MOUNT_PT)/bin && \
 	ln -sf /tools/bin/bash bash; ln -sf bash sh
@@ -588,6 +602,8 @@
 
 LUSER:	$chapter5
 
+SUDO:	060-kernfs 062-changingowner
+
 CHROOT:	$chapter6
 
 BOOT:	$chapter7

Modified: jhalfs/branches/experimental/LFS/master.sh
===================================================================
--- jhalfs/branches/experimental/LFS/master.sh	2006-09-12 21:38:16 UTC (rev 3109)
+++ jhalfs/branches/experimental/LFS/master.sh	2006-09-13 20:04:46 UTC (rev 3110)
@@ -39,7 +39,7 @@
 	fi;
 	@chown \$(LUSER) \$(MOUNT_PT)/tools && \\
 	chown -R \$(LUSER) \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
-	chmod a+wt \$(MOUNT_PT)/sources && \\
+	chmod -R a+wt \$(MOUNT_PT) && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)
@@ -435,10 +435,18 @@
 (
     cat << EOF
 
-all:	mk_SETUP mk_LUSER mk_CHROOT mk_BOOT
+all:	ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT
+	@sudo housekeeping
 	@\$(call echo_finished,$VERSION)
 
-
+ck_UID:
+	@if [ \`id -u\` = "0" ]; then \\
+	  echo "--------------------------------------------------"; \\
+	  echo "You cannot run this makefile from the root account"; \\
+	  echo "--------------------------------------------------"; \\
+	  exit 1; \\
+	fi
+	
 mk_SETUP:
 	@\$(call echo_SU_request)
 	@sudo make SETUP
@@ -446,8 +454,12 @@
 
 mk_LUSER: mk_SETUP
 	@\$(call echo_SULUSER_request)
-	@( \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" )
+	@( sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" )
 	@touch \$@
+
+mk_SUDO: mk_LUSER
+	@sudo make SUDO
+	touch \$@
 #
 # The convoluted piece of code below is necessary to provide 'make' with a valid shell in the
 # chroot environment. (Unless someone knows a different way)
@@ -455,13 +467,14 @@
 # Also change the original symlink creation to include (f)orce to prevent failure due to
 #  pre-existing links.
 #
-mk_CHROOT: mk_LUSER 057-changingowner 059-kernfs
+mk_CHROOT: mk_LUSER
 	@mkdir \$(MOUNT_PT)/bin && \\
 	cd \$(MOUNT_PT)/bin && \\
 	ln -sf /tools/bin/bash bash; ln -sf bash sh
 	@sed -e 's|^ln -sv|ln -svf|' -i \$(CMDSDIR)/chapter06/063-createfiles
 	@\$(call echo_CHROOT_request)
 	@( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make CHROOT")
+	@sudo restore-luser-env
 	@touch \$@
 
 mk_BOOT: mk_CHROOT
@@ -474,6 +487,8 @@
 
 LUSER:	$chapter5
 
+SUDO:	057-changingowner 059-kernfs
+
 CHROOT:	$chapter6
 
 BOOT:	$chapter789

Modified: jhalfs/branches/experimental/common/common-functions
===================================================================
--- jhalfs/branches/experimental/common/common-functions	2006-09-12 21:38:16 UTC (rev 3109)
+++ jhalfs/branches/experimental/common/common-functions	2006-09-13 20:04:46 UTC (rev 3110)
@@ -343,8 +343,8 @@
   # Test if make must be run.
   if [ "$RUNMAKE" = "y" ] ; then
     # Test to make sure we're running the build as root
-    if [ "$UID" != "0" ] ; then
-      echo "You must be logged in as root to successfully build the system."
+    if [ "$UID" = "0" ] ; then    
+      echo "You must not be logged in as root to build the system."
       exit 1
     fi
     # Build the system

Modified: jhalfs/branches/experimental/common/makefile-functions
===================================================================
--- jhalfs/branches/experimental/common/makefile-functions	2006-09-12 21:38:16 UTC (rev 3109)
+++ jhalfs/branches/experimental/common/makefile-functions	2006-09-13 20:04:46 UTC (rev 3110)
@@ -26,7 +26,7 @@
   @echo $(BOLD)--------------------------------------------------------------------------------
   @echo $(BLUE)$@
   @echo $(WHITE)ROOT privilege is required to perform a number commands
-  @echo sudo will request a password to all high privelege cmds to execut correctly
+  @echo sudo will request a password to all high privilege cmds to execute correctly
 endef
 
 define echo_SULUSER_request




More information about the alfs-log mailing list