Added support for host that place home dirs under a directory othen than /home.
Request and partial patch from Mario Lang.
This commit is contained in:
parent
16938b0ee9
commit
962793a098
8 changed files with 153 additions and 135 deletions
|
@ -32,7 +32,7 @@ cat << EOF
|
|||
|
||||
025-addinguser: 024-creatingcrossdir
|
||||
@\$(call echo_message, Building)
|
||||
@if [ ! -d /home/\$(LUSER) ]; then \\
|
||||
@if [ ! -d \$(LUSER_HOME) ]; then \\
|
||||
groupadd \$(LGROUP); \\
|
||||
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
||||
else \\
|
||||
|
@ -46,27 +46,27 @@ cat << EOF
|
|||
|
||||
026-settingenvironment: 025-addinguser
|
||||
@\$(call echo_message, Building)
|
||||
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
||||
mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
|
||||
fi;
|
||||
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
||||
mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
|
||||
fi;
|
||||
@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 && \\
|
||||
@echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "CLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export CLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "unset CFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "unset CXXFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export CLFS_TARGET=\"${TARGET}\"" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export CLFS_TARGET32=\"${TARGET32}\"" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc
|
||||
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
|
||||
touch envars && \\
|
||||
chmod -R a+wt \$(MOUNT_PT) && \\
|
||||
chown -R \$(LUSER) \$(MOUNT_PT)/\$(SCRIPT_ROOT)
|
||||
|
@ -840,7 +840,7 @@ do-housekeeping:
|
|||
@-rm /tools /cross-tools
|
||||
@-if [ ! -f luser-exist ]; then \\
|
||||
userdel \$(LUSER); \\
|
||||
rm -rf /home/\$(LUSER); \\
|
||||
rm -rf \$(LUSER_HOME); \\
|
||||
fi;
|
||||
|
||||
EOF
|
||||
|
@ -929,7 +929,7 @@ do-housekeeping:
|
|||
@-rm /tools /cross-tools
|
||||
@-if [ ! -f luser-exist ]; then \\
|
||||
userdel \$(LUSER); \\
|
||||
rm -rf /home/\$(LUSER); \\
|
||||
rm -rf \$(LUSER_HOME); \\
|
||||
fi;
|
||||
|
||||
EOF
|
||||
|
@ -941,13 +941,13 @@ fi
|
|||
|
||||
restore-luser-env:
|
||||
@\$(call echo_message, Building)
|
||||
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
||||
mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
|
||||
fi;
|
||||
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
||||
mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
|
||||
fi;
|
||||
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
||||
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
|
||||
touch \$@ && \\
|
||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||
|
|
|
@ -20,7 +20,7 @@ cat << EOF
|
|||
|
||||
025-addinguser:
|
||||
@\$(call echo_message, Building)
|
||||
@if [ ! -d /home/\$(LUSER) ]; then \\
|
||||
@if [ ! -d \$(LUSER_HOME) ]; then \\
|
||||
groupadd \$(LGROUP); \\
|
||||
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
||||
else \\
|
||||
|
@ -30,26 +30,26 @@ cat << EOF
|
|||
|
||||
026-settingenvironment: 025-addinguser
|
||||
@\$(call echo_message, Building)
|
||||
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
||||
mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
|
||||
fi;
|
||||
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
||||
mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
|
||||
fi;
|
||||
@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 "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
|
||||
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
||||
@echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "CLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export CLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "unset CFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "unset CXXFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export CLFS_TARGET=\"${TARGET}\"" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc
|
||||
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
|
||||
touch envars && \\
|
||||
chown \$(LUSER):\$(LGROUP) envars
|
||||
@\$(call housekeeping)
|
||||
|
@ -475,13 +475,13 @@ create-sbu_du-report: mk_LUSER
|
|||
|
||||
restore-luser-env:
|
||||
@\$(call echo_message, Building)
|
||||
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
||||
mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
|
||||
fi;
|
||||
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
||||
mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
|
||||
fi;
|
||||
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
||||
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
|
||||
touch \$@ && \\
|
||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||
|
@ -489,7 +489,7 @@ restore-luser-env:
|
|||
do-housekeeping:
|
||||
@-if [ ! -f luser-exist ]; then \\
|
||||
userdel \$(LUSER); \\
|
||||
rm -rf /home/\$(LUSER); \\
|
||||
rm -rf \$(LUSER_HOME); \\
|
||||
fi;
|
||||
|
||||
EOF
|
||||
|
|
|
@ -20,7 +20,7 @@ cat << EOF
|
|||
|
||||
025-addinguser:
|
||||
@\$(call echo_message, Building)
|
||||
@if [ ! -d /home/\$(LUSER) ]; then \\
|
||||
@if [ ! -d \$(LUSER_HOME) ]; then \\
|
||||
groupadd \$(LGROUP); \\
|
||||
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
||||
else \\
|
||||
|
@ -30,28 +30,28 @@ cat << EOF
|
|||
|
||||
026-settingenvironment: 025-addinguser
|
||||
@\$(call echo_message, Building)
|
||||
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
||||
mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
|
||||
fi;
|
||||
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
||||
mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
|
||||
fi;
|
||||
@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_MIPS_LEVEL=\"${MIPS_LEVEL}\"" >> /home/\$(LUSER)/.bashrc && \\
|
||||
echo "export BUILD=\"${ABI}\"" >> /home/\$(LUSER)/.bashrc && \\
|
||||
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
|
||||
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
||||
@echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "CLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export CLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "unset CFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "unset CXXFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export CLFS_TARGET=\"${TARGET}\"" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export CLFS_MIPS_LEVEL=\"${MIPS_LEVEL}\"" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export BUILD=\"${ABI}\"" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc
|
||||
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
|
||||
touch envars && \\
|
||||
chown \$(LUSER):\$(LGROUP) envars
|
||||
@\$(call housekeeping)
|
||||
|
@ -514,13 +514,13 @@ create-sbu_du-report: mk_LUSER
|
|||
|
||||
restore-luser-env:
|
||||
@\$(call echo_message, Building)
|
||||
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
||||
mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
|
||||
fi;
|
||||
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
||||
mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
|
||||
fi;
|
||||
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
||||
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
|
||||
touch \$@ && \\
|
||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||
|
@ -528,7 +528,7 @@ restore-luser-env:
|
|||
do-housekeeping:
|
||||
@-if [ ! -f luser-exist ]; then \\
|
||||
userdel \$(LUSER); \\
|
||||
rm -rf /home/\$(LUSER); \\
|
||||
rm -rf \$(LUSER_HOME); \\
|
||||
fi;
|
||||
|
||||
EOF
|
||||
|
|
28
Config.in
28
Config.in
|
@ -536,7 +536,7 @@ menu "--- General Settings"
|
|||
|
||||
#--- Set User Account
|
||||
config CONFIG_USER
|
||||
bool "Change the default user/group for this build"
|
||||
bool "Change the default user/group and homedir for this build"
|
||||
default n
|
||||
help #-- Unprivileged user and group name
|
||||
# If you do not have the priv to create/delete
|
||||
|
@ -544,10 +544,12 @@ menu "--- General Settings"
|
|||
# user id for the build
|
||||
#
|
||||
# default values for each book
|
||||
# LFS lfs
|
||||
# CLFS clfs
|
||||
# CLFS2 clfs
|
||||
# HLFS hlfs
|
||||
# LFS lfs
|
||||
# CLFS* clfs
|
||||
# HLFS hlfs
|
||||
#
|
||||
# Also, if your host place users home dirs into a
|
||||
# directory other than /home you can specify it here.
|
||||
|
||||
config DEF_USER
|
||||
string
|
||||
|
@ -560,7 +562,6 @@ menu "--- General Settings"
|
|||
depends CONFIG_USER
|
||||
default DEF_USER
|
||||
|
||||
|
||||
config CONFIG_GROUP
|
||||
bool "Set Group?"
|
||||
default n
|
||||
|
@ -571,6 +572,16 @@ menu "--- General Settings"
|
|||
depends CONFIG_GROUP
|
||||
default DEF_USER
|
||||
|
||||
config CONFIG_HOME
|
||||
bool "Set home dir?"
|
||||
default n
|
||||
depends CONFIG_USER
|
||||
|
||||
config SET_HOME
|
||||
string "Path to the directory where user home dir will be created"
|
||||
depends CONFIG_HOME
|
||||
default "/home"
|
||||
|
||||
config LUSER
|
||||
string
|
||||
default DEF_USER if !CONFIG_USER
|
||||
|
@ -580,6 +591,11 @@ menu "--- General Settings"
|
|||
string
|
||||
default LUSER if !CONFIG_GROUP
|
||||
default SET_GROUP if CONFIG_GROUP
|
||||
|
||||
config LHOME
|
||||
string
|
||||
default "/home" if !CONFIG_HOME
|
||||
default SET_HOME if CONFIG_HOME
|
||||
#--- End Set User Account
|
||||
|
||||
config BUILDDIR
|
||||
|
|
|
@ -100,7 +100,7 @@ chapter3_Makefiles() { # Initialization of the system
|
|||
TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2"
|
||||
fi
|
||||
|
||||
# If /home/$LUSER is already present in the host, we asume that the
|
||||
# If $LUSER_HOME is already present in the host, we asume that the
|
||||
# hlfs user and group are also presents in the host, and a backup
|
||||
# of their bash init files is made.
|
||||
(
|
||||
|
@ -114,7 +114,7 @@ cat << EOF
|
|||
|
||||
021-addinguser: 020-creatingtoolsdir
|
||||
@\$(call echo_message, Building)
|
||||
@if [ ! -d /home/\$(LUSER) ]; then \\
|
||||
@if [ ! -d \$(LUSER_HOME) ]; then \\
|
||||
groupadd \$(LGROUP); \\
|
||||
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
||||
else \\
|
||||
|
@ -127,24 +127,24 @@ cat << EOF
|
|||
|
||||
022-settingenvironment: 021-addinguser
|
||||
@\$(call echo_message, Building)
|
||||
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
||||
mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
|
||||
fi;
|
||||
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
||||
mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
|
||||
fi;
|
||||
@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 && \\
|
||||
@echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "HLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "PATH=/tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export HLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "target=$(uname -m)-${TARGET}" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "ldso=/tools/lib/${LOADER}" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export target ldso" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
|
||||
chmod -R a+wt \$(MOUNT_PT) && \\
|
||||
touch envars && \\
|
||||
chown \$(LUSER) envars
|
||||
|
@ -612,13 +612,13 @@ create-sbu_du-report: mk_BOOT
|
|||
|
||||
restore-luser-env:
|
||||
@\$(call echo_message, Building)
|
||||
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
||||
mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
|
||||
fi;
|
||||
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
||||
mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
|
||||
fi;
|
||||
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
||||
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
|
||||
touch \$@ && \\
|
||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||
|
@ -632,7 +632,7 @@ do-housekeeping:
|
|||
@-rm /tools
|
||||
@-if [ ! -f luser-exist ]; then \\
|
||||
userdel \$(LUSER); \\
|
||||
rm -rf /home/\$(LUSER); \\
|
||||
rm -rf \$(LUSER_HOME); \\
|
||||
fi;
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ chapter4_Makefiles() { #
|
|||
#----------------------------#
|
||||
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4 ( SETUP ) ${R_arrow}"
|
||||
|
||||
# If /home/$LUSER is already present in the host, we asume that the
|
||||
# If $LUSER_HOME 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.
|
||||
(
|
||||
|
@ -29,7 +29,7 @@ chapter4_Makefiles() { #
|
|||
|
||||
021-addinguser: 020-creatingtoolsdir
|
||||
@\$(call echo_message, Building)
|
||||
@if [ ! -d /home/\$(LUSER) ]; then \\
|
||||
@if [ ! -d \$(LUSER_HOME) ]; then \\
|
||||
groupadd \$(LGROUP); \\
|
||||
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
||||
else \\
|
||||
|
@ -42,20 +42,20 @@ chapter4_Makefiles() { #
|
|||
|
||||
022-settingenvironment: 021-addinguser
|
||||
@\$(call echo_message, Building)
|
||||
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
||||
mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
|
||||
fi;
|
||||
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
||||
mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
|
||||
fi;
|
||||
@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 && \\
|
||||
@echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "LFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "PATH=/tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "export LFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc && \\
|
||||
chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
|
||||
touch envars && \\
|
||||
chown \$(LUSER) envars
|
||||
@\$(call housekeeping)
|
||||
|
@ -478,13 +478,13 @@ create-sbu_du-report: mk_BOOT
|
|||
|
||||
restore-luser-env:
|
||||
@\$(call echo_message, Building)
|
||||
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
||||
mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
|
||||
fi;
|
||||
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
||||
@if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
||||
mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
|
||||
fi;
|
||||
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash*
|
||||
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash*
|
||||
@\$(call housekeeping)
|
||||
|
||||
do_housekeeping:
|
||||
|
@ -496,7 +496,7 @@ do_housekeeping:
|
|||
@-rm /tools
|
||||
@-if [ ! -f luser-exist ]; then \\
|
||||
userdel \$(LUSER); \\
|
||||
rm -rf /home/\$(LUSER); \\
|
||||
rm -rf \$(LUSER_HOME); \\
|
||||
fi;
|
||||
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@ validate_config() { # Are the config values sane (within reason)
|
|||
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 BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL PAGE TIMEZONE LANG LC_ALL LUSER LGROUP BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TARGET32 TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET REPORT STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r clfs3_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH PLATFORM TARGET MIPS_LEVEL REPORT FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL PAGE TIMEZONE LANG LC_ALL LUSER LGROUP LHOME BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TARGET32 TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP LHOME BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET REPORT STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP LHOME BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r clfs3_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH PLATFORM TARGET MIPS_LEVEL REPORT FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP LHOME CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP LHOME BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR"
|
||||
|
||||
local -r blfs_tool_PARAM_LIST="BLFS_BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR DEP_LIBXML DEP_LIBXSLT DEP_TIDY DEP_UNZIP DEP_DBXML DEP_DBXSL DEP_LINKS DEP_SUDO DEP_WGET DEP_SVN DEP_GPM"
|
||||
|
@ -163,6 +163,7 @@ inline_doc
|
|||
# The build directory/partition MUST exist and be writable by the user
|
||||
BUILDDIR) validate_dir -z -d -w
|
||||
[[ "xx x/x" =~ x${!config_param}x ]] && write_error_and_die ;;
|
||||
LHOME) validate_dir -z -d ;;
|
||||
|
||||
# Validate files, testable states:
|
||||
# fatal -z -e -s -w -x -r,
|
||||
|
|
|
@ -22,6 +22,7 @@ MOUNT_PT = $BUILDDIR
|
|||
PKG_LST = $PKG_LST
|
||||
LUSER = $LUSER
|
||||
LGROUP = $LGROUP
|
||||
LHOME = $LHOME
|
||||
SCRIPT_ROOT = $SCRIPT_ROOT
|
||||
|
||||
BASEDIR = \$(MOUNT_PT)
|
||||
|
@ -35,7 +36,7 @@ crLOGDIR = /\$(SCRIPT_ROOT)/logs
|
|||
crTESTLOGDIR = /\$(SCRIPT_ROOT)/test-logs
|
||||
|
||||
SU_LUSER = su - \$(LUSER) -c
|
||||
LUSER_HOME = /home/\$(LUSER)
|
||||
LUSER_HOME = \$(LHOME)/\$(LUSER)
|
||||
PRT_DU = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found \$(MOUNT_PT) \`\n"
|
||||
PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found / \`\n"
|
||||
|
||||
|
|
Reference in a new issue