diff --git a/doc/011-Tool_Chain-Kernel_Headers b/doc/011-Tool_Chain-Kernel_Headers index 7ec4273..3dc8091 100755 --- a/doc/011-Tool_Chain-Kernel_Headers +++ b/doc/011-Tool_Chain-Kernel_Headers @@ -11,10 +11,10 @@ make mrproper ARCH=${MLFS_ARCH} make headers # For kernels up to 5.2.x: -# find dest/include \( -name .install -o -name ..install.cmd \) -delete +# find dest/include \( -name .install -o -name ..install.cmd \) -exec rm -rvf {} \; # For kernels 5.3.x and newer: -find usr/include \( -name .install -o -name ..install.cmd \) -delete +find usr/include \( -name .install -o -name ..install.cmd \) -exec rm -rvf {} \; # Install cp -rv usr/include/* /tools/include diff --git a/doc/039-Stripping_and_Ownership b/doc/039-Stripping_and_Ownership index ed07b77..5103892 100755 --- a/doc/039-Stripping_and_Ownership +++ b/doc/039-Stripping_and_Ownership @@ -1,11 +1,11 @@ -# Stripping -# This step is optional, but if the LFS partition -# is rather small, it is beneficial to learn that -# unnecessary items can be removed. The executables -# and libraries built so far contain about 70 MB -# of unneeded debugging symbols. +# Stripping +# This step is optional, but if the LFS partition +# is rather small, it is beneficial to learn that +# unnecessary items can be removed. The executables +# and libraries built so far contain about 70 MB +# of unneeded debugging symbols. -# Remove debug symbols with: +# Remove debug symbols with: strip --strip-debug /tools/lib/* /usr/bin/strip --strip-unneeded /tools/{,s}bin/* @@ -13,31 +13,31 @@ strip --strip-debug /tools/lib/* rm -rf /tools/{,share}/{info,man,doc} # Remove unneeded files: -find /tools/{lib,libexec} -name \*.la -delete +find /tools/{lib,libexec} -name \*.la -exec rm -rvf {} \; -# Changing Ownership -# Currently, the $MLFS/tools directory is owned by -# the user mlfs, a user that exists only on the -# host system. If the $MLFS/tools directory is kept -# as is, the files are owned by a user ID without -# a corresponding account. This is dangerous because -# a user account created later could get this same -# user ID and would own the $MLFS/tools directory -# and all the files therein, thus exposing these +# Changing Ownership +# Currently, the $MLFS/tools directory is owned by +# the user mlfs, a user that exists only on the +# host system. If the $MLFS/tools directory is kept +# as is, the files are owned by a user ID without +# a corresponding account. This is dangerous because +# a user account created later could get this same +# user ID and would own the $MLFS/tools directory +# and all the files therein, thus exposing these # files to possible malicious manipulation. -# To avoid this issue, you could add the lfs user -# to the new MLFS system later when creating the -# /etc/passwd file, taking care to assign it the -# same user and group IDs as on the host system. +# To avoid this issue, you could add the lfs user +# to the new MLFS system later when creating the +# /etc/passwd file, taking care to assign it the +# same user and group IDs as on the host system. # ************************************************ -# The commands in the remainder of this build must -# be performed while logged in as user root and -# no longer as user mlfs. Also, double check that +# The commands in the remainder of this build must +# be performed while logged in as user root and +# no longer as user mlfs. Also, double check that # $MLFS is set in root's environment. # ************************************************ -# Change the ownership of the $MLFS/tools directory +# Change the ownership of the $MLFS/tools directory # to user root by running the following command: -chown -R root:root $MLFS/tools +chown -R root:root $MLFS/tools diff --git a/doc/044-Final_System-Kernel_Headers b/doc/044-Final_System-Kernel_Headers index 639f340..49f743f 100755 --- a/doc/044-Final_System-Kernel_Headers +++ b/doc/044-Final_System-Kernel_Headers @@ -7,8 +7,8 @@ make mrproper # Extract headers -# !! The recommended make target “headers_install” cannot -# !! be used, because it requires rsync, which is not +# !! The recommended make target “headers_install” cannot +# !! be used, because it requires rsync, which is not # !! available in /tools. The headers are first placed in ./usr # # For kernels up to 5.2.x: @@ -17,14 +17,14 @@ make mrproper # For kernels 5.3.x and newer: make headers -# There are also some hidden files used by the kernel -# developers and not needed by MLFS that are removed +# There are also some hidden files used by the kernel +# developers and not needed by MLFS that are removed # from the intermediate directory. # Kernels up to 5.2.x: -# find dest/include \( -name .install -o -name ..install.cmd \) -delete +# find dest/include \( -name .install -o -name ..install.cmd \) -exec rm -rvf {} \; # Kernels 5.3.x and newer: -find usr/include -name '.*' -delete +find usr/include -name '.*' -exec rm -rvf {} \; # Install Headers # Kernel up to 5.2.x: diff --git a/doc/128-Final_System-Clean_up b/doc/128-Final_System-Clean_up index d087a19..bb6507c 100644 --- a/doc/128-Final_System-Clean_up +++ b/doc/128-Final_System-Clean_up @@ -20,6 +20,6 @@ rm -fv /usr/lib/lib{com_err,e2p,ext2fs,ss}.a rm -fv /usr/lib/libltdl.a rm -fv /usr/lib/libfl.a rm -fv /usr/lib/libz.a -find /usr/lib /usr/libexec -name \*.la -delete +find /usr/lib /usr/libexec -name \*.la -exec rm -rvf {} \; # It is also safe to remove /tools and /cross-tools directories as they're not required anymore diff --git a/download_sources.sh b/download_sources.sh new file mode 100755 index 0000000..75d6b7c --- /dev/null +++ b/download_sources.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Simple shell hack to download and MD5 check source tarballs. +# Copyright 2021: Luiz Antônio (takusuman). +# This particular script is dual-licensed between BSD 2-Clause +# and GPL3, at your preference. +# n() function taken from otto-pkg's posix-alt.shi lib. + +# USAGE: ./download_sources.sh sources.list sources.md5sum + +MD5CHECK=${MD5CHECK:-YES}; + +# Workaround to the # macro in arrays +# which doesn't work properly in bash 4.3 for some reason. +n(){ + echo ${@} | tr " " "\n" | wc -l; +} + +main(){ + PARENTDIR=${PWD}; + test ! -e src && mkdir src; + urls=( `cat ${1} | tr "\n" " "` ); + n_urls=`n ${urls[*]}`; + cd src; + for (( i=0; i < ${n_urls}; i++ )){ + printf '%s\n' "Downloading $(basename ${urls[${i}]})"; + curl -L ${urls[${i}]} -O; + } + [ ${MD5CHECK} == 'YES' ] && + md5sum -c ${2}; + cd ${PARENTDIR}; + return 0; +} + +main "${1}" "${2}";