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

georgeb at linuxfromscratch.org georgeb at linuxfromscratch.org
Fri Aug 4 13:06:16 PDT 2006


Author: georgeb
Date: 2006-08-04 14:06:15 -0600 (Fri, 04 Aug 2006)
New Revision: 2877

Modified:
   jhalfs/branches/experimental/CLFS/config
   jhalfs/branches/experimental/CLFS/master.sh
   jhalfs/branches/experimental/CLFS2/config
   jhalfs/branches/experimental/CLFS2/master.sh
   jhalfs/branches/experimental/Config.in
   jhalfs/branches/experimental/HLFS/config
   jhalfs/branches/experimental/HLFS/master.sh
   jhalfs/branches/experimental/LFS/config
   jhalfs/branches/experimental/LFS/master.sh
   jhalfs/branches/experimental/README
   jhalfs/branches/experimental/common/common-functions
   jhalfs/branches/experimental/common/func_validate_configs.sh
   jhalfs/branches/experimental/master.sh
Log:
Implement suggestion made byDan Nicholson for configurable user/group. Required many changes and allowed for the removal of user specific function calls. Tnx Dan

Modified: jhalfs/branches/experimental/CLFS/config
===================================================================
--- jhalfs/branches/experimental/CLFS/config	2006-08-04 14:29:00 UTC (rev 2876)
+++ jhalfs/branches/experimental/CLFS/config	2006-08-04 20:06:15 UTC (rev 2877)
@@ -6,6 +6,10 @@
 #
 #####
 
+#--- Unprivileged user and group name
+LUSER=clfs
+LGROUP=clfs
+
 #--- Which target architecture you want to build for,
 #    used to select proper book and set TARGETS
 #--------------------------------
@@ -38,6 +42,10 @@
 #    NOTE: not all combinations are 'bootable' yet.
 METHOD=chroot
 
+#--- Unprivileged user and group name
+LUSER=clfs
+LGROUP=clfs
+
 #--- Location of fstab file (if empty, a template is created)
 FSTAB=
 

Modified: jhalfs/branches/experimental/CLFS/master.sh
===================================================================
--- jhalfs/branches/experimental/CLFS/master.sh	2006-08-04 14:29:00 UTC (rev 2876)
+++ jhalfs/branches/experimental/CLFS/master.sh	2006-08-04 20:06:15 UTC (rev 2877)
@@ -41,43 +41,43 @@
 
 025-addinguser:  024-creatingcrossdir
 	@\$(call echo_message, Building)
-	@if [ ! -d /home/clfs ]; then \\
-		groupadd clfs; \\
-		useradd -s /bin/bash -g clfs -m -k /dev/null clfs; \\
+	@if [ ! -d /home/\$(LUSER) ]; then \\
+		groupadd \$(LGROUP); \\
+		useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
 	else \\
 		touch user-clfs-exist; \\
 	fi;
-	@chown clfs \$(MOUNT_PT) && \\
-	chown clfs \$(MOUNT_PT)/tools && \\
-	chown clfs \$(MOUNT_PT)/cross-tools && \\
-	chown clfs \$(MOUNT_PT)/sources && \\
+	@chown \$(LUSER) \$(MOUNT_PT) && \\
+	chown \$(LUSER) \$(MOUNT_PT)/tools && \\
+	chown \$(LUSER) \$(MOUNT_PT)/cross-tools && \\
+	chown \$(LUSER) \$(MOUNT_PT)/sources && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)
 
 026-settingenvironment:  025-addinguser
 	@\$(call echo_message, Building)
-	@if [ -f /home/clfs/.bashrc -a ! -f /home/clfs/.bashrc.XXX ]; then \\
-		mv /home/clfs/.bashrc /home/clfs/.bashrc.XXX; \\
+	@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
+		mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
 	fi;
-	@if [ -f /home/clfs/.bash_profile  -a ! -f /home/clfs/.bash_profile.XXX ]; then \\
-		mv /home/clfs/.bash_profile /home/clfs/.bash_profile.XXX; \\
+	@if [ -f /home/\$(LUSER)/.bash_profile  -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
+		mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
 	fi;
-	@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 && \\
+	@echo "set +h" > /home/\$(LUSER)/.bashrc && \\
+	echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
+	echo "CLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
+	echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
+	echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
+	echo "export CLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
+	echo "" >> /home/\$(LUSER)/.bashrc && \\
+	echo "unset CFLAGS" >> /home/\$(LUSER)/.bashrc && \\
+	echo "unset CXXFLAGS" >> /home/\$(LUSER)/.bashrc && \\
+	echo "" >> /home/\$(LUSER)/.bashrc && \\
+	echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/\$(LUSER)/.bashrc && \\
+	echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/\$(LUSER)/.bashrc && \\
+	echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\
+	echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
+	@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.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_clfs "$pkg_tarball"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
     #
-    wrt_run_as_clfs_su "${this_script}" "${file}"
+    wrt_RunAsUser "${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_clfs "$pkg_tarball"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
     [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     #
-    wrt_run_as_clfs_su "${this_script}" "${file}"
+    wrt_RunAsUser "${this_script}" "${file}"
     #
     [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
@@ -262,20 +262,20 @@
     # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
     #
-    [[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
     [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     #
     # Select a script execution method
     case $this_script in
-      *changingowner*)  wrt_run_as_clfs_root "${this_script}" "${file}"    ;;
-      *devices*)        wrt_run_as_clfs_root "${this_script}" "${file}"    ;;
+      *changingowner*)  wrt_RunAsRoot "${this_script}" "${file}"    ;;
+      *devices*)        wrt_RunAsRoot "${this_script}" "${file}"    ;;
       *fstab*)   if [[ -n "$FSTAB" ]]; then
                    wrt_copy_fstab "${this_script}"
                  else
-                   wrt_run_as_clfs_su  "${this_script}" "${file}"
+                   wrt_RunAsUser  "${this_script}" "${file}"
                  fi
          ;;
-      *)         wrt_run_as_clfs_su  "${this_script}" "${file}"       ;;
+      *)         wrt_RunAsUser  "${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_clfs  "$pkg_tarball"  ;;
+        *util-linux)    wrt_unpack  "$pkg_tarball"  ;;
         *)              wrt_unpack2 "$pkg_tarball"  ;;
       esac
       [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
@@ -340,9 +340,9 @@
     #
     # Select a script execution method
     case $this_script in
-      *kernfs)        wrt_run_as_clfs_root "${this_script}" "${file}"  ;;
-      *util-linux)    wrt_run_as_clfs_su   "${this_script}" "${file}"  ;;
-      *)              wrt_run_as_chroot1   "${this_script}" "${file}"  ;;
+      *kernfs)      wrt_RunAsRoot "${this_script}" "${file}"  ;;
+      *util-linux)  wrt_RunAsUser "${this_script}" "${file}"  ;;
+      *)            wrt_run_as_chroot1  "${this_script}" "${file}"  ;;
     esac
     #
     # Housekeeping...remove the build directory(ies), except if the package build fails.
@@ -757,7 +757,7 @@
     this_script=`basename $file`
 
     case $this_script in
-      *udev*) continue    ;;  # This is not a script but a commentary
+      *udev) continue    ;;  # This is not a script but a commentary
       *console*) continue ;; # Use the files that came with the bootscripts
       *)  ;;
     esac
@@ -773,8 +773,8 @@
                                   -e 's at 64@@' \
                                   -e 's at n32@@'`
     case $name in
-      *bootscripts*) name=bootscripts-cross-lfs
-       ;;
+      *bootscripts*) name=bootscripts-cross-lfs ;;
+      *udev-rules)   name=udev-cross-lfs ;;
     esac
 
     pkg_tarball=$(get_package_tarball_name $name)
@@ -1012,6 +1012,8 @@
 SRC= /sources
 MOUNT_PT= $BUILDDIR
 PKG_LST= $PKG_LST
+LUSER= $LUSER
+LGROUP= $LGROUP
 
 include makefile-functions
 
@@ -1064,8 +1066,8 @@
 
 clean-chapter2:
 	-if [ ! -f user-clfs-exist ]; then \\
-		userdel clfs; \\
-		rm -rf /home/clfs; \\
+		userdel \$(LUSER); \\
+		rm -rf /home/\$(LUSER); \\
 	fi;
 	rm -rf \$(MOUNT_PT)/tools
 	rm -f /tools
@@ -1092,13 +1094,13 @@
 
 restore-clfs-env:
 	@\$(call echo_message, Building)
-	@if [ -f /home/clfs/.bashrc.XXX ]; then \\
-		mv -f /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
+	@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
+		mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
 	fi;
-	@if [ -f /home/clfs/.bash_profile.XXX ]; then \\
-		mv /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
+	@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
+		mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
 	fi;
-	@chown clfs:clfs /home/clfs/.bash* && \\
+	@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)
@@ -1110,8 +1112,8 @@
 	@-umount \$(MOUNT_PT)/sys
 	@-umount \$(MOUNT_PT)/proc
 	@-if [ ! -f user-clfs-exist ]; then \\
-		userdel clfs; \\
-		rm -rf /home/clfs; \\
+		userdel \$(LUSER); \\
+		rm -rf /home/\$(LUSER); \\
 	fi;
 
 EOF
@@ -1146,8 +1148,8 @@
 
 clean-jhalfs:
 	-if [ ! -f user-clfs-exist ]; then \\
-		userdel clfs; \\
-		rm -rf /home/clfs; \\
+		userdel \$(LUSER); \\
+		rm -rf /home/\$(LUSER); \\
 	fi;
 	rm -rf \$(MOUNT_PT)/tools
 	rm -f /tools
@@ -1177,13 +1179,13 @@
 
 restore-clfs-env:
 	@\$(call echo_message, Building)
-	@if [ -f /home/clfs/.bashrc.XXX ]; then \\
-		mv -fv /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
+	@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
+		mv -fv /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
 	fi;
-	@if [ -f /home/clfs/.bash_profile.XXX ]; then \\
-		mv -v /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
+	@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
+		mv -v /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
 	fi;
-	@chown clfs:clfs /home/clfs/.bash* && \\
+	@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)

Modified: jhalfs/branches/experimental/CLFS2/config
===================================================================
--- jhalfs/branches/experimental/CLFS2/config	2006-08-04 14:29:00 UTC (rev 2876)
+++ jhalfs/branches/experimental/CLFS2/config	2006-08-04 20:06:15 UTC (rev 2877)
@@ -5,7 +5,11 @@
 # $Id$
 #
 #####
+#--- Unprivileged user and group name
+LUSER=clfs
+LGROUP=clfs
 
+
 #--- Which target architecture you want to build for,
 #    used to select proper book and set TARGETS
 #--------------------------------
@@ -21,6 +25,10 @@
 #--------------------------------
 # >>>> MULTILIB 32/64 <<<<
 
+#--- Unprivileged user and group name
+LUSER=clfs
+LGROUP=clfs
+
 #--- Location of fstab file (if empty, a template is created)
 FSTAB=
 

Modified: jhalfs/branches/experimental/CLFS2/master.sh
===================================================================
--- jhalfs/branches/experimental/CLFS2/master.sh	2006-08-04 14:29:00 UTC (rev 2876)
+++ jhalfs/branches/experimental/CLFS2/master.sh	2006-08-04 20:06:15 UTC (rev 2877)
@@ -5,42 +5,7 @@
 ###          FUNCTIONS          ###
 ###################################
 
-#----------------------------------#
-wrt_ExecuteAsUser() {              # Execute the file ($3) under the users account ($1), log in $2
-#----------------------------------#
-  local this_user=$1
-  local this_script=$2
-  local file=$3
-(
-cat << EOF
-	@( time { su - ${this_user} -c "source /home/${this_user}/.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_Unpack_SetOwner() {            # Unpack and set owner. Assign 'ROOT' var
-#----------------------------------#
-  local USER_ACCT=$1
-  local FILE=$2
-  local optSAVE_PREVIOUS=$3
-
-  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 ${USER_ACCT} \$(MOUNT_PT)\$(SRC)/\$\$ROOT
-EOF
-) >> $MKFILE.tmp
-}
-
-
 #----------------------------#
 host_prep_Makefiles() {      # Initialization of the system
 #----------------------------#
@@ -67,42 +32,42 @@
 
 025-addinguser:  023-creatingtoolsdir
 	@\$(call echo_message, Building)
-	@if [ ! -d /home/clfs ]; then \\
-		groupadd clfs; \\
-		useradd -s /bin/bash -g clfs -m -k /dev/null clfs; \\
+	@if [ ! -d /home/\$(LUSER) ]; then \\
+		groupadd \$(LGROUP); \\
+		useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
 	else \\
 		touch user-clfs-exist; \\
 	fi;
-	@chown clfs \$(MOUNT_PT) && \\
-	chown clfs \$(MOUNT_PT)/tools && \\
-	chown clfs \$(MOUNT_PT)/sources
+	@chown \$(LUSER) \$(MOUNT_PT) && \\
+	chown \$(LUSER) \$(MOUNT_PT)/tools && \\
+	chown \$(LUSER) \$(MOUNT_PT)/sources
 	@touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)
 
 026-settingenvironment:  025-addinguser
 	@\$(call echo_message, Building)
-	@if [ -f /home/clfs/.bashrc -a ! -f /home/clfs/.bashrc.XXX ]; then \\
-		mv /home/clfs/.bashrc /home/clfs/.bashrc.XXX; \\
+	@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
+		mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
 	fi;
-	@if [ -f /home/clfs/.bash_profile  -a ! -f /home/clfs/.bash_profile.XXX ]; then \\
-		mv /home/clfs/.bash_profile /home/clfs/.bash_profile.XXX; \\
+	@if [ -f /home/\$(LUSER)/.bash_profile  -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
+		mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
 	fi;
-	@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=\$(MOUNT_PT)/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 && \\
+	@echo "set +h" > /home/\$(LUSER)/.bashrc && \\
+	echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
+	echo "CLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
+	echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
+	echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
+	echo "export CLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
+	echo "" >> /home/\$(LUSER)/.bashrc && \\
+	echo "unset CFLAGS" >> /home/\$(LUSER)/.bashrc && \\
+	echo "unset CXXFLAGS" >> /home/\$(LUSER)/.bashrc && \\
+	echo "" >> /home/\$(LUSER)/.bashrc && \\
+	echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/\$(LUSER)/.bashrc && \\
+	echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/\$(LUSER)/.bashrc && \\
+	echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\
+	echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
+	@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
 	touch envars
 	@touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
@@ -153,7 +118,7 @@
 
 	@touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp}
 	@chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog
-	@chown -R clfs \$(MOUNT_PT)
+	@chown -R \$(LUSER) \$(MOUNT_PT)
 
 	@touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
@@ -199,7 +164,6 @@
       glibc-headers) name="glibc" ;;
     esac
     pkg_tarball=$(get_package_tarball_name $name)
-
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     #--------------------------------------------------------------------#
@@ -210,12 +174,12 @@
     #
     # If $pkg_tarball isn't empty, we've got a package...
     if [ "$pkg_tarball" != "" ] ; then
-       wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
+       wrt_unpack "$pkg_tarball"
        # If using optimizations, write the instructions
        [[ "$OPTIMIZE" != "0" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     fi
     #
-    wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
+    wrt_RunAsUser "${this_script}" "${file}"
     #
     [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
@@ -308,12 +272,12 @@
     #
     # If $pkg_tarball isn't empty, we've got a package...
     if [ "$pkg_tarball" != "" ] ; then
-      wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
+      wrt_unpack "$pkg_tarball"
       # If using optimizations, write the instructions
       [[ "$OPTIMIZE" != "0" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     fi
     #
-    wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
+    wrt_RunAsUser "${this_script}" "${file}"
     #
     [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
@@ -374,9 +338,9 @@
     wrt_target "${this_script}" "$PREV"
     #
     # If $pkg_tarball isn't empty, we've got a package...
-    [[ "$pkg_tarball" != "" ]] && wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
     #
-    wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
+    wrt_RunAsUser "${this_script}" "${file}"
     #
     [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
@@ -436,17 +400,19 @@
     wrt_target "${this_script}" "$PREV"
     #
     # If $pkg_tarball isn't empty, we've got a package...
-    [[ "$pkg_tarball" != "" ]] && wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
     #
     # Select a script execution method
     case $this_script in
       *fstab*)  if [[ -n "$FSTAB" ]]; then
                   wrt_copy_fstab "${this_script}"
                 else
-                  wrt_ExecuteAsUser "clfs"  "${this_script}" "${file}"
+                  wrt_RunAsUser "${this_script}" "${file}"
                 fi
           ;;
-      *)  wrt_ExecuteAsUser "clfs"  "${this_script}" "${file}" 
+      *chowning)  wrt_RunAsRoot "${this_script}" "${file}" 
+          ;;
+              *)  wrt_RunAsUser "${this_script}" "${file}" 
 	  ;;
     esac
     #
@@ -495,6 +461,8 @@
 SRC= /sources
 MOUNT_PT= $BUILDDIR
 PKG_LST= $PKG_LST
+LUSER= $LUSER
+LGROUP= $LGROUP
 
 include makefile-functions
 
@@ -528,21 +496,21 @@
 
 restore-clfs-env:
 	@\$(call echo_message, Building)
-	@if [ -f /home/clfs/.bashrc.XXX ]; then \\
-		mv -f /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
+	@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
+		mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
 	fi;
-	@if [ -f /home/clfs/.bash_profile.XXX ]; then \\
-		mv /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
+	@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
+		mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
 	fi;
-	@chown clfs:clfs /home/clfs/.bash* && \\
+	@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)
 
 do-housekeeping:
 	@-if [ ! -f user-clfs-exist ]; then \\
-		userdel clfs; \\
-		rm -rf /home/clfs; \\
+		userdel \$(LUSER); \\
+		rm -rf /home/\$(LUSER); \\
 	fi;
 
 EOF

Modified: jhalfs/branches/experimental/Config.in
===================================================================
--- jhalfs/branches/experimental/Config.in	2006-08-04 14:29:00 UTC (rev 2876)
+++ jhalfs/branches/experimental/Config.in	2006-08-04 20:06:15 UTC (rev 2877)
@@ -29,6 +29,7 @@
 		default	"./blfs"	if BOOK_BLFS
 
 
+
 #--- Book version
 #menu	"Book Version"		
 	choice
@@ -58,8 +59,55 @@
 			#--- The full path to a local copy of the book
 			#
 #endmenu
+#-----------------------
+
+#--- Set User Account
+	config	CONFIG_USER
+		bool	"Change the default user/group for this build"
+		default	n
+		help	#--- Unprivileged user and group name
+			#    If you do not have the priv to create/delete
+			#    users and groups you can specifiy your own
+			#    user id for the build
+			# default values for each book
+			# LFS   lfs
+			# CLFS  clfs
+			# CLFS2 clfs
+			# HLFS  hlfs
+
+	config	DEF_USER
+		string
+		default	"lfs"	if BOOK_LFS
+		default	"blfs"	if BOOK_BLFS
+		default	"clfs"	if BOOK_CLFS || BOOK_CLFS2
+		default "hlfs"	if BOOK_HLFS
+
+	config	SET_USER		
+		string	"User account"
+		depends	CONFIG_USER
+		default	DEF_USER
+
+
+	config	CONFIG_GROUP
+		bool	"Set Group?"
+		default	n
+		depends	CONFIG_USER
 		
-#-----------------------
+	config	SET_GROUP		
+		string	"GROUP account"
+		depends	CONFIG_GROUP
+		default	DEF_USER
+
+	config	LUSER
+		string
+		default	DEF_USER	if !CONFIG_USER
+		default	SET_USER	if  CONFIG_USER
+
+	config	LGROUP
+		string
+		default	LUSER		if !CONFIG_GROUP
+		default	SET_GROUP	if  CONFIG_GROUP
+------------------------
 	
 comment	"--------CLFS specific params---------"
 depends on BOOK_CLFS || BOOK_CLFS2

Modified: jhalfs/branches/experimental/HLFS/config
===================================================================
--- jhalfs/branches/experimental/HLFS/config	2006-08-04 14:29:00 UTC (rev 2876)
+++ jhalfs/branches/experimental/HLFS/config	2006-08-04 20:06:15 UTC (rev 2877)
@@ -6,12 +6,20 @@
 #
 #####
 
+#--- Unprivileged user and group name
+LUSER=hlfs
+LGROUP=hlfs
+
 #--- Which library model to use uclibc/glibc
 MODEL=glibc
 
 #--- The host system has grsecurity options enabled? 0(no)/1(yes)
 GRSECURITY_HOST=0
 
+#--- Unprivileged user and group name
+LUSER=hlfs
+LGROUP=hlfs
+
 #--- Location of fstab file (if empty, a template is created)
 FSTAB=
 

Modified: jhalfs/branches/experimental/HLFS/master.sh
===================================================================
--- jhalfs/branches/experimental/HLFS/master.sh	2006-08-04 14:29:00 UTC (rev 2876)
+++ jhalfs/branches/experimental/HLFS/master.sh	2006-08-04 20:06:15 UTC (rev 2877)
@@ -7,58 +7,6 @@
 ###          FUNCTIONS          ###
 ###################################
 
-#----------------------------------#
-wrt_ExecuteAsUser() {              # Execute the file ($3) under the users account ($1), log in $2
-#----------------------------------#
-  local this_user=$1
-  local this_script=$2
-  local file=$3
-
-(
-cat << EOF
-	@( time { su - ${this_user} -c "source /home/${this_user}/.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_Unpack_SetOwner() {            # Unpack and set owner. Assign 'ROOT' var
-#----------------------------------#
-  local USER_ACCT=$1
-  local FILE=$2
-  local optSAVE_PREVIOUS=$3
-
-  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 ${USER_ACCT} \$(MOUNT_PT)\$(SRC)/\$\$ROOT
-EOF
-) >> $MKFILE.tmp
-}
-
-#----------------------------------#
-wrt_RunAsRoot() {                  # Some scripts must be run as root..
-#----------------------------------#
-  local user_ACCT=$(echo $1 | tr [a-z] [A-Z])
-  local this_script=$2
-  local file=$3
-
-(
-cat << EOF
-	@( time { export ${user_ACCT}=\$(MOUNT_PT) && ${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
-}
-
-
 #----------------------------#
 process_toolchain() {        # embryo,cocoon and butterfly need special handling
 #----------------------------#
@@ -85,11 +33,11 @@
 	@echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)" > envars
 EOF
 ) >> $MKFILE.tmp
-      wrt_ExecuteAsUser "hlfs" "$toolchain" "$this_script"
+      wrt_RunAsUser "$toolchain" "$this_script"
       ;;
   esac
   #
-  # Safe method to remove packages unpacked outside the toolchain
+  # Safe method to remove packages unpacked while inside the toolchain script
   pkg_tarball=$(get_package_tarball_name "binutils")
   wrt_remove_existing_dirs  "$pkg_tarball"
   pkg_tarball=$(get_package_tarball_name "gcc-core")
@@ -140,38 +88,38 @@
 
 021-addinguser:  020-creatingtoolsdir
 	@\$(call echo_message, Building)
-	@if [ ! -d /home/hlfs ]; then \\
-		groupadd hlfs; \\
-		useradd -s /bin/bash -g hlfs -m -k /dev/null hlfs; \\
+	@if [ ! -d /home/\$(LUSER) ]; then \\
+		groupadd \$(LGROUP); \\
+		useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
 	else \\
 		touch user-hlfs-exist; \\
 	fi;
-	@chown hlfs \$(MOUNT_PT)/tools && \\
-	chown hlfs \$(MOUNT_PT)/sources && \\
+	@chown \$(LUSER) \$(MOUNT_PT)/tools && \\
+	chown \$(LUSER) \$(MOUNT_PT)/sources && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)
 
 022-settingenvironment:  021-addinguser
 	@\$(call echo_message, Building)
-	@if [ -f /home/hlfs/.bashrc -a ! -f /home/hlfs/.bashrc.XXX ]; then \\
-		mv /home/hlfs/.bashrc /home/hlfs/.bashrc.XXX; \\
+	@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
+		mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
 	fi;
-	@if [ -f /home/hlfs/.bash_profile  -a ! -f /home/hlfs/.bash_profile.XXX ]; then \\
-		mv /home/hlfs/.bash_profile /home/hlfs/.bash_profile.XXX; \\
+	@if [ -f /home/\$(LUSER)/.bash_profile  -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
+		mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
 	fi;
-	@echo "set +h" > /home/hlfs/.bashrc && \\
-	echo "umask 022" >> /home/hlfs/.bashrc && \\
-	echo "HLFS=\$(MOUNT_PT)" >> /home/hlfs/.bashrc && \\
-	echo "LC_ALL=POSIX" >> /home/hlfs/.bashrc && \\
-	echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/hlfs/.bashrc && \\
-	echo "export HLFS LC_ALL PATH" >> /home/hlfs/.bashrc && \\
-	echo "" >> /home/hlfs/.bashrc && \\
-	echo "target=$(uname -m)-${TARGET}" >> /home/lfs/.bashrc && \\
-	echo "ldso=/tools/lib/${LOADER}" >> /home/lfs/.bashrc && \\
-	echo "export target ldso" >> /home/lfs/.bashrc && \\
-	echo "source $JHALFSDIR/envars" >> /home/hlfs/.bashrc && \\
-	chown hlfs:hlfs /home/hlfs/.bashrc && \\
+	@echo "set +h" > /home/\$(LUSER)/.bashrc && \\
+	echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
+	echo "HLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
+	echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
+	echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
+	echo "export HLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
+	echo "" >> /home/\$(LUSER)/.bashrc && \\
+	echo "target=$(uname -m)-${TARGET}" >> /home/\$(LUSER)/.bashrc && \\
+	echo "ldso=/tools/lib/${LOADER}" >> /home/\$(LUSER)/.bashrc && \\
+	echo "export target ldso" >> /home/\$(LUSER)/.bashrc && \\
+	echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\
+	chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
 	touch envars && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
@@ -246,13 +194,13 @@
     # If $pkg_tarball isn't empty, we've got a package...
     if [ "$pkg_tarball" != "" ] ; then
       # Insert instructions for unpacking the package and to set the PKGDIR variable.
-      wrt_Unpack_SetOwner "hlfs" "$pkg_tarball"
+      wrt_unpack "$pkg_tarball"
       # If using optimizations, write the instructions
       [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     fi
     # Insert date and disk usage at the top of the log file, the script run
     # and date and disk usage again at the bottom of the log file.
-    wrt_ExecuteAsUser "hlfs" "$this_script" "${file}"
+    wrt_RunAsUser "$this_script" "${file}"
 
     # Remove the build directory(ies) except if the package build fails
     # (so we can review config.cache, config.log, etc.)
@@ -379,7 +327,7 @@
     # In the mount of kernel filesystems we need to set HLFS and not to use chroot.
     case "${this_script}" in
       *kernfs*)
-        wrt_RunAsRoot "hlfs" "${this_script}" "${file}"
+        wrt_RunAsRoot "${this_script}" "${file}"
         ;;
       *)   # The rest of Chapter06
         wrt_run_as_chroot1 "${this_script}" "${file}"
@@ -521,6 +469,8 @@
 SRC= /sources
 MOUNT_PT= $BUILDDIR
 PKG_LST= $PKG_LST
+LUSER= $LUSER
+LGROUP= $LGROUP
 
 include makefile-functions
 
@@ -568,8 +518,8 @@
 
 clean-chapter3:
 	-if [ ! -f user-hlfs-exist ]; then \\
-		userdel hlfs; \\
-		rm -rf /home/hlfs; \\
+		userdel \$(LUSER); \\
+		rm -rf /home/\$(LUSER); \\
 	fi;
 	rm -rf \$(MOUNT_PT)/tools
 	rm -f /tools
@@ -597,13 +547,13 @@
 
 restore-hlfs-env:
 	@\$(call echo_message, Building)
-	@if [ -f /home/hlfs/.bashrc.XXX ]; then \\
-		mv -f /home/hlfs/.bashrc.XXX /home/hlfs/.bashrc; \\
+	@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
+		mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
 	fi;
-	@if [ -f /home/hlfs/.bash_profile.XXX ]; then \\
-		mv /home/hlfs/.bash_profile.XXX /home/hlfs/.bash_profile; \\
+	@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
+		mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
 	fi;
-	@chown hlfs:hlfs /home/hlfs/.bash* && \\
+	@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)
@@ -615,8 +565,8 @@
 	@-umount \$(MOUNT_PT)/sys
 	@-umount \$(MOUNT_PT)/proc
 	@-if [ ! -f user-hlfs-exist ]; then \\
-		userdel hlfs; \\
-		rm -rf /home/hlfs; \\
+		userdel \$(LUSER); \\
+		rm -rf /home/\$(LUSER); \\
 	fi;
 
 restart_code:

Modified: jhalfs/branches/experimental/LFS/config
===================================================================
--- jhalfs/branches/experimental/LFS/config	2006-08-04 14:29:00 UTC (rev 2876)
+++ jhalfs/branches/experimental/LFS/config	2006-08-04 20:06:15 UTC (rev 2877)
@@ -6,6 +6,10 @@
 #
 #####
 
+#--- Unprivileged user and group name
+LUSER=lfs
+LGROUP=lfs
+
 #--- Location of fstab file (if empty, a template is created)
 FSTAB=
 

Modified: jhalfs/branches/experimental/LFS/master.sh
===================================================================
--- jhalfs/branches/experimental/LFS/master.sh	2006-08-04 14:29:00 UTC (rev 2876)
+++ jhalfs/branches/experimental/LFS/master.sh	2006-08-04 20:06:15 UTC (rev 2877)
@@ -29,13 +29,13 @@
 
 021-addinguser:  020-creatingtoolsdir
 	@\$(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/\$(LUSER) ]; then \\
+		groupadd \$(LGROUP); \\
+		useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
 	else \\
 		touch user-lfs-exist; \\
 	fi;
-	@chown lfs \$(MOUNT_PT)/tools && \\
+	@chown \$(LUSER) \$(MOUNT_PT)/tools && \\
 	chmod a+wt \$(MOUNT_PT)/sources && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
@@ -43,20 +43,20 @@
 
 022-settingenvironment:  021-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/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
+		mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.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/\$(LUSER)/.bash_profile  -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
+		mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
 	fi;
-	@echo "set +h" > /home/lfs/.bashrc && \\
-	echo "umask 022" >> /home/lfs/.bashrc && \\
-	echo "LFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\
-	echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
-	echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
-	echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
-	echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\
-	chown lfs:lfs /home/lfs/.bashrc && \\
+	@echo "set +h" > /home/\$(LUSER)/.bashrc && \\
+	echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
+	echo "LFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
+	echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
+	echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
+	echo "export LFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
+	echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\
+	chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
 	touch envars && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
@@ -122,8 +122,8 @@
     # and date and disk usage again at the bottom of the log file.
     # The changingowner script must be run as root.
     case "${this_script}" in
-      *changingowner)  wrt_run_as_root    "${this_script}" "$file" ;;
-      *)               wrt_run_as_su      "${this_script}" "$file" ;;
+      *changingowner)  wrt_RunAsRoot "${this_script}" "$file" ;;
+      *)               wrt_RunAsUser "${this_script}" "$file" ;;
     esac
 
     # Remove the build directory(ies) except if the package build fails
@@ -234,7 +234,7 @@
     # In the mount of kernel filesystems we need to set LFS
     # and not to use chroot.
     case "${this_script}" in
-      *kernfs)  wrt_run_as_root    "${this_script}" "$file" ;;
+      *kernfs)  wrt_RunAsRoot    "${this_script}" "$file" ;;
       *)        wrt_run_as_chroot1 "${this_script}" "$file" ;;
     esac
 
@@ -368,6 +368,8 @@
 SRC= /sources
 MOUNT_PT= $BUILDDIR
 PKG_LST= $PKG_LST
+LUSER= $LUSER
+LGROUP= $LGROUP
 
 include makefile-functions
 
@@ -409,8 +411,8 @@
 
 clean-chapter4:
 	-if [ ! -f user-lfs-exist ]; then \\
-		userdel lfs; \\
-		rm -rf /home/lfs; \\
+		userdel \$(LUSER); \\
+		rm -rf /home/\$(LUSER); \\
 	fi;
 	rm -rf \$(MOUNT_PT)/tools
 	rm -f /tools
@@ -438,13 +440,13 @@
 
 restore-lfs-env:
 	@\$(call echo_message, Building)
-	@if [ -f /home/lfs/.bashrc.XXX ]; then \\
-		mv -f /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
+	@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
+		mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
 	fi;
-	@if [ -f /home/lfs/.bash_profile.XXX ]; then \\
-		mv /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
+	@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
+		mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
 	fi;
-	@chown lfs:lfs /home/lfs/.bash* && \\
+	@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)
@@ -456,8 +458,8 @@
 	@-umount \$(MOUNT_PT)/dev/pts
 	@-umount \$(MOUNT_PT)/dev
 	@-if [ ! -f user-lfs-exist ]; then \\
-		userdel lfs; \\
-		rm -rf /home/lfs; \\
+		userdel \$(LUSER); \\
+		rm -rf /home/\$(LUSER); \\
 	fi;
 
 restart_code:

Modified: jhalfs/branches/experimental/README
===================================================================
--- jhalfs/branches/experimental/README	2006-08-04 14:29:00 UTC (rev 2876)
+++ jhalfs/branches/experimental/README	2006-08-04 20:06:15 UTC (rev 2877)
@@ -32,15 +32,21 @@
      ::NEWS:: There is new configuration method for jhalfs.
      
      We have installed the familiar menu based configuration tool driven by
-     make. If you type the command <make> you will be presented with a list of
-     configurable parameters (starting with the book you wish to use). All the
-     parameters found in the individual config files are available. Once you
-     have finished setting the parameters and exit the make file will launch
-     the chosen book version of jhalfs. JHALFS will import your created file
-     and overider the values found in normal "config" files.
+     make. If you type the command 
+       make
+     you will be presented with a list of configurable parameters (starting
+     with the book you wish to use). All the parameters found in the individual
+     config files are available. Once you have finished setting the parameters
+     and exit the make file will launch the chosen book version of jhalfs.
+     JHALFS will import your created file and overider the values found in normal
+     "config" files.
      ..note.. The generated file <configuration> is only used by jhalfs if you
      run jhalfs via make otherwise it is ignored.
      
+     If you want to try out the new configuration system without running jhalfs
+     issue the following.
+       make menuconfig
+     This will create a new file named configuration but will not launch jhalfs.
    
 4. RUNNING::
      The script master.sh cannot be invoked directly but only via the
@@ -158,6 +164,7 @@
 
     Q. "It doesn't work!"
     A. Yes it does, try ./lfs --help
+       Remember you must either be 'root' to run this script or have 'sudo' privileges.
 
     Q. "It still doesn't work"
     A. jhalfs was designed to work against the developement versions of the LFS
@@ -200,6 +207,14 @@
        simple and reliable method of doing so. This method also handles the CLFS
        build method where the final build may be done on a separate machine.
 
+    Q. "What is the function of LUSER and LGROUP? There is no cmd line switch"
+    A. If you are running jhalfs from a low or non-priveledged account you may not
+       have the priv to create/delete accounts. These variables are adjustable
+       when invoking make. 
+         make LUSER=myaccount LGROUP=mygroup
+       Then only changes to your account will be the creation of a NEW .bashrc after
+       saving your original to .bashrc.XXX
+    
     Q. "When I try to build 'xxx' with clfs the makefile fails at the mid-point"
     A. There could be numerous reasons for the failure but the most likely reason
        is you are doing a cross-build using the 'chroot' method and the target is

Modified: jhalfs/branches/experimental/common/common-functions
===================================================================
--- jhalfs/branches/experimental/common/common-functions	2006-08-04 14:29:00 UTC (rev 2876)
+++ jhalfs/branches/experimental/common/common-functions	2006-08-04 20:06:15 UTC (rev 2877)
@@ -253,8 +253,9 @@
    # hopefully this will not cause problems.
    #
    case $script_name in
-     tcl)   echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
-     *)     echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
+     tcl)           echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
+     linux-headers) echo $(grep "^linux-headers.*.bz2" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
+     *)             echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
    esac
 
 }
@@ -309,33 +310,13 @@
 	@\$(call unpack,$FILE)
 	@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
 	echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
-	chown -R lfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT
+	chown -R \$(LUSER) \$(MOUNT_PT)\$(SRC)/\$\$ROOT
 EOF
 ) >> $MKFILE.tmp
 }
 
 
 #----------------------------------#
-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
@@ -379,7 +360,7 @@
 (
 cat  << EOF
 	@echo "export TEST_LOG=$TESTLOGDIR/$TESTLOGFILE" >> envars && \\
-	su - lfs -c "echo -e '\n\`date\`\n' >$TESTLOGDIR/$TESTLOGFILE"
+	su - \$(LUSER) -c "echo -e '\n\`date\`\n' >$TESTLOGDIR/$TESTLOGFILE"
 EOF
 ) >> $MKFILE.tmp
 }
@@ -410,13 +391,13 @@
 
 
 #----------------------------------#
-wrt_run_as_su() {                  # Execute script inside time { }, footer to log file
+wrt_RunAsUser() {                  # Execute script inside time { }, footer to log file
 #----------------------------------#
   local this_script=$1
   local file=$2
 (
 cat << EOF
-	@( time { su - lfs -c "source /home/lfs/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
+	@( time { su - \$(LUSER) -c "source /home/\$(LUSER)/.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
@@ -424,27 +405,24 @@
 
 
 #----------------------------------#
-wrt_run_as_root() {                # Some scripts must be run as root..
+wrt_RunAsRoot() {                  # Some scripts must be run as root..
 #----------------------------------#
+  local ENV_MOUNT
   local this_script=$1
   local file=$2
-(
-cat << EOF
-	@( time { export LFS=\$(MOUNT_PT) && ${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_su() {             # Execute script inside time { }, footer to log file
-#----------------------------------#
-  local this_script=$1
-  local file=$2
+  case ${PROGNAME} in
+    lfs   ) MOUNT_ENV="LFS" ;;
+    blfs  ) MOUNT_ENV="BLFS" ;;
+    clfs  ) MOUNT_ENV="CLFS" ;;
+    clfs2 ) MOUNT_ENV="CLFS" ;;
+    hlfs  ) MOUNT_ENV="HLFS" ;;
+    *) echo "undefined progname $PROGNAME"; exit 1
+  esac
+  
 (
 cat << EOF
-	@( time { su - clfs -c "source /home/clfs/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
+	@( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${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
@@ -452,20 +430,6 @@
 
 
 #----------------------------------#
-wrt_run_as_clfs_root() {           # Some scripts must be run as root..
-#----------------------------------#
-  local this_script=$1
-  local file=$2
-(
-cat << EOF
-	@( time { export CLFS=\$(MOUNT_PT) && ${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_root2() {               #
 #----------------------------------#
   local this_script=$1
@@ -479,7 +443,6 @@
 }
 
 
-
 #----------------------------------#
 wrt_run_as_chroot1() {             #
 #----------------------------------#
@@ -538,9 +501,9 @@
 (
 cat << EOF
 	@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
-	rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
+	rm -rf \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
 	if [ -e \$(MOUNT_PT)\$(SRC)/$name-build ]; then \\
-		rm -r \$(MOUNT_PT)\$(SRC)/$name-build; \\
+		rm -rf \$(MOUNT_PT)\$(SRC)/$name-build; \\
 	fi;
 EOF
 ) >> $MKFILE.tmp
@@ -554,9 +517,9 @@
 (
 cat << EOF
 	@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
-	rm -r \$(SRC)/\$\$ROOT && \\
+	rm -rf \$(SRC)/\$\$ROOT && \\
 	if [ -e \$(SRC)/$name-build ]; then \\
-		rm -r \$(SRC)/$name-build; \\
+		rm -rf \$(SRC)/$name-build; \\
 	fi;
 EOF
 ) >> $MKFILE.tmp

Modified: jhalfs/branches/experimental/common/func_validate_configs.sh
===================================================================
--- jhalfs/branches/experimental/common/func_validate_configs.sh	2006-08-04 14:29:00 UTC (rev 2876)
+++ jhalfs/branches/experimental/common/func_validate_configs.sh	2006-08-04 20:06:15 UTC (rev 2877)
@@ -86,10 +86,10 @@
 inline_doc
 
   # First internal variables, then the ones that change the book's flavour, and lastly system configuration variables
-  local -r  hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG GETKERNEL KEYMAP         PAGE TIMEZONE LANG LC_ALL"
-  local -r  clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD  ARCH  TARGET  TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG"
-  local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE         ARCH  TARGET       OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG"
-  local -r   lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE                       TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG GETKERNEL        VIMLANG PAGE TIMEZONE LANG"
+  local -r  hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG GETKERNEL KEYMAP         PAGE TIMEZONE LANG LC_ALL LUSER LGROUP"
+  local -r  clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD  ARCH  TARGET  TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG LUSER LGROUP"
+  local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE         ARCH  TARGET       OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG LUSER LGROUP"
+  local -r   lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE                       TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG GETKERNEL        VIMLANG PAGE TIMEZONE LANG LUSER LGROUP"
 
   local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,'
   local -r ERROR_MSG_pt2=' check the config file ${BOLD}${GREEN}\<$(echo $PROGNAME | tr [a-z] [A-Z])/config\> or \<common/config\>${OFF}'
@@ -213,6 +213,12 @@
       METHOD)     validate_against_str "xchrootx xbootx" ;;
       ARCH)       validate_against_str "xx86x xx86_64x xx86_64-64x xsparcx xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xppc64x xalphax xarmx" ;;
       TARGET)     validate_target ;;
+      LUSER)      echo -e "`eval echo $PARAM_VALS`" 
+                  [[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die
+		  ;;
+      LGROUP)     echo -e "`eval echo $PARAM_VALS`"
+                  [[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die
+                  ;;
       GRSECURITY_HOST)  validate_against_str "x0x x1x" ;;
 
       # BOOK validation. Very ugly, need be fixed

Modified: jhalfs/branches/experimental/master.sh
===================================================================
--- jhalfs/branches/experimental/master.sh	2006-08-04 14:29:00 UTC (rev 2876)
+++ jhalfs/branches/experimental/master.sh	2006-08-04 20:06:15 UTC (rev 2877)
@@ -70,6 +70,8 @@
 
 if [[ -e using_menuconfig ]]; then
   source configuration
+
+
 	#--- Working directories
   SCRIPT_ROOT=jhalfs
     JHALFSDIR=$BUILDDIR/$SCRIPT_ROOT




More information about the alfs-log mailing list