Ported LUSER code and last CLFS2 fix from experimental.
This commit is contained in:
parent
983db9f6aa
commit
6ad5a2fbb7
11 changed files with 313 additions and 370 deletions
|
@ -38,6 +38,10 @@ TARGET=
|
||||||
# NOTE: not all combinations are 'bootable' yet.
|
# NOTE: not all combinations are 'bootable' yet.
|
||||||
METHOD=chroot
|
METHOD=chroot
|
||||||
|
|
||||||
|
#--- Unprivileged user and group name
|
||||||
|
LUSER=clfs
|
||||||
|
LGROUP=clfs
|
||||||
|
|
||||||
#--- Location of fstab file (if empty, a template is created)
|
#--- Location of fstab file (if empty, a template is created)
|
||||||
FSTAB=
|
FSTAB=
|
||||||
|
|
||||||
|
|
159
CLFS/master.sh
159
CLFS/master.sh
|
@ -41,43 +41,43 @@ cat << EOF
|
||||||
|
|
||||||
025-addinguser: 024-creatingcrossdir
|
025-addinguser: 024-creatingcrossdir
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ ! -d /home/clfs ]; then \\
|
@if [ ! -d /home/\$(LUSER) ]; then \\
|
||||||
groupadd clfs; \\
|
groupadd \$(LGROUP); \\
|
||||||
useradd -s /bin/bash -g clfs -m -k /dev/null clfs; \\
|
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
||||||
else \\
|
else \\
|
||||||
touch user-clfs-exist; \\
|
touch luser-exist; \\
|
||||||
fi;
|
fi;
|
||||||
@chown clfs \$(MOUNT_PT) && \\
|
@chown \$(LUSER) \$(MOUNT_PT) && \\
|
||||||
chown clfs \$(MOUNT_PT)/tools && \\
|
chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
||||||
chown clfs \$(MOUNT_PT)/cross-tools && \\
|
chown \$(LUSER) \$(MOUNT_PT)/cross-tools && \\
|
||||||
chown clfs \$(MOUNT_PT)/sources && \\
|
chown \$(LUSER) \$(MOUNT_PT)/sources && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
|
||||||
026-settingenvironment: 025-addinguser
|
026-settingenvironment: 025-addinguser
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/clfs/.bashrc -a ! -f /home/clfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv /home/clfs/.bashrc /home/clfs/.bashrc.XXX; \\
|
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/clfs/.bash_profile -a ! -f /home/clfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/clfs/.bash_profile /home/clfs/.bash_profile.XXX; \\
|
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@echo "set +h" > /home/clfs/.bashrc && \\
|
@echo "set +h" > /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "umask 022" >> /home/clfs/.bashrc && \\
|
echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "CLFS=\$(MOUNT_PT)" >> /home/clfs/.bashrc && \\
|
echo "CLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "LC_ALL=POSIX" >> /home/clfs/.bashrc && \\
|
echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/clfs/.bashrc && \\
|
echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS LC_ALL PATH" >> /home/clfs/.bashrc && \\
|
echo "export CLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "" >> /home/clfs/.bashrc && \\
|
echo "" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "unset CFLAGS" >> /home/clfs/.bashrc && \\
|
echo "unset CFLAGS" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "unset CXXFLAGS" >> /home/clfs/.bashrc && \\
|
echo "unset CXXFLAGS" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "" >> /home/clfs/.bashrc && \\
|
echo "" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/clfs/.bashrc && \\
|
echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/clfs/.bashrc && \\
|
echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/clfs/.bashrc && \\
|
echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "source $JHALFSDIR/envars" >> /home/clfs/.bashrc
|
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
|
||||||
@chown clfs:clfs /home/clfs/.bashrc && \\
|
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
||||||
touch envars && \\
|
touch envars && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
|
@ -131,9 +131,9 @@ cross_tools_Makefiles() { #
|
||||||
#
|
#
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# 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}"
|
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
||||||
#
|
#
|
||||||
|
@ -190,10 +190,10 @@ temptools_Makefiles() { #
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
# 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"
|
[[ "$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}"
|
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
||||||
#
|
#
|
||||||
|
@ -262,20 +262,20 @@ boot_Makefiles() { #
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
# Insert instructions for unpacking the package and changing directories
|
# 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"
|
[[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||||
#
|
#
|
||||||
# Select a script execution method
|
# Select a script execution method
|
||||||
case $this_script in
|
case $this_script in
|
||||||
*changingowner*) wrt_run_as_clfs_root "${this_script}" "${file}" ;;
|
*changingowner*) wrt_RunAsRoot "${this_script}" "${file}" ;;
|
||||||
*devices*) wrt_run_as_clfs_root "${this_script}" "${file}" ;;
|
*devices*) wrt_RunAsRoot "${this_script}" "${file}" ;;
|
||||||
*fstab*) if [[ -n "$FSTAB" ]]; then
|
*fstab*) if [[ -n "$FSTAB" ]]; then
|
||||||
wrt_copy_fstab "${this_script}"
|
wrt_copy_fstab "${this_script}"
|
||||||
else
|
else
|
||||||
wrt_run_as_clfs_su "${this_script}" "${file}"
|
wrt_RunAsUser "${this_script}" "${file}"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*) wrt_run_as_clfs_su "${this_script}" "${file}" ;;
|
*) wrt_RunAsUser "${this_script}" "${file}" ;;
|
||||||
esac
|
esac
|
||||||
#
|
#
|
||||||
# Housekeeping...remove any build directory(ies) except if the package build fails.
|
# Housekeeping...remove any build directory(ies) except if the package build fails.
|
||||||
|
@ -332,7 +332,7 @@ chroot_Makefiles() { #
|
||||||
#
|
#
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
case $this_script in
|
case $this_script in
|
||||||
*util-linux) wrt_unpack_clfs "$pkg_tarball" ;;
|
*util-linux) wrt_unpack "$pkg_tarball" ;;
|
||||||
*) wrt_unpack2 "$pkg_tarball" ;;
|
*) wrt_unpack2 "$pkg_tarball" ;;
|
||||||
esac
|
esac
|
||||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||||
|
@ -340,9 +340,9 @@ chroot_Makefiles() { #
|
||||||
#
|
#
|
||||||
# Select a script execution method
|
# Select a script execution method
|
||||||
case $this_script in
|
case $this_script in
|
||||||
*kernfs) wrt_run_as_clfs_root "${this_script}" "${file}" ;;
|
*kernfs) wrt_RunAsRoot "${this_script}" "${file}" ;;
|
||||||
*util-linux) wrt_run_as_clfs_su "${this_script}" "${file}" ;;
|
*util-linux) wrt_RunAsUser "${this_script}" "${file}" ;;
|
||||||
*) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
*) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
||||||
esac
|
esac
|
||||||
#
|
#
|
||||||
# Housekeeping...remove the build directory(ies), except if the package build fails.
|
# Housekeeping...remove the build directory(ies), except if the package build fails.
|
||||||
|
@ -1012,6 +1012,8 @@ $HEADER
|
||||||
SRC= /sources
|
SRC= /sources
|
||||||
MOUNT_PT= $BUILDDIR
|
MOUNT_PT= $BUILDDIR
|
||||||
PKG_LST= $PKG_LST
|
PKG_LST= $PKG_LST
|
||||||
|
LUSER= $LUSER
|
||||||
|
LGROUP= $LGROUP
|
||||||
|
|
||||||
include makefile-functions
|
include makefile-functions
|
||||||
|
|
||||||
|
@ -1020,15 +1022,20 @@ EOF
|
||||||
|
|
||||||
# Add chroot commands
|
# Add chroot commands
|
||||||
if [ "$METHOD" = "chroot" ] ; then
|
if [ "$METHOD" = "chroot" ] ; then
|
||||||
chroot=`cat chroot/*chroot* | sed -e '/#!\/tools\/bin\/bash/d' \
|
CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
|
||||||
-e '/^export/d' \
|
chroot=`cat chroot/*chroot* | \
|
||||||
-e '/^logout/d' \
|
sed -e "s@chroot@$CHROOT_LOC@" \
|
||||||
-e 's@ \\\@ @g' | tr -d '\n' | sed -e 's/ */ /g' \
|
-e '/#!\/tools\/bin\/bash/d' \
|
||||||
-e 's|\\$|&&|g' \
|
-e '/^export/d' \
|
||||||
-e 's|exit||g' \
|
-e '/^logout/d' \
|
||||||
-e 's|$| -c|' \
|
-e 's@ \\\@ @g' | \
|
||||||
-e 's|"$$CLFS"|$(MOUNT_PT)|'\
|
tr -d '\n' | \
|
||||||
-e 's|set -e||'`
|
sed -e 's/ */ /g' \
|
||||||
|
-e 's|\\$|&&|g' \
|
||||||
|
-e 's|exit||g' \
|
||||||
|
-e 's|$| -c|' \
|
||||||
|
-e 's|"$$CLFS"|$(MOUNT_PT)|'\
|
||||||
|
-e 's|set -e||'`
|
||||||
echo -e "CHROOT1= $chroot\n" >> $MKFILE
|
echo -e "CHROOT1= $chroot\n" >> $MKFILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1046,7 +1053,7 @@ chapter3: chapter2 $cross_tools
|
||||||
|
|
||||||
chapter4: chapter3 $temptools
|
chapter4: chapter3 $temptools
|
||||||
|
|
||||||
chapter5: chapter4 $chroottools $testsuitetools
|
chapter5: chapter4 $chroottools restore-luser-env $testsuitetools
|
||||||
|
|
||||||
chapter6: chapter5 $basicsystem
|
chapter6: chapter5 $basicsystem
|
||||||
|
|
||||||
|
@ -1063,20 +1070,20 @@ restart:
|
||||||
@echo "This feature does not exist for the CLFS makefile. (yet)"
|
@echo "This feature does not exist for the CLFS makefile. (yet)"
|
||||||
|
|
||||||
clean-chapter2:
|
clean-chapter2:
|
||||||
-if [ ! -f user-clfs-exist ]; then \\
|
-if [ ! -f luser-exist ]; then \\
|
||||||
userdel clfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/clfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
rm -rf \$(MOUNT_PT)/tools
|
rm -rf \$(MOUNT_PT)/tools
|
||||||
rm -f /tools
|
rm -f /tools
|
||||||
rm -rf \$(MOUNT_PT)/cross-tools
|
rm -rf \$(MOUNT_PT)/cross-tools
|
||||||
rm -f /cross-tools
|
rm -f /cross-tools
|
||||||
rm -f envars user-clfs-exist
|
rm -f envars luser-exist
|
||||||
rm -f 02* logs/02*.log
|
rm -f 02* logs/02*.log
|
||||||
|
|
||||||
clean-chapter3:
|
clean-chapter3:
|
||||||
rm -rf \$(MOUNT_PT)/tools/*
|
rm -rf \$(MOUNT_PT)/tools/*
|
||||||
rm -f $cross_tools restore-clfs-env sources-dir
|
rm -f $cross_tools sources-dir
|
||||||
cd logs && rm -f $cross_tools && cd ..
|
cd logs && rm -f $cross_tools && cd ..
|
||||||
|
|
||||||
clean-chapter4:
|
clean-chapter4:
|
||||||
|
@ -1090,15 +1097,15 @@ clean-chapter4:
|
||||||
cd logs && rm -f $temptools && cd ..
|
cd logs && rm -f $temptools && cd ..
|
||||||
|
|
||||||
|
|
||||||
restore-clfs-env:
|
restore-luser-env:
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/clfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv -f /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
|
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/clfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
|
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
||||||
fi;
|
fi;
|
||||||
@chown clfs:clfs /home/clfs/.bash* && \\
|
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
@ -1109,9 +1116,9 @@ do-housekeeping:
|
||||||
@-umount \$(MOUNT_PT)/dev
|
@-umount \$(MOUNT_PT)/dev
|
||||||
@-umount \$(MOUNT_PT)/sys
|
@-umount \$(MOUNT_PT)/sys
|
||||||
@-umount \$(MOUNT_PT)/proc
|
@-umount \$(MOUNT_PT)/proc
|
||||||
@-if [ ! -f user-clfs-exist ]; then \\
|
@-if [ ! -f luser-exist ]; then \\
|
||||||
userdel clfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/clfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
@ -1129,7 +1136,7 @@ makeboot: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingen
|
||||||
$cross_tools\
|
$cross_tools\
|
||||||
$temptools \
|
$temptools \
|
||||||
$chroottools \
|
$chroottools \
|
||||||
$boottools
|
$boottools restore-luser-env
|
||||||
@\$(call echo_boot_finished,$VERSION)
|
@\$(call echo_boot_finished,$VERSION)
|
||||||
|
|
||||||
makesys: $testsuitetools $basicsystem $bootscripttools $bootabletools
|
makesys: $testsuitetools $basicsystem $bootscripttools $bootabletools
|
||||||
|
@ -1145,21 +1152,21 @@ restart:
|
||||||
@echo "This feature does not exist for the CLFS makefile. (yet)"
|
@echo "This feature does not exist for the CLFS makefile. (yet)"
|
||||||
|
|
||||||
clean-jhalfs:
|
clean-jhalfs:
|
||||||
-if [ ! -f user-clfs-exist ]; then \\
|
-if [ ! -f luser-exist ]; then \\
|
||||||
userdel clfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/clfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
rm -rf \$(MOUNT_PT)/tools
|
rm -rf \$(MOUNT_PT)/tools
|
||||||
rm -f /tools
|
rm -f /tools
|
||||||
rm -rf \$(MOUNT_PT)/cross-tools
|
rm -rf \$(MOUNT_PT)/cross-tools
|
||||||
rm -f /cross-tools
|
rm -f /cross-tools
|
||||||
rm -f envars user-clfs-exist
|
rm -f envars luser-exist
|
||||||
rm -f 02* logs/02*.log
|
rm -f 02* logs/02*.log
|
||||||
|
|
||||||
clean-makeboot:
|
clean-makeboot:
|
||||||
rm -rf /tools/*
|
rm -rf /tools/*
|
||||||
rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools
|
rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools
|
||||||
rm -f restore-clfs-env sources-dir
|
rm -f restore-luser-env sources-dir
|
||||||
cd logs && rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools && cd ..
|
cd logs && rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools && cd ..
|
||||||
|
|
||||||
clean-makesys:
|
clean-makesys:
|
||||||
|
@ -1175,15 +1182,15 @@ clean-makesys:
|
||||||
cd logs && rm -f $basicsystem && rm -f $bootscripttools && rm -f $bootabletools && cd ..
|
cd logs && rm -f $basicsystem && rm -f $bootscripttools && rm -f $bootabletools && cd ..
|
||||||
|
|
||||||
|
|
||||||
restore-clfs-env:
|
restore-luser-env:
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/clfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv -fv /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
|
mv -fv /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/clfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv -v /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
|
mv -v /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
||||||
fi;
|
fi;
|
||||||
@chown clfs:clfs /home/clfs/.bash* && \\
|
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
|
|
@ -21,6 +21,10 @@ TARGET32=
|
||||||
#--------------------------------
|
#--------------------------------
|
||||||
# >>>> MULTILIB 32/64 <<<<
|
# >>>> MULTILIB 32/64 <<<<
|
||||||
|
|
||||||
|
#--- Unprivileged user and group name
|
||||||
|
LUSER=clfs
|
||||||
|
LGROUP=clfs
|
||||||
|
|
||||||
#--- Location of fstab file (if empty, a template is created)
|
#--- Location of fstab file (if empty, a template is created)
|
||||||
FSTAB=
|
FSTAB=
|
||||||
|
|
||||||
|
|
147
CLFS2/master.sh
147
CLFS2/master.sh
|
@ -5,41 +5,6 @@
|
||||||
### FUNCTIONS ###
|
### 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
|
host_prep_Makefiles() { # Initialization of the system
|
||||||
|
@ -67,42 +32,42 @@ cat << EOF
|
||||||
|
|
||||||
025-addinguser: 023-creatingtoolsdir
|
025-addinguser: 023-creatingtoolsdir
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ ! -d /home/clfs ]; then \\
|
@if [ ! -d /home/\$(LUSER) ]; then \\
|
||||||
groupadd clfs; \\
|
groupadd \$(LGROUP); \\
|
||||||
useradd -s /bin/bash -g clfs -m -k /dev/null clfs; \\
|
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
||||||
else \\
|
else \\
|
||||||
touch user-clfs-exist; \\
|
touch luser-exist; \\
|
||||||
fi;
|
fi;
|
||||||
@chown clfs \$(MOUNT_PT) && \\
|
@chown \$(LUSER) \$(MOUNT_PT) && \\
|
||||||
chown clfs \$(MOUNT_PT)/tools && \\
|
chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
||||||
chown clfs \$(MOUNT_PT)/sources
|
chown \$(LUSER) \$(MOUNT_PT)/sources
|
||||||
@touch \$@ && \\
|
@touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
|
||||||
026-settingenvironment: 025-addinguser
|
026-settingenvironment: 025-addinguser
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/clfs/.bashrc -a ! -f /home/clfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv /home/clfs/.bashrc /home/clfs/.bashrc.XXX; \\
|
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/clfs/.bash_profile -a ! -f /home/clfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/clfs/.bash_profile /home/clfs/.bash_profile.XXX; \\
|
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@echo "set +h" > /home/clfs/.bashrc && \\
|
@echo "set +h" > /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "umask 022" >> /home/clfs/.bashrc && \\
|
echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "CLFS=\$(MOUNT_PT)" >> /home/clfs/.bashrc && \\
|
echo "CLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "LC_ALL=POSIX" >> /home/clfs/.bashrc && \\
|
echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> /home/clfs/.bashrc && \\
|
echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS LC_ALL PATH" >> /home/clfs/.bashrc && \\
|
echo "export CLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "" >> /home/clfs/.bashrc && \\
|
echo "" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "unset CFLAGS" >> /home/clfs/.bashrc && \\
|
echo "unset CFLAGS" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "unset CXXFLAGS" >> /home/clfs/.bashrc && \\
|
echo "unset CXXFLAGS" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "" >> /home/clfs/.bashrc && \\
|
echo "" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/clfs/.bashrc && \\
|
echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/clfs/.bashrc && \\
|
echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/clfs/.bashrc && \\
|
echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "source $JHALFSDIR/envars" >> /home/clfs/.bashrc
|
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
|
||||||
@chown clfs:clfs /home/clfs/.bashrc && \\
|
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
||||||
touch envars
|
touch envars
|
||||||
@touch \$@ && \\
|
@touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
|
@ -153,7 +118,7 @@ cat << EOF
|
||||||
|
|
||||||
@touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp}
|
@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
|
@chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog
|
||||||
@chown -R clfs \$(MOUNT_PT)
|
@chown -R \$(LUSER) \$(MOUNT_PT)
|
||||||
|
|
||||||
@touch \$@ && \\
|
@touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
|
@ -164,7 +129,6 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-----------------------------#
|
#-----------------------------#
|
||||||
cross_tools_Makefiles() { #
|
cross_tools_Makefiles() { #
|
||||||
#-----------------------------#
|
#-----------------------------#
|
||||||
|
@ -175,11 +139,21 @@ cross_tools_Makefiles() { #
|
||||||
this_script=`basename $file`
|
this_script=`basename $file`
|
||||||
#
|
#
|
||||||
# Skip this script...
|
# Skip this script...
|
||||||
|
# NOTE.. the book indicated you only needed to install groff or file if the host
|
||||||
|
# had older versions. The packages would be installed in the target directory
|
||||||
|
# and not the host.
|
||||||
case $this_script in
|
case $this_script in
|
||||||
*cflags* | *variables* ) # work done in host_prep_Makefiles
|
*cflags* | *variables* ) # work done in host_prep_Makefiles
|
||||||
continue; ;;
|
continue ;;
|
||||||
|
*file ) FileVer=`file --version | head -n1 | cut -d " " -f1`
|
||||||
|
[[ "$FileVer" = "file-4.17" ]] && continue
|
||||||
|
;;
|
||||||
|
*groff) GroffVer=`groff --version | head -n1 | cut -d " " -f4`
|
||||||
|
[[ "$GroffVer" = "1.19.2" ]] && continue
|
||||||
|
;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#
|
#
|
||||||
# Set the dependency for the first target.
|
# Set the dependency for the first target.
|
||||||
if [ -z $PREV ] ; then PREV=028-creating-sysfile ; fi
|
if [ -z $PREV ] ; then PREV=028-creating-sysfile ; fi
|
||||||
|
@ -199,7 +173,6 @@ cross_tools_Makefiles() { #
|
||||||
glibc-headers) name="glibc" ;;
|
glibc-headers) name="glibc" ;;
|
||||||
esac
|
esac
|
||||||
pkg_tarball=$(get_package_tarball_name $name)
|
pkg_tarball=$(get_package_tarball_name $name)
|
||||||
|
|
||||||
#--------------------------------------------------------------------#
|
#--------------------------------------------------------------------#
|
||||||
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
||||||
#--------------------------------------------------------------------#
|
#--------------------------------------------------------------------#
|
||||||
|
@ -210,12 +183,12 @@ cross_tools_Makefiles() { #
|
||||||
#
|
#
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
|
wrt_unpack "$pkg_tarball"
|
||||||
# If using optimizations, write the instructions
|
# If using optimizations, write the instructions
|
||||||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
|
wrt_RunAsUser "${this_script}" "${file}"
|
||||||
#
|
#
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
||||||
#
|
#
|
||||||
|
@ -275,12 +248,12 @@ final_system_Makefiles() { #
|
||||||
#
|
#
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
|
wrt_unpack "$pkg_tarball"
|
||||||
# If using optimizations, write the instructions
|
# If using optimizations, write the instructions
|
||||||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
|
wrt_RunAsUser "${this_script}" "${file}"
|
||||||
#
|
#
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
||||||
#
|
#
|
||||||
|
@ -339,9 +312,9 @@ bootscripts_Makefiles() { #
|
||||||
wrt_target "${this_script}" "$PREV"
|
wrt_target "${this_script}" "$PREV"
|
||||||
#
|
#
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# 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}"
|
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
||||||
#
|
#
|
||||||
|
@ -401,18 +374,20 @@ bootable_Makefiles() { #
|
||||||
wrt_target "${this_script}" "$PREV"
|
wrt_target "${this_script}" "$PREV"
|
||||||
#
|
#
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# 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
|
# Select a script execution method
|
||||||
case $this_script in
|
case $this_script in
|
||||||
*fstab*) if [[ -n "$FSTAB" ]]; then
|
*fstab*) if [[ -n "$FSTAB" ]]; then
|
||||||
wrt_copy_fstab "${this_script}"
|
wrt_copy_fstab "${this_script}"
|
||||||
else
|
else
|
||||||
wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
|
wrt_RunAsUser "${this_script}" "${file}"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*) wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
|
*chowning) wrt_RunAsRoot "${this_script}" "${file}"
|
||||||
;;
|
;;
|
||||||
|
*) wrt_RunAsUser "${this_script}" "${file}"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
#
|
#
|
||||||
# Housekeeping...remove any build directory(ies) except if the package build fails.
|
# Housekeeping...remove any build directory(ies) except if the package build fails.
|
||||||
|
@ -460,6 +435,8 @@ $HEADER
|
||||||
SRC= /sources
|
SRC= /sources
|
||||||
MOUNT_PT= $BUILDDIR
|
MOUNT_PT= $BUILDDIR
|
||||||
PKG_LST= $PKG_LST
|
PKG_LST= $PKG_LST
|
||||||
|
LUSER= $LUSER
|
||||||
|
LGROUP= $LGROUP
|
||||||
|
|
||||||
include makefile-functions
|
include makefile-functions
|
||||||
|
|
||||||
|
@ -470,7 +447,7 @@ EOF
|
||||||
# as a dependency.
|
# as a dependency.
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
all: chapter2 chapter3 chapter4 chapter5 chapter6 do-housekeeping
|
all: chapter2 chapter3 chapter4 chapter5 chapter6 restore-luser-env do-housekeeping
|
||||||
@\$(call echo_finished,$VERSION)
|
@\$(call echo_finished,$VERSION)
|
||||||
|
|
||||||
chapter2: 023-creatingtoolsdir 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile
|
chapter2: 023-creatingtoolsdir 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile
|
||||||
|
@ -491,23 +468,23 @@ clean:
|
||||||
restart:
|
restart:
|
||||||
@echo "This feature does not exist for the CLFS makefile. (yet)"
|
@echo "This feature does not exist for the CLFS makefile. (yet)"
|
||||||
|
|
||||||
restore-clfs-env:
|
restore-luser-env:
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/clfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv -f /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
|
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/clfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
|
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
||||||
fi;
|
fi;
|
||||||
@chown clfs:clfs /home/clfs/.bash* && \\
|
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
|
||||||
do-housekeeping:
|
do-housekeeping:
|
||||||
@-if [ ! -f user-clfs-exist ]; then \\
|
@-if [ ! -f luser-exist ]; then \\
|
||||||
userdel clfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/clfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -12,6 +12,10 @@ MODEL=glibc
|
||||||
#--- The host system has grsecurity options enabled? 0(no)/1(yes)
|
#--- The host system has grsecurity options enabled? 0(no)/1(yes)
|
||||||
GRSECURITY_HOST=0
|
GRSECURITY_HOST=0
|
||||||
|
|
||||||
|
#--- Unprivileged user and group name
|
||||||
|
LUSER=hlfs
|
||||||
|
LGROUP=hlfs
|
||||||
|
|
||||||
#--- Location of fstab file (if empty, a template is created)
|
#--- Location of fstab file (if empty, a template is created)
|
||||||
FSTAB=
|
FSTAB=
|
||||||
|
|
||||||
|
|
163
HLFS/master.sh
163
HLFS/master.sh
|
@ -7,58 +7,6 @@ set -e # Enable error trapping
|
||||||
### FUNCTIONS ###
|
### 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
|
process_toolchain() { # embryo,cocoon and butterfly need special handling
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
|
@ -101,11 +49,11 @@ cat << EOF
|
||||||
@echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)" > envars
|
@echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)" > envars
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
wrt_ExecuteAsUser "hlfs" "$toolchain" "$this_script"
|
wrt_RunAsUser "$toolchain" "$this_script"
|
||||||
;;
|
;;
|
||||||
esac
|
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")
|
pkg_tarball=$(get_package_tarball_name "binutils")
|
||||||
wrt_remove_existing_dirs "$pkg_tarball"
|
wrt_remove_existing_dirs "$pkg_tarball"
|
||||||
pkg_tarball=$(get_package_tarball_name "gcc-core")
|
pkg_tarball=$(get_package_tarball_name "gcc-core")
|
||||||
|
@ -136,7 +84,7 @@ chapter3_Makefiles() { # Initialization of the system
|
||||||
TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2"
|
TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If /home/hlfs is already present in the host, we asume that the
|
# If /home/$LUSER is already present in the host, we asume that the
|
||||||
# hlfs user and group are also presents in the host, and a backup
|
# hlfs user and group are also presents in the host, and a backup
|
||||||
# of their bash init files is made.
|
# of their bash init files is made.
|
||||||
(
|
(
|
||||||
|
@ -156,38 +104,38 @@ cat << EOF
|
||||||
|
|
||||||
021-addinguser: 020-creatingtoolsdir
|
021-addinguser: 020-creatingtoolsdir
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ ! -d /home/hlfs ]; then \\
|
@if [ ! -d /home/\$(LUSER) ]; then \\
|
||||||
groupadd hlfs; \\
|
groupadd \$(LGROUP); \\
|
||||||
useradd -s /bin/bash -g hlfs -m -k /dev/null hlfs; \\
|
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
||||||
else \\
|
else \\
|
||||||
touch user-hlfs-exist; \\
|
touch luser-exist; \\
|
||||||
fi;
|
fi;
|
||||||
@chown hlfs \$(MOUNT_PT)/tools && \\
|
@chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
||||||
chown hlfs \$(MOUNT_PT)/sources && \\
|
chown \$(LUSER) \$(MOUNT_PT)/sources && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
|
||||||
022-settingenvironment: 021-addinguser
|
022-settingenvironment: 021-addinguser
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/hlfs/.bashrc -a ! -f /home/hlfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv /home/hlfs/.bashrc /home/hlfs/.bashrc.XXX; \\
|
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/hlfs/.bash_profile -a ! -f /home/hlfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/hlfs/.bash_profile /home/hlfs/.bash_profile.XXX; \\
|
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@echo "set +h" > /home/hlfs/.bashrc && \\
|
@echo "set +h" > /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "umask 022" >> /home/hlfs/.bashrc && \\
|
echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "HLFS=\$(MOUNT_PT)" >> /home/hlfs/.bashrc && \\
|
echo "HLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "LC_ALL=POSIX" >> /home/hlfs/.bashrc && \\
|
echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/hlfs/.bashrc && \\
|
echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export HLFS LC_ALL PATH" >> /home/hlfs/.bashrc && \\
|
echo "export HLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "" >> /home/hlfs/.bashrc && \\
|
echo "" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "target=$(uname -m)-${TARGET}" >> /home/lfs/.bashrc && \\
|
echo "target=$(uname -m)-${TARGET}" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "ldso=/tools/lib/${LOADER}" >> /home/lfs/.bashrc && \\
|
echo "ldso=/tools/lib/${LOADER}" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export target ldso" >> /home/lfs/.bashrc && \\
|
echo "export target ldso" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "source $JHALFSDIR/envars" >> /home/hlfs/.bashrc && \\
|
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
chown hlfs:hlfs /home/hlfs/.bashrc && \\
|
chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
||||||
touch envars && \\
|
touch envars && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
|
@ -262,13 +210,13 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
# 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
|
# If using optimizations, write the instructions
|
||||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||||
fi
|
fi
|
||||||
# Insert date and disk usage at the top of the log file, the script run
|
# 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.
|
# 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
|
# Remove the build directory(ies) except if the package build fails
|
||||||
# (so we can review config.cache, config.log, etc.)
|
# (so we can review config.cache, config.log, etc.)
|
||||||
|
@ -395,7 +343,7 @@ chapter6_Makefiles() { # sysroot or chroot build phase
|
||||||
# In the mount of kernel filesystems we need to set HLFS and not to use chroot.
|
# In the mount of kernel filesystems we need to set HLFS and not to use chroot.
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*kernfs*)
|
*kernfs*)
|
||||||
wrt_RunAsRoot "hlfs" "${this_script}" "${file}"
|
wrt_RunAsRoot "${this_script}" "${file}"
|
||||||
;;
|
;;
|
||||||
*) # The rest of Chapter06
|
*) # The rest of Chapter06
|
||||||
wrt_run_as_chroot1 "${this_script}" "${file}"
|
wrt_run_as_chroot1 "${this_script}" "${file}"
|
||||||
|
@ -537,6 +485,8 @@ $HEADER
|
||||||
SRC= /sources
|
SRC= /sources
|
||||||
MOUNT_PT= $BUILDDIR
|
MOUNT_PT= $BUILDDIR
|
||||||
PKG_LST= $PKG_LST
|
PKG_LST= $PKG_LST
|
||||||
|
LUSER= $LUSER
|
||||||
|
LGROUP= $LGROUP
|
||||||
|
|
||||||
include makefile-functions
|
include makefile-functions
|
||||||
|
|
||||||
|
@ -545,17 +495,22 @@ EOF
|
||||||
|
|
||||||
|
|
||||||
# Add chroot commands
|
# Add chroot commands
|
||||||
|
CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
|
||||||
i=1
|
i=1
|
||||||
for file in chapter06/*chroot* ; do
|
for file in chapter06/*chroot* ; do
|
||||||
chroot=`cat $file | sed -e '/#!\/bin\/sh/d' \
|
chroot=`cat $file | \
|
||||||
-e '/^export/d' \
|
sed -e "s@chroot@$CHROOT_LOC@" \
|
||||||
-e '/^logout/d' \
|
-e '/#!\/bin\/sh/d' \
|
||||||
-e 's@ \\\@ @g' | tr -d '\n' | sed -e 's/ */ /g' \
|
-e '/^export/d' \
|
||||||
-e 's|\\$|&&|g' \
|
-e '/^logout/d' \
|
||||||
-e 's|exit||g' \
|
-e 's@ \\\@ @g' | \
|
||||||
-e 's|$| -c|' \
|
tr -d '\n' | \
|
||||||
-e 's|"$$HLFS"|$(MOUNT_PT)|'\
|
sed -e 's/ */ /g' \
|
||||||
-e 's|set -e||'`
|
-e 's|\\$|&&|g' \
|
||||||
|
-e 's|exit||g' \
|
||||||
|
-e 's|$| -c|' \
|
||||||
|
-e 's|"$$HLFS"|$(MOUNT_PT)|'\
|
||||||
|
-e 's|set -e||'`
|
||||||
echo -e "CHROOT$i= $chroot\n" >> $MKFILE
|
echo -e "CHROOT$i= $chroot\n" >> $MKFILE
|
||||||
i=`expr $i + 1`
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
|
@ -569,7 +524,7 @@ all: chapter3 chapter5 chapter6 chapter7 do-housekeeping
|
||||||
|
|
||||||
chapter3: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
|
chapter3: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
|
||||||
|
|
||||||
chapter5: chapter3 $chapter5 restore-hlfs-env
|
chapter5: chapter3 $chapter5 restore-luser-env
|
||||||
|
|
||||||
chapter6: chapter5 $chapter6
|
chapter6: chapter5 $chapter6
|
||||||
|
|
||||||
|
@ -583,18 +538,18 @@ clean: clean-chapter7 clean-chapter6 clean-chapter5 clean-chapter3
|
||||||
restart: restart_code all
|
restart: restart_code all
|
||||||
|
|
||||||
clean-chapter3:
|
clean-chapter3:
|
||||||
-if [ ! -f user-hlfs-exist ]; then \\
|
-if [ ! -f luser-exist ]; then \\
|
||||||
userdel hlfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/hlfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
rm -rf \$(MOUNT_PT)/tools
|
rm -rf \$(MOUNT_PT)/tools
|
||||||
rm -f /tools
|
rm -f /tools
|
||||||
rm -f envars user-hlfs-exist
|
rm -f envars luser-exist
|
||||||
rm -f 02* logs/02*.log
|
rm -f 02* logs/02*.log
|
||||||
|
|
||||||
clean-chapter5:
|
clean-chapter5:
|
||||||
rm -rf \$(MOUNT_PT)/tools/*
|
rm -rf \$(MOUNT_PT)/tools/*
|
||||||
rm -f $chapter5 restore-hlfs-env sources-dir
|
rm -f $chapter5 restore-luser-env sources-dir
|
||||||
cd logs && rm -f $chapter5 && cd ..
|
cd logs && rm -f $chapter5 && cd ..
|
||||||
|
|
||||||
clean-chapter6:
|
clean-chapter6:
|
||||||
|
@ -611,15 +566,15 @@ clean-chapter7:
|
||||||
rm -f $chapter7
|
rm -f $chapter7
|
||||||
cd logs && rm -f $chapter7 && cd ..
|
cd logs && rm -f $chapter7 && cd ..
|
||||||
|
|
||||||
restore-hlfs-env:
|
restore-luser-env:
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/hlfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv -f /home/hlfs/.bashrc.XXX /home/hlfs/.bashrc; \\
|
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/hlfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/hlfs/.bash_profile.XXX /home/hlfs/.bash_profile; \\
|
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
||||||
fi;
|
fi;
|
||||||
@chown hlfs:hlfs /home/hlfs/.bash* && \\
|
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
@ -630,9 +585,9 @@ do-housekeeping:
|
||||||
@-umount \$(MOUNT_PT)/dev
|
@-umount \$(MOUNT_PT)/dev
|
||||||
@-umount \$(MOUNT_PT)/sys
|
@-umount \$(MOUNT_PT)/sys
|
||||||
@-umount \$(MOUNT_PT)/proc
|
@-umount \$(MOUNT_PT)/proc
|
||||||
@-if [ ! -f user-hlfs-exist ]; then \\
|
@-if [ ! -f luser-exist ]; then \\
|
||||||
userdel hlfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/hlfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
restart_code:
|
restart_code:
|
||||||
|
|
|
@ -6,6 +6,10 @@
|
||||||
#
|
#
|
||||||
#####
|
#####
|
||||||
|
|
||||||
|
#--- Unprivileged user and group name
|
||||||
|
LUSER=lfs
|
||||||
|
LGROUP=lfs
|
||||||
|
|
||||||
#--- Location of fstab file (if empty, a template is created)
|
#--- Location of fstab file (if empty, a template is created)
|
||||||
FSTAB=
|
FSTAB=
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ chapter4_Makefiles() {
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4${R_arrow}"
|
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4${R_arrow}"
|
||||||
|
|
||||||
# If /home/lfs is already present in the host, we asume that the
|
# If /home/$LUSER is already present in the host, we asume that the
|
||||||
# lfs user and group are also presents in the host, and a backup
|
# lfs user and group are also presents in the host, and a backup
|
||||||
# of their bash init files is made.
|
# of their bash init files is made.
|
||||||
(
|
(
|
||||||
|
@ -29,13 +29,13 @@ chapter4_Makefiles() {
|
||||||
|
|
||||||
021-addinguser: 020-creatingtoolsdir
|
021-addinguser: 020-creatingtoolsdir
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ ! -d /home/lfs ]; then \\
|
@if [ ! -d /home/\$(LUSER) ]; then \\
|
||||||
groupadd lfs; \\
|
groupadd \$(LGROUP); \\
|
||||||
useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
|
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
||||||
else \\
|
else \\
|
||||||
touch user-lfs-exist; \\
|
touch luser-exist; \\
|
||||||
fi;
|
fi;
|
||||||
@chown lfs \$(MOUNT_PT)/tools && \\
|
@chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
||||||
chmod a+wt \$(MOUNT_PT)/sources && \\
|
chmod a+wt \$(MOUNT_PT)/sources && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
|
@ -43,20 +43,20 @@ chapter4_Makefiles() {
|
||||||
|
|
||||||
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 \\
|
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
|
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
|
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@echo "set +h" > /home/lfs/.bashrc && \\
|
@echo "set +h" > /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "umask 022" >> /home/lfs/.bashrc && \\
|
echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "LFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\
|
echo "LFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
|
echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
|
echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
|
echo "export LFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\
|
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
chown lfs:lfs /home/lfs/.bashrc && \\
|
chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
||||||
touch envars && \\
|
touch envars && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
|
@ -122,8 +122,8 @@ chapter5_Makefiles() {
|
||||||
# and date and disk usage again at the bottom of the log file.
|
# and date and disk usage again at the bottom of the log file.
|
||||||
# The changingowner script must be run as root.
|
# The changingowner script must be run as root.
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*changingowner) wrt_run_as_root "${this_script}" "$file" ;;
|
*changingowner) wrt_RunAsRoot "${this_script}" "$file" ;;
|
||||||
*) wrt_run_as_su "${this_script}" "$file" ;;
|
*) wrt_RunAsUser "${this_script}" "$file" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Remove the build directory(ies) except if the package build fails
|
# Remove the build directory(ies) except if the package build fails
|
||||||
|
@ -231,7 +231,7 @@ chapter6_Makefiles() {
|
||||||
# In the mount of kernel filesystems we need to set LFS
|
# In the mount of kernel filesystems we need to set LFS
|
||||||
# and not to use chroot.
|
# and not to use chroot.
|
||||||
case "${this_script}" in
|
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" ;;
|
*) wrt_run_as_chroot1 "${this_script}" "$file" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -365,6 +365,8 @@ $HEADER
|
||||||
SRC= /sources
|
SRC= /sources
|
||||||
MOUNT_PT= $BUILDDIR
|
MOUNT_PT= $BUILDDIR
|
||||||
PKG_LST= $PKG_LST
|
PKG_LST= $PKG_LST
|
||||||
|
LUSER= $LUSER
|
||||||
|
LGROUP= $LGROUP
|
||||||
|
|
||||||
include makefile-functions
|
include makefile-functions
|
||||||
|
|
||||||
|
@ -373,11 +375,20 @@ EOF
|
||||||
|
|
||||||
|
|
||||||
# Add chroot commands
|
# Add chroot commands
|
||||||
|
CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
|
||||||
i=1
|
i=1
|
||||||
for file in chapter06/*chroot* ; do
|
for file in chapter06/*chroot* ; do
|
||||||
chroot=`cat $file | sed -e '/#!\/bin\/sh/d' -e 's@ \\\@ @g' | tr -d '\n' | sed \
|
chroot=`cat $file | \
|
||||||
-e 's/ */ /g' -e 's|\\$|&&|g' -e 's|exit||g' -e 's|$| -c|' \
|
sed -e "s@chroot@$CHROOT_LOC@" \
|
||||||
-e 's|"$$LFS"|$(MOUNT_PT)|' -e 's|set -e||'`
|
-e '/#!\/bin\/sh/d' \
|
||||||
|
-e 's@ \\\@ @g' | \
|
||||||
|
tr -d '\n' | \
|
||||||
|
sed -e 's/ */ /g' \
|
||||||
|
-e 's|\\$|&&|g' \
|
||||||
|
-e 's|exit||g' \
|
||||||
|
-e 's|$| -c|' \
|
||||||
|
-e 's|"$$LFS"|$(MOUNT_PT)|' \
|
||||||
|
-e 's|set -e||'`
|
||||||
echo -e "CHROOT$i= $chroot\n" >> $MKFILE
|
echo -e "CHROOT$i= $chroot\n" >> $MKFILE
|
||||||
i=`expr $i + 1`
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
|
@ -391,7 +402,7 @@ all: chapter4 chapter5 chapter6 chapter789 do_housekeeping
|
||||||
|
|
||||||
chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
|
chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
|
||||||
|
|
||||||
chapter5: chapter4 $chapter5 restore-lfs-env
|
chapter5: chapter4 $chapter5 restore-luser-env
|
||||||
|
|
||||||
chapter6: chapter5 $chapter6
|
chapter6: chapter5 $chapter6
|
||||||
|
|
||||||
|
@ -405,18 +416,18 @@ clean: clean-chapter789 clean-chapter6 clean-chapter5 clean-chapter4
|
||||||
restart: restart_code all
|
restart: restart_code all
|
||||||
|
|
||||||
clean-chapter4:
|
clean-chapter4:
|
||||||
-if [ ! -f user-lfs-exist ]; then \\
|
-if [ ! -f luser-exist ]; then \\
|
||||||
userdel lfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/lfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
rm -rf \$(MOUNT_PT)/tools
|
rm -rf \$(MOUNT_PT)/tools
|
||||||
rm -f /tools
|
rm -f /tools
|
||||||
rm -f envars user-lfs-exist
|
rm -f envars luser-exist
|
||||||
rm -f 02* logs/02*.log
|
rm -f 02* logs/02*.log
|
||||||
|
|
||||||
clean-chapter5:
|
clean-chapter5:
|
||||||
rm -rf \$(MOUNT_PT)/tools/*
|
rm -rf \$(MOUNT_PT)/tools/*
|
||||||
rm -f $chapter5 restore-lfs-env sources-dir
|
rm -f $chapter5 restore-luser-env sources-dir
|
||||||
cd logs && rm -f $chapter5 && cd ..
|
cd logs && rm -f $chapter5 && cd ..
|
||||||
|
|
||||||
clean-chapter6:
|
clean-chapter6:
|
||||||
|
@ -433,15 +444,15 @@ clean-chapter789:
|
||||||
rm -f $chapter789
|
rm -f $chapter789
|
||||||
cd logs && rm -f $chapter789 && cd ..
|
cd logs && rm -f $chapter789 && cd ..
|
||||||
|
|
||||||
restore-lfs-env:
|
restore-luser-env:
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv -f /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
||||||
fi;
|
fi;
|
||||||
@chown lfs:lfs /home/lfs/.bash* && \\
|
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
@ -452,9 +463,9 @@ do_housekeeping:
|
||||||
@-umount \$(MOUNT_PT)/dev/shm
|
@-umount \$(MOUNT_PT)/dev/shm
|
||||||
@-umount \$(MOUNT_PT)/dev/pts
|
@-umount \$(MOUNT_PT)/dev/pts
|
||||||
@-umount \$(MOUNT_PT)/dev
|
@-umount \$(MOUNT_PT)/dev
|
||||||
@-if [ ! -f user-lfs-exist ]; then \\
|
@-if [ ! -f luser-exist ]; then \\
|
||||||
userdel lfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/lfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
restart_code:
|
restart_code:
|
||||||
|
|
11
README
11
README
|
@ -142,9 +142,10 @@ $Id$
|
||||||
A. Yes, it is. This tool, jhalfs, is for those who understand the LFS books
|
A. Yes, it is. This tool, jhalfs, is for those who understand the LFS books
|
||||||
and wish to automate the build. 99% of any problems that arise can be
|
and wish to automate the build. 99% of any problems that arise can be
|
||||||
solved by reading the book(s).
|
solved by reading the book(s).
|
||||||
|
|
||||||
Q. "It doesn't work!"
|
Q. "It doesn't work!"
|
||||||
A. Yes it does, try ./lfs --help
|
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"
|
Q. "It still doesn't work"
|
||||||
A. jhalfs was designed to work against the developement versions of the LFS
|
A. jhalfs was designed to work against the developement versions of the LFS
|
||||||
|
@ -187,6 +188,14 @@ $Id$
|
||||||
simple and reliable method of doing so. This method also handles the CLFS
|
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.
|
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"
|
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
|
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
|
is you are doing a cross-build using the 'chroot' method and the target is
|
||||||
|
|
|
@ -253,9 +253,9 @@ get_package_tarball_name() { #
|
||||||
# hopefully this will not cause problems.
|
# hopefully this will not cause problems.
|
||||||
#
|
#
|
||||||
case $script_name in
|
case $script_name in
|
||||||
tcl) echo $(grep "^tcl" $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 ) ;;
|
linux-headers) echo $(grep "^linux-headers.*.bz2" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
|
||||||
*) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
|
*) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -310,27 +310,7 @@ cat << EOF
|
||||||
@\$(call unpack,$FILE)
|
@\$(call unpack,$FILE)
|
||||||
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
||||||
echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
|
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
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
}
|
}
|
||||||
|
@ -380,7 +360,7 @@ wrt_test_log() { # Initialize testsuite log file
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@echo "export TEST_LOG=$TESTLOGDIR/$TESTLOGFILE" >> envars && \\
|
@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
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
}
|
}
|
||||||
|
@ -411,13 +391,13 @@ EOF
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
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 this_script=$1
|
||||||
local file=$2
|
local file=$2
|
||||||
(
|
(
|
||||||
cat << EOF
|
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
|
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
@ -425,41 +405,24 @@ EOF
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
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 this_script=$1
|
||||||
local file=$2
|
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
|
cat << EOF
|
||||||
@( time { export LFS=\$(MOUNT_PT) && ${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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
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
|
|
||||||
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
|
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
@ -480,7 +443,6 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
wrt_run_as_chroot1() { #
|
wrt_run_as_chroot1() { #
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
|
@ -539,9 +501,9 @@ wrt_remove_build_dirs() { #
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
@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 \\
|
if [ -e \$(MOUNT_PT)\$(SRC)/$name-build ]; then \\
|
||||||
rm -r \$(MOUNT_PT)\$(SRC)/$name-build; \\
|
rm -rf \$(MOUNT_PT)\$(SRC)/$name-build; \\
|
||||||
fi;
|
fi;
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
@ -555,9 +517,9 @@ wrt_remove_build_dirs2() { #
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
||||||
rm -r \$(SRC)/\$\$ROOT && \\
|
rm -rf \$(SRC)/\$\$ROOT && \\
|
||||||
if [ -e \$(SRC)/$name-build ]; then \\
|
if [ -e \$(SRC)/$name-build ]; then \\
|
||||||
rm -r \$(SRC)/$name-build; \\
|
rm -rf \$(SRC)/$name-build; \\
|
||||||
fi;
|
fi;
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
|
|
@ -86,10 +86,10 @@ validate_config() { # Are the config values sane (within reason)
|
||||||
inline_doc
|
inline_doc
|
||||||
|
|
||||||
# First internal variables, then the ones that change the book's flavour, and lastly system configuration variables
|
# 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 KEYMAP PAGE TIMEZONE LANG LC_ALL"
|
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 KEYMAP PAGE TIMEZONE LANG LC_ALL LUSER LGROUP"
|
||||||
local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG"
|
local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TEST BOMB_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 STRIP FSTAB CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG"
|
local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET OPTIMIZE REPORT STRIP FSTAB CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG LUSER LGROUP"
|
||||||
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"
|
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"
|
||||||
|
|
||||||
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_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}'
|
local -r ERROR_MSG_pt2=' check the config file ${BOLD}${GREEN}\<$(echo $PROGNAME | tr [a-z] [A-Z])/config\> or \<common/config\>${OFF}'
|
||||||
|
@ -214,6 +214,12 @@ inline_doc
|
||||||
METHOD) validate_against_str "xchrootx xbootx" ;;
|
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" ;;
|
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 ;;
|
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" ;;
|
GRSECURITY_HOST) validate_against_str "x0x x1x" ;;
|
||||||
|
|
||||||
# BOOK validation. Very ugly, need be fixed
|
# BOOK validation. Very ugly, need be fixed
|
||||||
|
|
Reference in a new issue