From b6ca3232fbac28d093a0feb9e58d6e8e03d24e1d Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Wed, 23 Nov 2005 20:26:36 +0000 Subject: [PATCH] Merged r2196, r2197 and r2202 from trunk. --- jhalfs | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/jhalfs b/jhalfs index d4818d4..2a8b0e2 100755 --- a/jhalfs +++ b/jhalfs @@ -327,6 +327,10 @@ _IS_() # Function to test build scripts names #----------------------------# chapter4_Makefiles() { #----------------------------# + +# If /home/lfs is already present in the host, we asume that the +# lfs user and group are also presents in the host, and a backup +# of their bash init files is made. ( cat << EOF 020-creatingtoolsdir: @@ -338,14 +342,24 @@ chapter4_Makefiles() { 021-addinguser: 020-creatingtoolsdir @\$(call echo_message, Building) - @groupadd lfs && \\ - useradd -s /bin/bash -g lfs -m -k /dev/null lfs && \\ - chown lfs \$(LFS)/tools && \\ + @if [ ! -d /home/lfs ]; then \\ + groupadd lfs; \\ + useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\ + else \\ + touch user-lfs-exist; \\ + fi; + @chown lfs \$(LFS)/tools && \\ chown lfs \$(LFS)/sources && \\ touch \$@ 022-settingenvironment: 021-addinguser @\$(call echo_message, Building) + @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\ + mv -v /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\ + fi; + @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\ + mv -v /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\ + fi; @echo "set +h" > /home/lfs/.bashrc && \\ echo "umask 022" >> /home/lfs/.bashrc && \\ echo "LFS=/mnt/lfs" >> /home/lfs/.bashrc && \\ @@ -819,28 +833,30 @@ all: chapter4 chapter5 chapter6 chapter789 chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment -chapter5: chapter4 $chapter5 +chapter5: chapter4 $chapter5 restore-lfs-env chapter6: chapter5 $chapter6 chapter789: chapter6 $chapter789 clean-all: clean - rm -rf ./* + rm -rf ./{commands,logs,Makefile,dump-lfs-scripts.xsl,functions,packages,patches} clean: clean-chapter789 clean-chapter6 clean-chapter5 clean-chapter4 clean-chapter4: - -userdel lfs - rm -rf /home/lfs + -if [ ! -f user-lfs-exist ]; then \\ + userdel lfs; \\ + rm -rf /home/lfs; \\ + fi; rm -rf \$(LFS)/tools rm -f /tools - rm -f envars + rm -f envars user-lfs-exist rm -f 02* logs/02*.log clean-chapter5: rm -rf \$(LFS)/tools/* - rm -f $chapter5 + rm -f $chapter5 restore-lfs-env sources-dir cd logs && rm -f $chapter5 && cd .. clean-chapter6: @@ -857,6 +873,16 @@ clean-chapter789: rm -f $chapter789 cd logs && rm -f $chapter789 && cd .. +restore-lfs-env: + @\$(call echo_message, Building) + @if [ -f /home/lfs/.bashrc.XXX ]; then \\ + mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\ + fi; + @if [ -f /home/lfs/.bash_profile.XXX ]; then \\ + mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\ + fi; + @chown lfs:lfs /home/lfs/.bash* && \\ + touch \$@ EOF ) >> $MKFILE