Triying to manage the cases where the lfs user is already present in the host.
This commit is contained in:
parent
d13460c8e7
commit
8ebf1542d5
1 changed files with 27 additions and 5 deletions
32
jhalfs
32
jhalfs
|
@ -327,6 +327,10 @@ _IS_() # Function to test build scripts names
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
chapter4_Makefiles() {
|
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
|
cat << EOF
|
||||||
020-creatingtoolsdir:
|
020-creatingtoolsdir:
|
||||||
|
@ -338,14 +342,22 @@ chapter4_Makefiles() {
|
||||||
|
|
||||||
021-addinguser: 020-creatingtoolsdir
|
021-addinguser: 020-creatingtoolsdir
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@groupadd lfs && \\
|
@if [ ! -d /home/lfs ]; then \\
|
||||||
useradd -s /bin/bash -g lfs -m -k /dev/null lfs && \\
|
groupadd lfs; \\
|
||||||
chown lfs \$(LFS)/tools && \\
|
useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
|
||||||
|
fi;
|
||||||
|
@chown lfs \$(LFS)/tools && \\
|
||||||
chown lfs \$(LFS)/sources && \\
|
chown lfs \$(LFS)/sources && \\
|
||||||
touch \$@
|
touch \$@
|
||||||
|
|
||||||
022-settingenvironment: 021-addinguser
|
022-settingenvironment: 021-addinguser
|
||||||
@\$(call echo_message, Building)
|
@\$(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 "set +h" > /home/lfs/.bashrc && \\
|
||||||
echo "umask 022" >> /home/lfs/.bashrc && \\
|
echo "umask 022" >> /home/lfs/.bashrc && \\
|
||||||
echo "LFS=/mnt/lfs" >> /home/lfs/.bashrc && \\
|
echo "LFS=/mnt/lfs" >> /home/lfs/.bashrc && \\
|
||||||
|
@ -819,7 +831,7 @@ all: chapter4 chapter5 chapter6 chapter789
|
||||||
|
|
||||||
chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
|
chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
|
||||||
|
|
||||||
chapter5: chapter4 $chapter5
|
chapter5: chapter4 $chapter5 restore-lfs-env
|
||||||
|
|
||||||
chapter6: chapter5 $chapter6
|
chapter6: chapter5 $chapter6
|
||||||
|
|
||||||
|
@ -840,7 +852,7 @@ clean-chapter4:
|
||||||
|
|
||||||
clean-chapter5:
|
clean-chapter5:
|
||||||
rm -rf \$(LFS)/tools/*
|
rm -rf \$(LFS)/tools/*
|
||||||
rm -f $chapter5
|
rm -f $chapter5 restore-lfs-env
|
||||||
cd logs && rm -f $chapter5 && cd ..
|
cd logs && rm -f $chapter5 && cd ..
|
||||||
|
|
||||||
clean-chapter6:
|
clean-chapter6:
|
||||||
|
@ -857,6 +869,16 @@ clean-chapter789:
|
||||||
rm -f $chapter789
|
rm -f $chapter789
|
||||||
cd logs && rm -f $chapter789 && cd ..
|
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
|
EOF
|
||||||
) >> $MKFILE
|
) >> $MKFILE
|
||||||
|
|
Reference in a new issue