Revising master.sh
This commit is contained in:
parent
51e3d23660
commit
3b6adab4f6
1 changed files with 30 additions and 79 deletions
109
LFS/master.sh
109
LFS/master.sh
|
@ -20,14 +20,14 @@ chapter4_Makefiles() { #
|
||||||
# of their bash init files is made.
|
# of their bash init files is made.
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
020-creatingtoolsdir:
|
04_02-creatingtoolsdir:
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@mkdir \$(MOUNT_PT)/tools && \\
|
@mkdir \$(MOUNT_PT)/tools && \\
|
||||||
rm -f /tools && \\
|
rm -f /tools && \\
|
||||||
ln -s \$(MOUNT_PT)/tools /
|
ln -s \$(MOUNT_PT)/tools /
|
||||||
@\$(call housekeeping)
|
@\$(call housekeeping)
|
||||||
|
|
||||||
021-addinguser: 020-creatingtoolsdir
|
04_03-addinguser: 020-creatingtoolsdir
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ ! -d \$(LUSER_HOME) ]; then \\
|
@if [ ! -d \$(LUSER_HOME) ]; then \\
|
||||||
groupadd \$(LGROUP); \\
|
groupadd \$(LGROUP); \\
|
||||||
|
@ -40,7 +40,7 @@ chapter4_Makefiles() { #
|
||||||
chmod a+wt \$(SRCSDIR)
|
chmod a+wt \$(SRCSDIR)
|
||||||
@\$(call housekeeping)
|
@\$(call housekeeping)
|
||||||
|
|
||||||
022-settingenvironment: 021-addinguser
|
04_04-settingenvironment: 021-addinguser
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
@if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
||||||
mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
|
mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
|
||||||
|
@ -51,6 +51,7 @@ chapter4_Makefiles() { #
|
||||||
@echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
|
@echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
|
||||||
echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
|
echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
|
||||||
echo "LFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
|
echo "LFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
|
||||||
|
echo "SRCDIR=\$(MOUNT_PT)/sources" >> \$(LUSER_HOME)/.bashrc && \\
|
||||||
echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
|
echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
|
||||||
echo "PATH=/tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
|
echo "PATH=/tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
|
||||||
echo "export LFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
|
echo "export LFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
|
||||||
|
@ -62,7 +63,7 @@ chapter4_Makefiles() { #
|
||||||
EOF
|
EOF
|
||||||
) > $MKFILE.tmp
|
) > $MKFILE.tmp
|
||||||
|
|
||||||
chapter4=" 020-creatingtoolsdir 021-addinguser 022-settingenvironment"
|
chapter4=" 04_02-creatingtoolsdir 04_03-addinguser 04_04-settingenvironment"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,14 +78,11 @@ chapter5_Makefiles() {
|
||||||
this_script=`basename $file`
|
this_script=`basename $file`
|
||||||
|
|
||||||
# If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed
|
# If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed
|
||||||
# Fix also locales creation when running chapter05 testsuites (ugly)
|
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*tcl) [[ "${TEST}" = "0" ]] && continue ;;
|
*tcl) [[ "${TEST}" = "0" ]] && continue ;;
|
||||||
*expect) [[ "${TEST}" = "0" ]] && continue ;;
|
*expect) [[ "${TEST}" = "0" ]] && continue ;;
|
||||||
*dejagnu) [[ "${TEST}" = "0" ]] && continue ;;
|
*dejagnu) [[ "${TEST}" = "0" ]] && continue ;;
|
||||||
*stripping) [[ "${STRIP}" = "n" ]] && continue ;;
|
*stripping) [[ "${STRIP}" = "n" ]] && continue ;;
|
||||||
*glibc) [[ "${TEST}" = "3" ]] && \
|
|
||||||
sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# First append each name of the script files to a list (this will become
|
# First append each name of the script files to a list (this will become
|
||||||
|
@ -97,12 +95,11 @@ chapter5_Makefiles() {
|
||||||
*) chapter5="$chapter5 ${this_script}" ;;
|
*) chapter5="$chapter5 ${this_script}" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
|
# Grab the package name, if the script is building a package
|
||||||
# and binutils in chapter 5)
|
name=`grep "^PACKAGE=" ${file} | sed -e 's@PACKAGE=@@'`
|
||||||
name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
|
|
||||||
|
|
||||||
# Set the dependency for the first target.
|
# Set the dependency for the first target.
|
||||||
if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
|
if [ -z $PREV ] ; then PREV=04_04-settingenvironment ; fi
|
||||||
|
|
||||||
#--------------------------------------------------------------------#
|
#--------------------------------------------------------------------#
|
||||||
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
||||||
|
@ -112,34 +109,21 @@ chapter5_Makefiles() {
|
||||||
# as a dependency. Also call the echo_message function.
|
# as a dependency. Also call the echo_message function.
|
||||||
LUSER_wrt_target "${this_script}" "$PREV"
|
LUSER_wrt_target "${this_script}" "$PREV"
|
||||||
|
|
||||||
# Find the version of the command files, if it corresponds with the building of
|
# If $name isn't empty, we've got a package...
|
||||||
# a specific package
|
if [ "$name" != "" ] ; then
|
||||||
pkg_tarball=$(get_package_tarball_name $name)
|
|
||||||
|
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
|
||||||
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
|
||||||
LUSER_wrt_unpack "$pkg_tarball"
|
|
||||||
# If the testsuites must be run, initialize the log file
|
# If the testsuites must be run, initialize the log file
|
||||||
[[ "$TEST" = "3" ]] && LUSER_wrt_test_log "${this_script}"
|
[[ "$TEST" = "3" ]] && LUSER_wrt_test_log "${this_script}"
|
||||||
# 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
|
# Run the script.
|
||||||
# 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_RunAsRoot "$file" ;;
|
*changingowner) wrt_RunAsRoot "$file" ;;
|
||||||
*) LUSER_wrt_RunAsUser "$file" ;;
|
*) LUSER_wrt_RunAsUser "$file" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Remove the build directory(ies) except if the package build fails
|
|
||||||
# (so we can review config.cache, config.log, etc.)
|
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
|
||||||
LUSER_RemoveBuildDirs "$name"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Include a touch of the target name so make can check
|
# Include a touch of the target name so make can check
|
||||||
# if it's already been made.
|
# if it's already been made.
|
||||||
wrt_touch
|
wrt_touch
|
||||||
|
@ -174,8 +158,6 @@ chapter6_Makefiles() {
|
||||||
# Rename the scripts
|
# Rename the scripts
|
||||||
mv ${script} ${script}$N
|
mv ${script} ${script}$N
|
||||||
done
|
done
|
||||||
# Remove Bzip2 binaries before make install (LFS-6.2 compatibility)
|
|
||||||
sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2$N
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}"
|
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}"
|
||||||
|
@ -194,14 +176,10 @@ chapter6_Makefiles() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Grab the name of the target.
|
# Grab the name of the target.
|
||||||
name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's,'$N',,'`
|
name=`grep "^PACKAGE=" ${file} | sed -e 's@PACKAGE=@@'`
|
||||||
|
|
||||||
# Find the version of the command files, if it corresponds with the building of
|
# Skip scripts not needed for iterations rebuilds
|
||||||
# a specific package. We need this here to can skip scripts not needed for
|
if [[ "$name" = "" ]] && [[ -n "$N" ]] ; then
|
||||||
# iterations rebuilds
|
|
||||||
pkg_tarball=$(get_package_tarball_name $name)
|
|
||||||
|
|
||||||
if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
|
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*stripping*) ;;
|
*stripping*) ;;
|
||||||
*) continue ;;
|
*) continue ;;
|
||||||
|
@ -229,15 +207,13 @@ chapter6_Makefiles() {
|
||||||
*) CHROOT_wrt_target "${this_script}" "$PREV" ;;
|
*) CHROOT_wrt_target "${this_script}" "$PREV" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $name isn't empty, we've got a package...
|
||||||
# Insert instructions for unpacking the package and changing directories
|
if [ "$name" != "" ] ; then
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
|
||||||
# Touch timestamp file if installed files logs will be created.
|
# Touch timestamp file if installed files logs will be created.
|
||||||
# But only for the firt build when running iterative builds.
|
# But only for the firt build when running iterative builds.
|
||||||
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
|
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
|
||||||
CHROOT_wrt_TouchTimestamp
|
CHROOT_wrt_TouchTimestamp
|
||||||
fi
|
fi
|
||||||
CHROOT_Unpack "$pkg_tarball"
|
|
||||||
# If the testsuites must be run, initialize the log file
|
# If the testsuites must be run, initialize the log file
|
||||||
case $name in
|
case $name in
|
||||||
binutils | gcc | glibc )
|
binutils | gcc | glibc )
|
||||||
|
@ -258,13 +234,9 @@ chapter6_Makefiles() {
|
||||||
*) CHROOT_wrt_RunAsRoot "$file" ;;
|
*) CHROOT_wrt_RunAsRoot "$file" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Write installed files log and remove the build directory(ies)
|
# Write installed files log
|
||||||
# except if the package build fails.
|
if [ "$name" != "" ] && [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
CHROOT_wrt_LogNewFiles "$name"
|
||||||
CHROOT_wrt_RemoveBuildDirs "$name"
|
|
||||||
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
|
|
||||||
CHROOT_wrt_LogNewFiles "$name"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Include a touch of the target name so make can check
|
# Include a touch of the target name so make can check
|
||||||
|
@ -313,24 +285,11 @@ chapter78_Makefiles() {
|
||||||
# as a dependency. Also call the echo_message function.
|
# as a dependency. Also call the echo_message function.
|
||||||
CHROOT_wrt_target "${this_script}" "$PREV"
|
CHROOT_wrt_target "${this_script}" "$PREV"
|
||||||
|
|
||||||
# Find the bootscripts and kernel package names
|
# For bootscripts and kernel, start INSTALL_LOG if requested
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*bootscripts)
|
*bootscripts | *kernel ) if [ "${INSTALL_LOG}" = "y" ] ; then
|
||||||
name="lfs-bootscripts"
|
CHROOT_wrt_TouchTimestamp
|
||||||
pkg_tarball=$(get_package_tarball_name $name)
|
fi ;;
|
||||||
if [ "${INSTALL_LOG}" = "y" ] ; then
|
|
||||||
CHROOT_wrt_TouchTimestamp
|
|
||||||
fi
|
|
||||||
CHROOT_Unpack "$pkg_tarball"
|
|
||||||
;;
|
|
||||||
*kernel)
|
|
||||||
name="linux"
|
|
||||||
pkg_tarball=$(get_package_tarball_name $name)
|
|
||||||
if [ "${INSTALL_LOG}" = "y" ] ; then
|
|
||||||
CHROOT_wrt_TouchTimestamp
|
|
||||||
fi
|
|
||||||
CHROOT_Unpack "$pkg_tarball"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Check if we have a real /etc/fstab file
|
# Check if we have a real /etc/fstab file
|
||||||
|
@ -346,13 +305,11 @@ chapter78_Makefiles() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*bootscripts) CHROOT_wrt_RemoveBuildDirs "dummy"
|
*bootscripts) if [ "${INSTALL_LOG}" = "y" ] ; then
|
||||||
if [ "${INSTALL_LOG}" = "y" ] ; then
|
CHROOT_wrt_LogNewFiles "lfs-bootscripts"
|
||||||
CHROOT_wrt_LogNewFiles "$name"
|
|
||||||
fi ;;
|
fi ;;
|
||||||
*kernel) CHROOT_wrt_RemoveBuildDirs "dummy"
|
*kernel) if [ "${INSTALL_LOG}" = "y" ] ; then
|
||||||
if [ "${INSTALL_LOG}" = "y" ] ; then
|
CHROOT_wrt_LogNewFiles "linux"
|
||||||
CHROOT_wrt_LogNewFiles "$name"
|
|
||||||
fi ;;
|
fi ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -402,18 +359,12 @@ build_Makefile() { #
|
||||||
CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
|
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 | \
|
chroot=`cat $file | tr -d '\n' | \
|
||||||
sed -e "s@chroot@$CHROOT_LOC@" \
|
sed -e "s@chroot@$CHROOT_LOC@" \
|
||||||
-e '/#!\/bin\/bash/d' \
|
-e 's@ \\\@ @g' \
|
||||||
-e 's@ \\\@ @g' | \
|
|
||||||
tr -d '\n' | \
|
|
||||||
sed -e 's/ */ /g' \
|
|
||||||
-e 's|\\$|&&|g' \
|
-e 's|\\$|&&|g' \
|
||||||
-e 's|exit||g' \
|
|
||||||
-e 's|$| -c|' \
|
|
||||||
-e 's|"$$LFS"|$(MOUNT_PT)|' \
|
-e 's|"$$LFS"|$(MOUNT_PT)|' \
|
||||||
-e 's|set -e||' \
|
-e 's|$| -c|'`
|
||||||
-e 's|set +h||'`
|
|
||||||
echo -e "CHROOT$i= $chroot\n" >> $MKFILE
|
echo -e "CHROOT$i= $chroot\n" >> $MKFILE
|
||||||
i=`expr $i + 1`
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
|
|
Reference in a new issue