r2815 - in jhalfs/trunk: CLFS common

georgeb at linuxfromscratch.org georgeb at linuxfromscratch.org
Mon Jul 3 16:49:14 PDT 2006


Author: georgeb
Date: 2006-07-03 17:49:13 -0600 (Mon, 03 Jul 2006)
New Revision: 2815

Modified:
   jhalfs/trunk/CLFS/master.sh
   jhalfs/trunk/common/common-functions
Log:
more corrections to CLFS scripts.

Modified: jhalfs/trunk/CLFS/master.sh
===================================================================
--- jhalfs/trunk/CLFS/master.sh	2006-07-03 17:42:30 UTC (rev 2814)
+++ jhalfs/trunk/CLFS/master.sh	2006-07-03 23:49:13 UTC (rev 2815)
@@ -41,43 +41,43 @@
 
 025-addinguser:  024-creatingcrossdir
 	@\$(call echo_message, Building)
-	@if [ ! -d /home/lfs ]; then \\
-		groupadd lfs; \\
-		useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
+	@if [ ! -d /home/clfs ]; then \\
+		groupadd clfs; \\
+		useradd -s /bin/bash -g clfs -m -k /dev/null clfs; \\
 	else \\
-		touch user-lfs-exist; \\
+		touch user-clfs-exist; \\
 	fi;
-	@chown lfs \$(MOUNT_PT) && \\
-	chown lfs \$(MOUNT_PT)/tools && \\
-	chown lfs \$(MOUNT_PT)/cross-tools && \\
-	chown lfs \$(MOUNT_PT)/sources && \\
+	@chown clfs \$(MOUNT_PT) && \\
+	chown clfs \$(MOUNT_PT)/tools && \\
+	chown clfs \$(MOUNT_PT)/cross-tools && \\
+	chown clfs \$(MOUNT_PT)/sources && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)
 
 026-settingenvironment:  025-addinguser
 	@\$(call echo_message, Building)
-	@if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\
-		mv /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
+	@if [ -f /home/clfs/.bashrc -a ! -f /home/clfs/.bashrc.XXX ]; then \\
+		mv /home/clfs/.bashrc /home/clfs/.bashrc.XXX; \\
 	fi;
-	@if [ -f /home/lfs/.bash_profile  -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
-		mv /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
+	@if [ -f /home/clfs/.bash_profile  -a ! -f /home/clfs/.bash_profile.XXX ]; then \\
+		mv /home/clfs/.bash_profile /home/clfs/.bash_profile.XXX; \\
 	fi;
-	@echo "set +h" > /home/lfs/.bashrc && \\
-	echo "umask 022" >> /home/lfs/.bashrc && \\
-	echo "CLFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\
-	echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
-	echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
-	echo "export CLFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
-	echo "" >> /home/lfs/.bashrc && \\
-	echo "unset CFLAGS" >> /home/lfs/.bashrc && \\
-	echo "unset CXXFLAGS" >> /home/lfs/.bashrc && \\
-	echo "" >> /home/lfs/.bashrc && \\
-	echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/lfs/.bashrc && \\
-	echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/lfs/.bashrc && \\
-	echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/lfs/.bashrc && \\
-	echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc
-	@chown lfs:lfs /home/lfs/.bashrc && \\
+	@echo "set +h" > /home/clfs/.bashrc && \\
+	echo "umask 022" >> /home/clfs/.bashrc && \\
+	echo "CLFS=\$(MOUNT_PT)" >> /home/clfs/.bashrc && \\
+	echo "LC_ALL=POSIX" >> /home/clfs/.bashrc && \\
+	echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/clfs/.bashrc && \\
+	echo "export CLFS LC_ALL PATH" >> /home/clfs/.bashrc && \\
+	echo "" >> /home/clfs/.bashrc && \\
+	echo "unset CFLAGS" >> /home/clfs/.bashrc && \\
+	echo "unset CXXFLAGS" >> /home/clfs/.bashrc && \\
+	echo "" >> /home/clfs/.bashrc && \\
+	echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/clfs/.bashrc && \\
+	echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/clfs/.bashrc && \\
+	echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/clfs/.bashrc && \\
+	echo "source $JHALFSDIR/envars" >> /home/clfs/.bashrc
+	@chown clfs:clfs /home/clfs/.bashrc && \\
 	touch envars && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
@@ -131,9 +131,9 @@
     #
     # If $pkg_tarball isn't empty, we've got a package...
     #
-    [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball"
     #
-    wrt_run_as_su "${this_script}" "${file}"
+    wrt_run_as_clfs_su "${this_script}" "${file}"
     #
     [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
@@ -190,10 +190,10 @@
     # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and to set the PKGDIR variable.
     #
-    [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball"
     [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     #
-    wrt_run_as_su "${this_script}" "${file}"
+    wrt_run_as_clfs_su "${this_script}" "${file}"
     #
     [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
@@ -262,7 +262,7 @@
     # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
     #
-    [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball"
     [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     #
     # Select a script execution method
@@ -272,10 +272,10 @@
       *fstab*)   if [[ -n "$FSTAB" ]]; then
                    wrt_copy_fstab "${this_script}"
                  else
-                   wrt_run_as_su  "${this_script}" "${file}"
+                   wrt_run_as_clfs_su  "${this_script}" "${file}"
                  fi
          ;;
-      *)         wrt_run_as_su  "${this_script}" "${file}"       ;;
+      *)         wrt_run_as_clfs_su  "${this_script}" "${file}"       ;;
     esac
     #
     # Housekeeping...remove any build directory(ies) except if the package build fails.
@@ -332,7 +332,7 @@
     #
     if [ "$pkg_tarball" != "" ] ; then
       case $this_script in
-        *util-linux)    wrt_unpack  "$pkg_tarball"  ;;
+        *util-linux)    wrt_unpack_clfs  "$pkg_tarball"  ;;
         *)              wrt_unpack2 "$pkg_tarball"  ;;
       esac
       [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
@@ -341,7 +341,7 @@
     # Select a script execution method
     case $this_script in
       *kernfs)        wrt_run_as_clfs_root "${this_script}" "${file}"  ;;
-      *util-linux)    wrt_run_as_su        "${this_script}" "${file}"  ;;
+      *util-linux)    wrt_run_as_clfs_s    "${this_script}" "${file}"  ;;
       *)              wrt_run_as_chroot1   "${this_script}" "${file}"  ;;
     esac
     #
@@ -1063,20 +1063,20 @@
 	@echo "This feature does not exist for the CLFS makefile. (yet)"
 
 clean-chapter2:
-	-if [ ! -f user-lfs-exist ]; then \\
-		userdel lfs; \\
-		rm -rf /home/lfs; \\
+	-if [ ! -f user-clfs-exist ]; then \\
+		userdel clfs; \\
+		rm -rf /home/clfs; \\
 	fi;
 	rm -rf \$(MOUNT_PT)/tools
 	rm -f /tools
 	rm -rf \$(MOUNT_PT)/cross-tools
 	rm -f /cross-tools
-	rm -f envars user-lfs-exist
+	rm -f envars user-clfs-exist
 	rm -f 02* logs/02*.log
 
 clean-chapter3:
 	rm -rf \$(MOUNT_PT)/tools/*
-	rm -f $cross_tools restore-lfs-env sources-dir
+	rm -f $cross_tools restore-clfs-env sources-dir
 	cd logs && rm -f $cross_tools && cd ..
 
 clean-chapter4:
@@ -1090,15 +1090,15 @@
 	cd logs && rm -f $temptools && cd ..
 
 
-restore-lfs-env:
+restore-clfs-env:
 	@\$(call echo_message, Building)
-	@if [ -f /home/lfs/.bashrc.XXX ]; then \\
-		mv -f /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
+	@if [ -f /home/clfs/.bashrc.XXX ]; then \\
+		mv -f /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
 	fi;
-	@if [ -f /home/lfs/.bash_profile.XXX ]; then \\
-		mv /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
+	@if [ -f /home/clfs/.bash_profile.XXX ]; then \\
+		mv /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
 	fi;
-	@chown lfs:lfs /home/lfs/.bash* && \\
+	@chown clfs:clfs /home/clfs/.bash* && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)
@@ -1109,9 +1109,9 @@
 	@-umount \$(MOUNT_PT)/dev
 	@-umount \$(MOUNT_PT)/sys
 	@-umount \$(MOUNT_PT)/proc
-	@-if [ ! -f user-lfs-exist ]; then \\
-		userdel lfs; \\
-		rm -rf /home/lfs; \\
+	@-if [ ! -f user-clfs-exist ]; then \\
+		userdel clfs; \\
+		rm -rf /home/clfs; \\
 	fi;
 
 EOF
@@ -1145,21 +1145,21 @@
 	@echo "This feature does not exist for the CLFS makefile. (yet)"
 
 clean-jhalfs:
-	-if [ ! -f user-lfs-exist ]; then \\
-		userdel lfs; \\
-		rm -rf /home/lfs; \\
+	-if [ ! -f user-clfs-exist ]; then \\
+		userdel clfs; \\
+		rm -rf /home/clfs; \\
 	fi;
 	rm -rf \$(MOUNT_PT)/tools
 	rm -f /tools
 	rm -rf \$(MOUNT_PT)/cross-tools
 	rm -f /cross-tools
-	rm -f envars user-lfs-exist
+	rm -f envars user-clfs-exist
 	rm -f 02* logs/02*.log
 
 clean-makeboot:
 	rm -rf /tools/*
 	rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools
-	rm -f restore-lfs-env sources-dir
+	rm -f restore-clfs-env sources-dir
 	cd logs && rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools && cd ..
 
 clean-makesys:
@@ -1175,15 +1175,15 @@
 	cd logs && rm -f $basicsystem && rm -f $bootscripttools && rm -f $bootabletools && cd ..
 
 
-restore-lfs-env:
+restore-clfs-env:
 	@\$(call echo_message, Building)
-	@if [ -f /home/lfs/.bashrc.XXX ]; then \\
-		mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
+	@if [ -f /home/clfs/.bashrc.XXX ]; then \\
+		mv -fv /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
 	fi;
-	@if [ -f /home/lfs/.bash_profile.XXX ]; then \\
-		mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
+	@if [ -f /home/clfs/.bash_profile.XXX ]; then \\
+		mv -v /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
 	fi;
-	@chown lfs:lfs /home/lfs/.bash* && \\
+	@chown clfs:clfs /home/clfs/.bash* && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)

Modified: jhalfs/trunk/common/common-functions
===================================================================
--- jhalfs/trunk/common/common-functions	2006-07-03 17:42:30 UTC (rev 2814)
+++ jhalfs/trunk/common/common-functions	2006-07-03 23:49:13 UTC (rev 2815)
@@ -279,6 +279,26 @@
 
 
 #----------------------------------#
+wrt_unpack_clfs() {                # Unpack and set 'ROOT' var
+#----------------------------------#
+  local FILE=$1
+  local optSAVE_PREVIOUS=$2
+
+  if [ "${optSAVE_PREVIOUS}" != "1" ]; then
+    wrt_remove_existing_dirs "$FILE"
+  fi
+(
+cat << EOF
+	@\$(call unpack,$FILE)
+	@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
+	echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
+	chown -R clfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
 wrt_unpack2() {                    #
 #----------------------------------#
   local FILE=$1
@@ -381,6 +401,20 @@
 
 
 #----------------------------------#
+wrt_run_as_clfs_su() {             # Execute script inside time { }, footer to log file
+#----------------------------------#
+  local this_script=$1
+  local file=$2
+(
+cat << EOF
+	@( time { su - clfs -c "source /home/clfs/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
+	echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
 wrt_run_as_clfs_root() {           # Some scripts must be run as root..
 #----------------------------------#
   local this_script=$1




More information about the alfs-log mailing list