Browse Source

add branch development

development
Cyril CONSTANTIN 2 weeks ago
parent
commit
e20979f9f2
  1. 315
      build.sh

315
build.sh

@ -1,46 +1,43 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cat > /tmp/lfs_sudo << EOF cat > /tmp/lfsdev_sudo << EOF
# 3.1. Introduction lfsdev ALL = NOPASSWD: /usr/bin/chown * /mnt/lfsdev*
# 4.3. Adding the LFS User lfsdev ALL = NOPASSWD: /usr/bin/mount * /mnt/lfsdev*
lfs ALL = NOPASSWD: /usr/bin/chown * /mnt/lfs* lfsdev ALL = NOPASSWD: /usr/bin/install * /mnt/lfsdev*
# 7.3. Preparing Virtual Kernel File Systems lfsdev ALL = NOPASSWD: /usr/sbin/chroot /mnt/lfsdev*
lfs ALL = NOPASSWD: /usr/bin/mount * /mnt/lfs*
lfs ALL = NOPASSWD: /usr/bin/install * /mnt/lfs*
lfs ALL = NOPASSWD: /usr/sbin/chroot /mnt/lfs*
EOF EOF
add_lfs_user() add_lfsdev_user()
{ {
echo "4.3. Adding the LFS User" echo "4.3. Adding the lfsdev User"
echo "# groupadd lfs" echo "# groupadd lfsdev"
echo "# useradd -s /bin/bash -g lfs -m -k /dev/null lfs" echo "# useradd -s /bin/bash -g lfsdev -m -k /dev/null lfsdev"
echo "# passwd lfs" echo "# passwd lfsdev"
echo "And add sudo rights" echo "And add sudo rights"
echo "# cp /tmp/lfs_sudo /etc/sudoers.d/lfs" echo "# cp /tmp/lfsdev_sudo /etc/sudoers.d/lfsdev"
echo "Now connect as lfs and execute the script" echo "Now connect as lfsdev and execute the script"
echo "$ su - lfs" echo "$ su - lfsdev"
echo "$ cd <lfs build git repo>" echo "$ cd <lfsdev build git repo>"
echo "$ bash build.sh" echo "$ bash build.sh"
} }
if [ "$(whoami)" != "lfs" ] if [ "$(whoami)" != "lfsdev" ]
then then
echo "Please execute this script as user lfs" echo "Please execute this script as user lfsdev"
grep -q lfs /etc/passwd || add_lfs_user grep -q lfsdev /etc/passwd || add_lfsdev_user
exit 1 exit 1
fi fi
set -ueEo pipefail set -ueEo pipefail
export LFS=/mnt/lfs export LFS=/mnt/lfsdev
# shellcheck source=/dev/null # shellcheck source=/dev/null
if [ ! -e /home/lfs/.lfsbuild_config ] if [ ! -e /home/lfsdev/.lfsdevbuild_config ]
then then
cat > /home/lfs/.lfsbuild_config << EOSF cat > /home/lfsdev/.lfsdevbuild_config << EOSF
# location of local package sources # location of local package sources
LFS_PACKAGE_DIR=/home/lfs/packages LFS_PACKAGE_DIR=/home/lfsdev/packages
# Number of processors to use # Number of processors to use
LFS_NPROC=$(nproc) LFS_NPROC=$(nproc)
# Bypass step by step validation until a breakpoint # Bypass step by step validation until a breakpoint
@ -57,10 +54,10 @@ EOSF
fi fi
# shellcheck source=/dev/null # shellcheck source=/dev/null
source /home/lfs/.lfsbuild_config source /home/lfsdev/.lfsdevbuild_config
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
LFS_PACKAGE_DIR=${LFS_PACKAGE_DIR:-/home/lfs/packages} LFS_PACKAGE_DIR=${LFS_PACKAGE_DIR:-/home/lfsdev/packages}
LFS_NPROC=${LFS_NPROC:-$(nproc)} LFS_NPROC=${LFS_NPROC:-$(nproc)}
LFS_BREAKPOINT=${LFS_BREAKPOINT:-1} LFS_BREAKPOINT=${LFS_BREAKPOINT:-1}
LFS_STRIP_BINARIES=${LFS_STRIP_BINARIES:-false} LFS_STRIP_BINARIES=${LFS_STRIP_BINARIES:-false}
@ -123,12 +120,12 @@ ask_for_execution() {
} }
# 2.2 # 2.2
cat > /tmp/lfs_version-check.sh << "EOF" cat > /tmp/lfsdev_version-check.sh << "EOF"
#!/bin/bash #!/bin/bash
# A script to list version numbers of critical development tools # A script to list version numbers of critical development tools
# If you have tools installed in other directories, adjust PATH here AND # If you have tools installed in other directories, adjust PATH here AND
# in ~lfs/.bashrc (section 4.4) as well. # in ~lfsdev/.bashrc (section 4.4) as well.
LC_ALL=C LC_ALL=C
PATH=/usr/bin:/bin PATH=/usr/bin:/bin
@ -206,10 +203,10 @@ version_check()
alias_check sh Bash alias_check sh Bash
echo "Compiler check:" echo "Compiler check:"
if printf "int main(){}" | g++ -x c++ -o /tmp/lfs_a.out - if printf "int main(){}" | g++ -x c++ -o /tmp/lfsdev_a.out -
then echo "OK: g++ works"; then echo "OK: g++ works";
else echo "ERROR: g++ does NOT work"; fi else echo "ERROR: g++ does NOT work"; fi
rm -f /tmp/lfs_a.out rm -f /tmp/lfsdev_a.out
if [ "$(nproc)" = "" ]; then if [ "$(nproc)" = "" ]; then
echo "ERROR: nproc is not available or it produces empty output" echo "ERROR: nproc is not available or it produces empty output"
@ -220,32 +217,32 @@ version_check()
EOF EOF
# shellcheck source=/dev/null # shellcheck source=/dev/null
source /tmp/lfs_version-check.sh source /tmp/lfsdev_version-check.sh
# 2.6. Setting the $LFS Variable and the Umask # 2.6. Setting the $LFS Variable and the Umask
# 4.4. Setting Up the Environment # 4.4. Setting Up the Environment
cat > ~/.bashrc << EOF cat > ~/.bashrc << EOF
set +h set +h
umask 022 umask 022
export LFS=/mnt/lfs export LFS=/mnt/lfsdev
export PATH=/usr/bin export PATH=/usr/bin
if [ ! -L /bin ]; then PATH=/bin:$PATH; fi if [ ! -L /bin ]; then PATH=/bin:$PATH; fi
export PATH=/mnt/lfs/tools/bin:$PATH:/usr/sbin export PATH=/mnt/lfsdev/tools/bin:$PATH:/usr/sbin
export CONFIG_SITE=$LFS/usr/share/config.site export CONFIG_SITE=$LFS/usr/share/config.site
export MAKEFLAGS=-j${LFS_NPROC} export MAKEFLAGS=-j${LFS_NPROC}
export ARCH=$(uname -m) export ARCH=$(uname -m)
export LC_ALL=POSIX export LC_ALL=POSIX
export LFS_VERSION=13.0 export LFS_VERSION=13.0
export LFS_CODENAME=lfs # change this to whatever you want export LFS_CODENAME=lfsdev # change this to whatever you want
export LFS_KERNEL_VERSION=6.18.10 export LFS_KERNEL_VERSION=6.18.10
export LFS_TGT=$(uname -m)-lfs-linux-gnu export LFS_TGT=$(uname -m)-lfsdev-linux-gnu
export LFS_ZONEINFO=$(realpath --relative-to=/usr/share/zoneinfo /etc/localtime) export LFS_ZONEINFO=$(realpath --relative-to=/usr/share/zoneinfo /etc/localtime)
export LFS_HOSTNAME=${LFS_HOSTNAME:-lfs} # change this to whatever you want export LFS_HOSTNAME=${LFS_HOSTNAME:-lfsdev} # change this to whatever you want
export SOURCES=$LFS/sources export SOURCES=$LFS/sources
export HLFSB=/home/lfs/lfs_build export HLFSB=/home/lfsdev/lfsdev_build
export SLFSB=/mnt/lfs/sources/lfs_build export SLFSB=/mnt/lfsdev/sources/lfsdev_build
export RLFSB=/sources/lfs_build export RLFSB=/sources/lfsdev_build
export STEMP=/mnt/lfs/tmp export STEMP=/mnt/lfsdev/tmp
EOF EOF
# shellcheck source=/dev/null # shellcheck source=/dev/null
@ -257,8 +254,8 @@ source ~/.bashrc
## shellcheck source=/dev/null ## shellcheck source=/dev/null
# source ~/.bash_profile # source ~/.bash_profile
cat > "${HOME}"/lfs_chroot.sh <<EOSF cat > "${HOME}"/lfsdev_chroot.sh <<EOSF
if ! mount |grep -q "proc on /mnt/lfs/proc type proc" if ! mount |grep -q "proc on /mnt/lfsdev/proc type proc"
then then
echo "chroot is not available at this step" echo "chroot is not available at this step"
exit 1 exit 1
@ -266,7 +263,7 @@ fi
sudo /usr/sbin/chroot $LFS /usr/bin/env -i \ sudo /usr/sbin/chroot $LFS /usr/bin/env -i \
HOME=/root \ HOME=/root \
TERM="${TERM}" \ TERM="${TERM}" \
PS1='(lfs chroot) \u:\w\$ ' \ PS1='(lfsdev chroot) \u:\w\$ ' \
PATH=/usr/bin:/usr/sbin \ PATH=/usr/bin:/usr/sbin \
LFS_NPROC=${LFS_NPROC} \ LFS_NPROC=${LFS_NPROC} \
MAKEFLAGS="-j${LFS_NPROC}" \ MAKEFLAGS="-j${LFS_NPROC}" \
@ -507,7 +504,7 @@ describe()
;; ;;
zlib) zlib)
echo "Zlib : This package contains compression and decompression routines used by some programs." echo "Zlib : This package contains compression and decompression routines used by some programs."
;; 0 ;;
zstd) zstd)
echo "Zstd : This package supplies compression and decompression routines used by some programs. It provides high compression ratios and a very wide range of compression / speed trade-offs." echo "Zstd : This package supplies compression and decompression routines used by some programs. It provides high compression ratios and a very wide range of compression / speed trade-offs."
;; ;;
@ -921,8 +918,8 @@ copy_scripts()
create_directories() create_directories()
{ {
echo "call create_directories" echo "call create_directories"
echo "sudo operation : /usr/bin/chown lfs:root $LFS" echo "sudo operation : /usr/bin/chown lfsdev:root $LFS"
sudo /usr/bin/chown lfs:root $LFS || return 1 sudo /usr/bin/chown lfsdev:root $LFS || return 1
mkdir --parents --verbose $LFS/{etc,var,tools,dev,proc,sys,run} $LFS/usr/{bin,lib,sbin} mkdir --parents --verbose $LFS/{etc,var,tools,dev,proc,sys,run} $LFS/usr/{bin,lib,sbin}
@ -987,17 +984,17 @@ cross_toolchain()
fi fi
pushd "${buildpath}" pushd "${buildpath}"
set -ueExo pipefail set -ueExo pipefail
if ! eval "$(cat ../"${scriptname}")" | tee "/tmp/lfs_${step}.log" if ! eval "$(cat ../"${scriptname}")" | tee "/tmp/lfsdev_${step}.log"
then then
echo "compilation error" echo "compilation error"
exit 1 exit 1
else else
echo "compilation ok" echo "compilation ok"
cp -v "/tmp/lfs_${step}.log" "${HOME}" cp -v "/tmp/lfsdev_${step}.log" "${HOME}"
fi fi
popd popd
set -ueEo pipefail set -ueEo pipefail
check_errors "/tmp/lfs_${step}.log" check_errors "/tmp/lfsdev_${step}.log"
rm --recursive --verbose --force "${buildpath}" rm --recursive --verbose --force "${buildpath}"
echo "${step}" > "${SLFSB}" echo "${step}" > "${SLFSB}"
ask_for_exit "${step}" ask_for_exit "${step}"
@ -1031,7 +1028,7 @@ building_temporary_tools()
then then
archivepath=$(find "${SOURCES}" -name "${packagename}*.tar.*" -print) archivepath=$(find "${SOURCES}" -name "${packagename}*.tar.*" -print)
echo "archpath: ${archivepath}" echo "archpath: ${archivepath}"
archivesubpath=${archivepath##/mnt/lfs} archivesubpath=${archivepath##/mnt/lfsdev}
echo "archivesubpath: ${archivesubpath}" echo "archivesubpath: ${archivesubpath}"
archivename=$(basename "${archivepath}") archivename=$(basename "${archivepath}")
echo "archname: ${archivename}" echo "archname: ${archivename}"
@ -1040,7 +1037,7 @@ building_temporary_tools()
echo "There is no archive with this name !!!" echo "There is no archive with this name !!!"
exit 1 exit 1
fi fi
sudofile=/tmp/lfs_${step}.sh sudofile=/tmp/lfsdev_${step}.sh
cat > "${sudofile}" << EOSF cat > "${sudofile}" << EOSF
if [ -d "${buildpath}" ] if [ -d "${buildpath}" ]
then then
@ -1055,21 +1052,21 @@ then
fi fi
pushd "${buildpath}" pushd "${buildpath}"
set -ueExo pipefail set -ueExo pipefail
eval "\$(cat ../"${scriptname}")" | tee "/tmp/lfs_${step}.log" eval "\$(cat ../"${scriptname}")" | tee "/tmp/lfsdev_${step}.log"
popd popd
rm -rf "${buildpath}" rm -rf "${buildpath}"
set -ueEo pipefail set -ueEo pipefail
EOSF EOSF
if ! lfs_chroot "${sudofile}" if ! lfsdev_chroot "${sudofile}"
then then
echo "compilation error" echo "compilation error"
exit 1 exit 1
else else
echo "compilation ok" echo "compilation ok"
fi fi
check_errors "${STEMP}/lfs_${step}.log" check_errors "${STEMP}/lfsdev_${step}.log"
echo "${step}" > "${SLFSB}" echo "${step}" > "${SLFSB}"
cp -v "${STEMP}/lfs_${step}.log" "${HOME}" cp -v "${STEMP}/lfsdev_${step}.log" "${HOME}"
ask_for_exit "${step}" ask_for_exit "${step}"
done done
} }
@ -1077,12 +1074,12 @@ EOSF
check_virtual_kernel_filesystems() check_virtual_kernel_filesystems()
{ {
echo "call check_virtual_kernel_filesystems" echo "call check_virtual_kernel_filesystems"
if mount |grep -q "udev on /mnt/lfs/dev type devtmpfs" && \ if mount |grep -q "udev on /mnt/lfsdev/dev type devtmpfs" && \
mount |grep -q "devpts on /mnt/lfs/dev/pts type devpts" && \ mount |grep -q "devpts on /mnt/lfsdev/dev/pts type devpts" && \
mount |grep -q "proc on /mnt/lfs/proc type proc" && \ mount |grep -q "proc on /mnt/lfsdev/proc type proc" && \
mount |grep -q "sysfs on /mnt/lfs/sys type sysfs" && \ mount |grep -q "sysfs on /mnt/lfsdev/sys type sysfs" && \
mount |grep -q "tmpfs on /mnt/lfs/run type tmpfs" && \ mount |grep -q "tmpfs on /mnt/lfsdev/run type tmpfs" && \
mount |grep -q "tmpfs on /mnt/lfs/dev/shm type tmpfs" mount |grep -q "tmpfs on /mnt/lfsdev/dev/shm type tmpfs"
then then
echo "Ok, Filesystems are ready for chroot" echo "Ok, Filesystems are ready for chroot"
return 0 return 0
@ -1122,11 +1119,11 @@ mount_virtual_kernel_filesystem()
return 0 return 0
} }
lfs_chroot() lfsdev_chroot()
{ {
echo "call lfs_chroot $1" echo "call lfsdev_chroot $1"
CHROOTFILE=$1 CHROOTFILE=$1
sed "1iif [[ ! \"\${UID\}\" -eq 0 ]] && [ ! -e ${CHROOTFILE} ] && [ -e /sources/lfs_build ]" -i "${CHROOTFILE}" sed "1iif [[ ! \"\${UID\}\" -eq 0 ]] && [ ! -e ${CHROOTFILE} ] && [ -e /sources/lfsdev_build ]" -i "${CHROOTFILE}"
sed "2ithen" -i "${CHROOTFILE}" sed "2ithen" -i "${CHROOTFILE}"
sed "3iecho \"bad chroot\"" -i "${CHROOTFILE}" sed "3iecho \"bad chroot\"" -i "${CHROOTFILE}"
sed "4iexit 1" -i "${CHROOTFILE}" sed "4iexit 1" -i "${CHROOTFILE}"
@ -1135,7 +1132,7 @@ lfs_chroot()
if cat "${CHROOTFILE}" | sudo /usr/sbin/chroot "$LFS" /usr/bin/env -i \ if cat "${CHROOTFILE}" | sudo /usr/sbin/chroot "$LFS" /usr/bin/env -i \
HOME=/root \ HOME=/root \
TERM="$TERM" \ TERM="$TERM" \
PS1='(lfs chroot) \u:\w\$ ' \ PS1='(lfsdev chroot) \u:\w\$ ' \
PATH=/usr/bin:/usr/sbin \ PATH=/usr/bin:/usr/sbin \
LFS_NPROC="${LFS_NPROC}" \ LFS_NPROC="${LFS_NPROC}" \
MAKEFLAGS="-j${LFS_NPROC}" \ MAKEFLAGS="-j${LFS_NPROC}" \
@ -1164,9 +1161,9 @@ main() {
if [[ $(cat "${HLFSB}") -lt 22000 ]] if [[ $(cat "${HLFSB}") -lt 22000 ]]
then then
set +e set +e
version_check | tee /tmp/lfs_version_check.log version_check | tee /tmp/lfsdev_version_check.log
echo "=== Check for errors ===" echo "=== Check for errors ==="
grep ERROR /tmp/lfs_version_check.log && exit 1 grep ERROR /tmp/lfsdev_version_check.log && exit 1
if [ -e /etc/bash.bashrc ] if [ -e /etc/bash.bashrc ]
then then
echo "Please disable /etc/bash.bashrc for compilation" echo "Please disable /etc/bash.bashrc for compilation"
@ -1177,20 +1174,20 @@ main() {
fi fi
echo "2.7. Mounting the New Partition" echo "2.7. Mounting the New Partition"
if ! mount |grep -q "/mnt/lfs type ext4" if ! mount |grep -q "/mnt/lfsdev type ext4"
then then
echo "2.4. Creating a New Partition" echo "2.4. Creating a New Partition"
echo "2.5. Creating a File System on the Partition" echo "2.5. Creating a File System on the Partition"
echo "2.7. Mounting the New Partition" echo "2.7. Mounting the New Partition"
echo "You have to mount a ext4 partition under /mnt/lfs" echo "You have to mount a ext4 partition under /mnt/lfsdev"
echo "Think to create a swap partition on the target device" echo "Think to create a swap partition on the target device"
exit 1 exit 1
fi fi
if [ "${LFS}" != "/mnt/lfs" ] if [ "${LFS}" != "/mnt/lfsdev" ]
then then
echo "2.6. Setting the \$LFS Variable and the Umask" echo "2.6. Setting the \$LFS Variable and the Umask"
echo "LFS is not /mnt/lfs" echo "LFS is not /mnt/lfsdev"
exit 1 exit 1
fi fi
@ -1247,11 +1244,11 @@ main() {
echo "4.2. Creating a Limited Directory Layout in the LFS Filesystem" echo "4.2. Creating a Limited Directory Layout in the LFS Filesystem"
echo "III. Building the LFS Cross Toolchain and Temporary Tools" echo "III. Building the LFS Cross Toolchain and Temporary Tools"
echo "Failed to create directories on $LFS" echo "Failed to create directories on $LFS"
echo "The user lfs has not sufficient rights" echo "The user lfsdev has not sufficient rights"
echo "If not, you can fix it manually" echo "If not, you can fix it manually"
echo "Or the file /tmp/lfs_sudo may be copied under /etc/sudoers.d/lfs" echo "Or the file /tmp/lfsdev_sudo may be copied under /etc/sudoers.d/lfsdev"
echo "And execute the following command as root to valide syntax" echo "And execute the following command as root to valide syntax"
echo "# visudo /etc/sudoers.d/lfs" echo "# visudo /etc/sudoers.d/lfsdev"
exit 1 exit 1
fi fi
else else
@ -1283,9 +1280,9 @@ main() {
echo "Copy scripts to sources failed" echo "Copy scripts to sources failed"
exit 1 exit 1
else else
if [[ ! $(du /mnt/lfs/sources/ |cut -f 1) -gt 500000 ]] if [[ ! $(du /mnt/lfsdev/sources/ |cut -f 1) -gt 500000 ]]
then then
echo "check /mnt/lfs/sources content failed" echo "check /mnt/lfsdev/sources content failed"
exit 1 exit 1
fi fi
echo "48000" > "${HLFSB}" echo "48000" > "${HLFSB}"
@ -1298,7 +1295,7 @@ main() {
if [ ! -e "${SLFSB}" ] if [ ! -e "${SLFSB}" ]
then then
echo "Initialize lfs_build on /mnt/lfs" echo "Initialize lfsdev_build on /mnt/lfsdev"
echo "48000" > "${SLFSB}" echo "48000" > "${SLFSB}"
rm --force --verbose "${HLFSB}" rm --force --verbose "${HLFSB}"
ln --symbolic --force --verbose "${SLFSB}" "${HLFSB}" ln --symbolic --force --verbose "${SLFSB}" "${HLFSB}"
@ -1324,22 +1321,22 @@ main() {
then then
case $(uname -m) in case $(uname -m) in
x86_64) x86_64)
if [ ! -e /mnt/lfs/tools/x86_64-lfs-linux-gnu/bin/ld ] || \ if [ ! -e /mnt/lfsdev/tools/x86_64-lfsdev-linux-gnu/bin/ld ] || \
[ ! -e /mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-gcc ] || \ [ ! -e /mnt/lfsdev/tools/bin/x86_64-lfsdev-linux-gnu-gcc ] || \
[ ! -e /mnt/lfs/usr/include/asm/fcntl.h ] || \ [ ! -e /mnt/lfsdev/usr/include/asm/fcntl.h ] || \
[ ! -e /mnt/lfs/usr/sbin/ldconfig ] || \ [ ! -e /mnt/lfsdev/usr/sbin/ldconfig ] || \
[ ! -e /mnt/lfs/usr/lib/libstdc++.so.6.0.34 ] [ ! -e /mnt/lfsdev/usr/lib/libstdc++.so.6.0.34 ]
then then
echo "Some binaries are missing from cross_toolchain 5xxxx" echo "Some binaries are missing from cross_toolchain 5xxxx"
exit 1 exit 1
fi fi
;; ;;
i686) i686)
if [ ! -e /mnt/lfs/tools/bin/i686-lfs-linux-gnu-ld ] || \ if [ ! -e /mnt/lfsdev/tools/bin/i686-lfsdev-linux-gnu-ld ] || \
[ ! -e /mnt/lfs/tools/bin/i686-lfs-linux-gnu-gcc ] || \ [ ! -e /mnt/lfsdev/tools/bin/i686-lfsdev-linux-gnu-gcc ] || \
[ ! -e /mnt/lfs/usr/include/asm/fcntl.h ] || \ [ ! -e /mnt/lfsdev/usr/include/asm/fcntl.h ] || \
[ ! -e /mnt/lfs/usr/sbin/ldconfig ] || \ [ ! -e /mnt/lfsdev/usr/sbin/ldconfig ] || \
[ ! -e /mnt/lfs/usr/lib/libstdc++.so.6.0.34 ] [ ! -e /mnt/lfsdev/usr/lib/libstdc++.so.6.0.34 ]
then then
echo "Some binaries are missing from cross_toolchain 5xxxx" echo "Some binaries are missing from cross_toolchain 5xxxx"
exit 1 exit 1
@ -1392,7 +1389,7 @@ main() {
if [[ $(cat "${SLFSB}") -lt 70200 ]] if [[ $(cat "${SLFSB}") -lt 70200 ]]
then then
echo "Preparing for chroot step." echo "Preparing for chroot step."
echo "/mnt/lfs will be closed for chroot" echo "/mnt/lfsdev will be closed for chroot"
echo "Do you validate preceding steps ?" echo "Do you validate preceding steps ?"
if ask_for_exit 61810 if ask_for_exit 61810
then then
@ -1407,7 +1404,7 @@ main() {
esac esac
if sudo /usr/bin/chown -R root:root $LFS/{usr,var,etc,tools} if sudo /usr/bin/chown -R root:root $LFS/{usr,var,etc,tools}
then then
sudo /usr/bin/chown lfs "${SLFSB}" || exit 1 sudo /usr/bin/chown lfsdev "${SLFSB}" || exit 1
echo "70200" > "${SLFSB}" echo "70200" > "${SLFSB}"
else else
echo "Rights error" echo "Rights error"
@ -1444,7 +1441,7 @@ main() {
echo "7.5. Creating Directories" echo "7.5. Creating Directories"
if [[ $(cat "${SLFSB}") -lt 70500 ]] if [[ $(cat "${SLFSB}") -lt 70500 ]]
then then
sudofile=/tmp/lfs_70500.sh sudofile=/tmp/lfsdev_70500.sh
cat > ${sudofile} << "EOSF" cat > ${sudofile} << "EOSF"
mkdir -pv /{boot,home,mnt,opt,srv} mkdir -pv /{boot,home,mnt,opt,srv}
mkdir -pv /etc/{opt,sysconfig} mkdir -pv /etc/{opt,sysconfig}
@ -1463,7 +1460,7 @@ ln -sfv /run/lock /var/lock
install -dv -m 0750 /root install -dv -m 0750 /root
install -dv -m 1777 /tmp /var/tmp install -dv -m 1777 /tmp /var/tmp
EOSF EOSF
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "70500" > "${SLFSB}" echo "70500" > "${SLFSB}"
fi fi
@ -1474,7 +1471,7 @@ EOSF
echo "7.6. Creating Essential Files and Symlinks" echo "7.6. Creating Essential Files and Symlinks"
if [[ $(cat "${SLFSB}") -lt 70600 ]] if [[ $(cat "${SLFSB}") -lt 70600 ]]
then then
sudofile=/tmp/lfs_70600.sh sudofile=/tmp/lfsdev_70600.sh
cat > ${sudofile} << "EOSF" cat > ${sudofile} << "EOSF"
ln -sv /proc/self/mounts /etc/mtab ln -sv /proc/self/mounts /etc/mtab
cat > /etc/hosts << EOF cat > /etc/hosts << EOF
@ -1541,7 +1538,7 @@ chgrp -v utmp /var/log/lastlog
chmod -v 664 /var/log/lastlog chmod -v 664 /var/log/lastlog
chmod -v 600 /var/log/btmp chmod -v 600 /var/log/btmp
EOSF EOSF
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "70600" > "${SLFSB}" echo "70600" > "${SLFSB}"
fi fi
@ -1574,13 +1571,13 @@ EOSF
echo "7.13. Cleaning up and Saving the Temporary System" echo "7.13. Cleaning up and Saving the Temporary System"
if [[ $(cat "${SLFSB}") -lt 71310 ]] if [[ $(cat "${SLFSB}") -lt 71310 ]]
then then
sudofile=/tmp/lfs_71310.sh sudofile=/tmp/lfsdev_71310.sh
cat > ${sudofile} << "EOSF" cat > ${sudofile} << "EOSF"
rm -rf /usr/share/{info,man,doc}/* rm -rf /usr/share/{info,man,doc}/*
find /usr/{lib,libexec} -name \*.la -delete find /usr/{lib,libexec} -name \*.la -delete
# rm -rf /tools # rm -rf /tools
EOSF EOSF
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "71310" > "${SLFSB}" echo "71310" > "${SLFSB}"
fi fi
@ -1689,7 +1686,7 @@ EOSF
echo "8.85. Stripping" echo "8.85. Stripping"
if [[ $(cat "${SLFSB}") -lt 88510 ]] if [[ $(cat "${SLFSB}") -lt 88510 ]]
then then
sudofile=/tmp/lfs_88510.sh sudofile=/tmp/lfsdev_88510.sh
cat > ${sudofile} << "EOSF" cat > ${sudofile} << "EOSF"
save_usrlib="$(cd /usr/lib; ls ld-linux*[^g]) save_usrlib="$(cd /usr/lib; ls ld-linux*[^g])
libc.so.6 libc.so.6
@ -1745,7 +1742,7 @@ EOSF
echo "Do you want to strip binaries ?" echo "Do you want to strip binaries ?"
if ${LFS_STRIP_BINARIES} if ${LFS_STRIP_BINARIES}
then then
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "88510" > "${SLFSB}" echo "88510" > "${SLFSB}"
fi fi
@ -1760,14 +1757,14 @@ EOSF
echo "8.86. Cleaning Up" echo "8.86. Cleaning Up"
if [[ $(cat "${SLFSB}") -lt 88610 ]] if [[ $(cat "${SLFSB}") -lt 88610 ]]
then then
sudofile=/tmp/lfs_88610.sh sudofile=/tmp/lfsdev_88610.sh
cat > ${sudofile} << "EOSF" cat > ${sudofile} << "EOSF"
#rm -rf /tmp/{*,.*} #rm -rf /tmp/{*,.*}
find /usr/lib /usr/libexec -name \*.la -delete find /usr/lib /usr/libexec -name \*.la -delete
find /usr -depth -name $(uname -m)-lfs-linux-gnu\* | xargs rm -rf find /usr -depth -name $(uname -m)-lfsdev-linux-gnu\* | xargs rm -rf
userdel -r tester userdel -r tester
EOSF EOSF
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "88610" > "${SLFSB}" echo "88610" > "${SLFSB}"
fi fi
@ -1784,7 +1781,7 @@ EOSF
echo "90210" > "${SLFSB}" echo "90210" > "${SLFSB}"
elif ${LFS_NETWORK} elif ${LFS_NETWORK}
then then
sudofile=/tmp/lfs_90210.sh sudofile=/tmp/lfsdev_90210.sh
INTERFACE=$(ip route |grep default |cut --delimiter=' ' --fields=5) INTERFACE=$(ip route |grep default |cut --delimiter=' ' --fields=5)
GATEWAY=$(ip route |grep default |cut --delimiter=' ' --fields=3) GATEWAY=$(ip route |grep default |cut --delimiter=' ' --fields=3)
IPADDRESS=$(ip address show dev "${INTERFACE}" |grep "${INTERFACE}$" |cut --delimiter=' ' --fields=6) IPADDRESS=$(ip address show dev "${INTERFACE}" |grep "${INTERFACE}$" |cut --delimiter=' ' --fields=6)
@ -1836,7 +1833,7 @@ EOSF
;; ;;
esac esac
echo "Configure network (same as host)" echo "Configure network (same as host)"
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "90210" > "${SLFSB}" echo "90210" > "${SLFSB}"
else else
@ -1855,7 +1852,7 @@ EOSF
echo "9.6. Configuring the Linux Console" echo "9.6. Configuring the Linux Console"
if [[ $(cat "${SLFSB}") -lt 90610 ]] if [[ $(cat "${SLFSB}") -lt 90610 ]]
then then
VCONSOLE=/mnt/lfs/tmp/vconsole.conf VCONSOLE=/mnt/lfsdev/tmp/vconsole.conf
cat > ${VCONSOLE} << EOSF cat > ${VCONSOLE} << EOSF
KEYMAP=XX KEYMAP=XX
FONT=XX FONT=XX
@ -1931,11 +1928,11 @@ EOSF
sed "/FONT/s/FONT=XX/FONT=Lat2-Terminus16/" --in-place ${VCONSOLE} sed "/FONT/s/FONT=XX/FONT=Lat2-Terminus16/" --in-place ${VCONSOLE}
sed "/XKBLAYOUT/s/XKBLAYOUT=XX/XKBLAYOUT=fr/" --in-place ${VCONSOLE} sed "/XKBLAYOUT/s/XKBLAYOUT=XX/XKBLAYOUT=fr/" --in-place ${VCONSOLE}
# building chroot # building chroot
sudofile=/tmp/lfs_90610.sh sudofile=/tmp/lfsdev_90610.sh
cat > ${sudofile} << "EOSF" cat > ${sudofile} << "EOSF"
cp -v /tmp/vconsole.conf /etc/vconsole.conf cp -v /tmp/vconsole.conf /etc/vconsole.conf
EOSF EOSF
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "90610" > "${SLFSB}" echo "90610" > "${SLFSB}"
else else
@ -1949,7 +1946,7 @@ EOSF
echo "9.7. Configuring the System Locale" echo "9.7. Configuring the System Locale"
if [[ $(cat "${SLFSB}") -lt 90710 ]] if [[ $(cat "${SLFSB}") -lt 90710 ]]
then then
LOCALECONF=/mnt/lfs/tmp/locale.conf LOCALECONF=/mnt/lfsdev/tmp/locale.conf
cat > ${LOCALECONF} << EOSF cat > ${LOCALECONF} << EOSF
LANG=XX LANG=XX
EOSF EOSF
@ -1964,7 +1961,7 @@ EOSF
fi fi
# default if nothing is set (if LANG=XX) # default if nothing is set (if LANG=XX)
sed /LANG/s/LANG=XX/LANG="fr_FR.UTF-8"/ --in-place "${LOCALECONF}" sed /LANG/s/LANG=XX/LANG="fr_FR.UTF-8"/ --in-place "${LOCALECONF}"
sudofile=/tmp/lfs_90710.sh sudofile=/tmp/lfsdev_90710.sh
cat > ${sudofile} << "EOSF" cat > ${sudofile} << "EOSF"
cp -v /tmp/locale.conf /etc/locale.conf cp -v /tmp/locale.conf /etc/locale.conf
cat > /etc/profile << "EOF" cat > /etc/profile << "EOF"
@ -1986,7 +1983,7 @@ fi
# End /etc/profile # End /etc/profile
EOF EOF
EOSF EOSF
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "90710" > "${SLFSB}" echo "90710" > "${SLFSB}"
else else
@ -2000,7 +1997,7 @@ EOSF
echo "9.8. Creating the /etc/inputrc File " echo "9.8. Creating the /etc/inputrc File "
if [[ $(cat "${SLFSB}") -lt 90810 ]] if [[ $(cat "${SLFSB}") -lt 90810 ]]
then then
sudofile=/tmp/lfs_90810.sh sudofile=/tmp/lfsdev_90810.sh
cat > ${sudofile} << "EOSF" cat > ${sudofile} << "EOSF"
cat > /etc/inputrc << "EOF" cat > /etc/inputrc << "EOF"
# Begin /etc/inputrc # Begin /etc/inputrc
@ -2036,7 +2033,7 @@ set bell-style none
# End /etc/inputrc # End /etc/inputrc
EOF EOF
EOSF EOSF
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "90810" > "${SLFSB}" echo "90810" > "${SLFSB}"
else else
@ -2050,7 +2047,7 @@ EOSF
echo "9.9. Creating the /etc/shells File" echo "9.9. Creating the /etc/shells File"
if [[ $(cat "${SLFSB}") -lt 90910 ]] if [[ $(cat "${SLFSB}") -lt 90910 ]]
then then
sudofile=/tmp/lfs_90910.sh sudofile=/tmp/lfsdev_90910.sh
cat > ${sudofile} << "EOSF" cat > ${sudofile} << "EOSF"
cat > /etc/shells << "EOF" cat > /etc/shells << "EOF"
# Begin /etc/shells # Begin /etc/shells
@ -2059,7 +2056,7 @@ cat > /etc/shells << "EOF"
# End /etc/shells # End /etc/shells
EOF EOF
EOSF EOSF
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "90910" > "${SLFSB}" echo "90910" > "${SLFSB}"
else else
@ -2073,7 +2070,7 @@ EOSF
echo "9.10. Systemd Usage and Configuration" echo "9.10. Systemd Usage and Configuration"
if [[ $(cat "${SLFSB}") -lt 91010 ]] if [[ $(cat "${SLFSB}") -lt 91010 ]]
then then
sudofile=/tmp/lfs_91010.sh sudofile=/tmp/lfsdev_91010.sh
cat > ${sudofile} << "EOSF" cat > ${sudofile} << "EOSF"
mkdir -pv /etc/systemd/system/getty@tty1.service.d mkdir -pv /etc/systemd/system/getty@tty1.service.d
cat > /etc/systemd/system/getty@tty1.service.d/noclear.conf << EOF cat > /etc/systemd/system/getty@tty1.service.d/noclear.conf << EOF
@ -2082,7 +2079,7 @@ TTYVTDisallocate=no
# ln -sfv /dev/null /etc/systemd/system/tmp.mount # ln -sfv /dev/null /etc/systemd/system/tmp.mount
EOF EOF
EOSF EOSF
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "91010" > "${SLFSB}" echo "91010" > "${SLFSB}"
cat <<EOF cat <<EOF
@ -2110,7 +2107,7 @@ EOF
then then
rm ${FSTAB} rm ${FSTAB}
fi fi
blockdevice="$(mount |grep '/mnt/lfs type ext4' |cut --delimiter=' ' --fields=1 |cut --delimiter='/' --fields=3)" blockdevice="$(mount |grep '/mnt/lfsdev type ext4' |cut --delimiter=' ' --fields=1 |cut --delimiter='/' --fields=3)"
for link in /dev/disk/by-uuid/* for link in /dev/disk/by-uuid/*
do do
# readlink "${link}" # readlink "${link}"
@ -2153,14 +2150,14 @@ EOSF
echo "Can't init swap /etc/fstab" echo "Can't init swap /etc/fstab"
echo "Fix it by ourself" echo "Fix it by ourself"
fi fi
sudofile=/tmp/lfs_100200.sh sudofile=/tmp/lfsdev_100200.sh
cat > ${sudofile} << "EOSF" cat > ${sudofile} << "EOSF"
cp -v /tmp/fstab /etc/fstab cp -v /tmp/fstab /etc/fstab
EOSF EOSF
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "100200" > "${SLFSB}" echo "100200" > "${SLFSB}"
echo "Please check /etc/fstab in /mnt/lfs" echo "Please check /etc/fstab in /mnt/lfsdev"
echo "Check root and swap" echo "Check root and swap"
echo "Add /boot and other mount point if necessary" echo "Add /boot and other mount point if necessary"
else else
@ -2180,12 +2177,12 @@ EOSF
unnumbered=${scriptname##*_} unnumbered=${scriptname##*_}
packagename=${unnumbered%.*} packagename=${unnumbered%.*}
archivepath=$(find "${SOURCES}" -name "${packagename}*.tar.*" -print) archivepath=$(find "${SOURCES}" -name "${packagename}*.tar.*" -print)
archivesubpath=${archivepath##/mnt/lfs} archivesubpath=${archivepath##/mnt/lfsdev}
archivename=$(basename "${archivepath}") archivename=$(basename "${archivepath}")
package=${archivename%%.tar.xz} package=${archivename%%.tar.xz}
buildpath=/sources/"${package}" buildpath=/sources/"${package}"
linuxversion=${package##*-} linuxversion=${package##*-}
sudofile=/tmp/lfs_103100.sh sudofile=/tmp/lfsdev_103100.sh
cat > "${sudofile}" << EOSF cat > "${sudofile}" << EOSF
if [ ! -d "${buildpath}" ] if [ ! -d "${buildpath}" ]
then then
@ -2201,17 +2198,17 @@ then
fi fi
pushd "${buildpath}" pushd "${buildpath}"
set -ueExo pipefail set -ueExo pipefail
eval "\$(cat ../"${scriptname}")" | tee "/tmp/lfs_103100.log" eval "\$(cat ../"${scriptname}")" | tee "/tmp/lfsdev_103100.log"
popd popd
EOSF EOSF
if ! lfs_chroot "${sudofile}" if ! lfsdev_chroot "${sudofile}"
then then
echo "compilation error" echo "compilation error"
exit 1 exit 1
else else
echo "compilation ok" echo "compilation ok"
fi fi
check_errors "${STEMP}/lfs_103100.log" check_errors "${STEMP}/lfsdev_103100.log"
echo 103100 > "${SLFSB}" echo 103100 > "${SLFSB}"
fi fi
@ -2231,13 +2228,13 @@ EOSF
linuxversion=${package##*-} linuxversion=${package##*-}
if ${LFS_LINUXCONFIG} if ${LFS_LINUXCONFIG}
then then
if cp --verbose "${SCRIPT_DIR}/linux-config-${ARCH}.txt" /mnt/lfs/tmp/linux-config-host if cp --verbose "${SCRIPT_DIR}/linux-config-${ARCH}.txt" /mnt/lfsdev/tmp/linux-config-host
then then
sudofile=/tmp/lfs_103110.sh sudofile=/tmp/lfsdev_103110.sh
cat > ${sudofile} << EOSF cat > ${sudofile} << EOSF
cp --verbose /tmp/linux-config-host ${buildpath}/.config cp --verbose /tmp/linux-config-host ${buildpath}/.config
EOSF EOSF
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "copy ok" echo "copy ok"
echo "103110" > "${SLFSB}" echo "103110" > "${SLFSB}"
@ -2251,7 +2248,7 @@ EOSF
exit 1 exit 1
fi fi
fi fi
if [ -e /mnt/lfs/sources/"${package}"/.config ] if [ -e /mnt/lfsdev/sources/"${package}"/.config ]
then then
echo "103110" > "${SLFSB}" echo "103110" > "${SLFSB}"
echo "A config file for kernel compilation exist" echo "A config file for kernel compilation exist"
@ -2260,12 +2257,12 @@ EOSF
echo "Script is stopped for linux configuration" echo "Script is stopped for linux configuration"
echo "It's time to configure kernel compilation" echo "It's time to configure kernel compilation"
echo "LFS recommand to compile the kernel by youself" echo "LFS recommand to compile the kernel by youself"
echo "Please execute as lfs :" echo "Please execute as lfsdev :"
echo "$ bash $HOME/lfs_chroot.sh" echo "$ bash $HOME/lfsdev_chroot.sh"
echo "(lfs chroot) root:/$ cd /sources/linux-6.8.10" echo "(lfsdev chroot) root:/$ cd /sources/linux-6.8.10"
echo "(lfs chroot) root:/$ make menuconfig" echo "(lfsdev chroot) root:/$ make menuconfig"
echo "you can try this at minimal :" echo "you can try this at minimal :"
echo "(lfs chroot) root:/$ make defconfig" echo "(lfsdev chroot) root:/$ make defconfig"
exit 0 exit 0
fi fi
fi fi
@ -2287,15 +2284,15 @@ EOSF
if [ ! -e "${LFS}"/"${buildpath}"/.config ] if [ ! -e "${LFS}"/"${buildpath}"/.config ]
then then
echo "Seems kernel was not configured" echo "Seems kernel was not configured"
echo "Please execute as lfs :" echo "Please execute as lfsdev :"
echo "$ bash /tmp/lfs_chroot.sh" echo "$ bash /tmp/lfsdev_chroot.sh"
echo "(lfs chroot) root:/$ cd ${buildpath}" echo "(lfsdev chroot) root:/$ cd ${buildpath}"
echo "(lfs chroot) root:/$ make menuconfig" echo "(lfsdev chroot) root:/$ make menuconfig"
echo "you can try too :" echo "you can try too :"
echo "(lfs chroot) root:/$ make defconfig" echo "(lfsdev chroot) root:/$ make defconfig"
exit 1 exit 1
fi fi
sudofile=/tmp/lfs_103120.sh sudofile=/tmp/lfsdev_103120.sh
cat > ${sudofile} << EOSF cat > ${sudofile} << EOSF
cd "${buildpath}" cd "${buildpath}"
make make
@ -2303,7 +2300,7 @@ if grep "CONFIG_MODULES=y" "${buildpath}"/.config
then then
make modules make modules
fi fi
cp -v arch/x86/boot/bzImage /boot/vmlinuz-${linuxversion}-lfs-13.0-systemd cp -v arch/x86/boot/bzImage /boot/vmlinuz-${linuxversion}-lfsdev-13.0-systemd
cp -v System.map /boot/System.map-${linuxversion} cp -v System.map /boot/System.map-${linuxversion}
cp -v .config /boot/config-${linuxversion} cp -v .config /boot/config-${linuxversion}
cp -r Documentation -T /usr/share/doc/${package} cp -r Documentation -T /usr/share/doc/${package}
@ -2315,7 +2312,7 @@ install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true
# End /etc/modprobe.d/usb.conf # End /etc/modprobe.d/usb.conf
EOF EOF
EOSF EOSF
if ! lfs_chroot "${sudofile}" if ! lfsdev_chroot "${sudofile}"
then then
echo "compilation error" echo "compilation error"
exit 1 exit 1
@ -2337,7 +2334,7 @@ EOSF
buildpath=/sources/"${package}" buildpath=/sources/"${package}"
linuxversion=${package##*-} linuxversion=${package##*-}
# get root device uuid # get root device uuid
blockdevice=$(mount |grep '/mnt/lfs type ext4' | cut --delimiter=' ' --fields=1) blockdevice=$(mount |grep '/mnt/lfsdev type ext4' | cut --delimiter=' ' --fields=1)
#for link in /dev/disk/by-uuid/* #for link in /dev/disk/by-uuid/*
#do #do
# case $(readlink "${link}") in # case $(readlink "${link}") in
@ -2357,24 +2354,24 @@ EOSF
# esac # esac
#done #done
# #
if [ ! -e "$LFS/boot/vmlinuz-${linuxversion}-lfs-13.0-systemd" ] if [ ! -e "$LFS/boot/vmlinuz-${linuxversion}-lfsdev-13.0-systemd" ]
then then
echo "Kernel file absent from /boot" echo "Kernel file absent from /boot"
exit 1 exit 1
fi fi
uuidfilesystem=$(lsblk -o UUID,PARTUUID,PATH,MOUNTPOINT |grep /mnt/lfs$ |cut --delimiter=' ' --fields=1) uuidfilesystem=$(lsblk -o UUID,PARTUUID,PATH,MOUNTPOINT |grep /mnt/lfsdev$ |cut --delimiter=' ' --fields=1)
if [[ ! "${uuidfilesystem}" =~ ^[a-z0-9-]+$ ]] if [[ ! "${uuidfilesystem}" =~ ^[a-z0-9-]+$ ]]
then then
echo "UUID seems bad" echo "UUID seems bad"
exit 1 exit 1
fi fi
uuidpartition=$(lsblk -o UUID,PARTUUID,PATH,MOUNTPOINT |grep /mnt/lfs$ |sed -e "s/ */ /g" |cut --delimiter=' ' --fields=2) uuidpartition=$(lsblk -o UUID,PARTUUID,PATH,MOUNTPOINT |grep /mnt/lfsdev$ |sed -e "s/ */ /g" |cut --delimiter=' ' --fields=2)
if [[ ! "${uuidpartition}" =~ ^[a-z0-9-]+$ ]] if [[ ! "${uuidpartition}" =~ ^[a-z0-9-]+$ ]]
then then
echo "PARTUUID seems bad" echo "PARTUUID seems bad"
exit 1 exit 1
fi fi
sudofile=/tmp/lfs_104000.sh sudofile=/tmp/lfsdev_104000.sh
cat > ${sudofile} << EOSF cat > ${sudofile} << EOSF
mkdir --verbose /boot/grub mkdir --verbose /boot/grub
cat > /boot/grub/grub.cfg << "EOF" cat > /boot/grub/grub.cfg << "EOF"
@ -2385,15 +2382,15 @@ insmod part_gpt
insmod ext2 insmod ext2
search --set=root --fs-uuid=${uuidfilesystem} search --set=root --fs-uuid=${uuidfilesystem}
set gfxpayload=1024x768x32 set gfxpayload=1024x768x32
menuentry "GNU/Linux, Linux ${linuxversion}-lfs-13.0-systemd with blockdevice" { menuentry "GNU/Linux, Linux ${linuxversion}-lfsdev-13.0-systemd with blockdevice" {
linux /boot/vmlinuz-${linuxversion}-lfs-13.0-systemd root=${blockdevice} ro linux /boot/vmlinuz-${linuxversion}-lfsdev-13.0-systemd root=${blockdevice} ro
} }
menuentry "GNU/Linux, Linux ${linuxversion}-lfs-13.0-systemd with partuuid" { menuentry "GNU/Linux, Linux ${linuxversion}-lfsdev-13.0-systemd with partuuid" {
linux /boot/vmlinuz-${linuxversion}-lfs-13.0-systemd root=PARTUUID=${uuidpartition} ro linux /boot/vmlinuz-${linuxversion}-lfsdev-13.0-systemd root=PARTUUID=${uuidpartition} ro
} }
EOF EOF
EOSF EOSF
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "104000" > "${SLFSB}" echo "104000" > "${SLFSB}"
else else
@ -2407,9 +2404,9 @@ EOSF
echo "11.1. The End" echo "11.1. The End"
if [[ $(cat "${SLFSB}") -lt 110100 ]] if [[ $(cat "${SLFSB}") -lt 110100 ]]
then then
sudofile=/tmp/lfs_110100.sh sudofile=/tmp/lfsdev_110100.sh
cat > ${sudofile} << EOSF cat > ${sudofile} << EOSF
echo 13.0-systemd > /etc/lfs-release echo 13.0-systemd > /etc/lfsdev-release
cat > /etc/lsb-release << "EOF" cat > /etc/lsb-release << "EOF"
DISTRIB_ID="Linux From Scratch" DISTRIB_ID="Linux From Scratch"
DISTRIB_RELEASE="13.0-systemd" DISTRIB_RELEASE="13.0-systemd"
@ -2419,12 +2416,12 @@ EOF
cat > /etc/os-release << "EOF" cat > /etc/os-release << "EOF"
NAME="Linux From Scratch" NAME="Linux From Scratch"
VERSION="13.0-systemd" VERSION="13.0-systemd"
ID=lfs ID=lfsdev
PRETTY_NAME="Linux From Scratch 13.0-systemd" PRETTY_NAME="Linux From Scratch 13.0-systemd"
VERSION_CODENAME="<your name here>" VERSION_CODENAME="<your name here>"
EOF EOF
EOSF EOSF
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "104000" > "${SLFSB}" echo "104000" > "${SLFSB}"
else else
@ -2438,9 +2435,9 @@ EOSF
echo "11.1. The End" echo "11.1. The End"
if [[ $(cat "${SLFSB}") -lt 110100 ]] if [[ $(cat "${SLFSB}") -lt 110100 ]]
then then
sudofile=/tmp/lfs_110100.sh sudofile=/tmp/lfsdev_110100.sh
cat > ${sudofile} << EOSF cat > ${sudofile} << EOSF
echo 13.0-systemd > /etc/lfs-release echo 13.0-systemd > /etc/lfsdev-release
cat > /etc/lsb-release << "EOF" cat > /etc/lsb-release << "EOF"
DISTRIB_ID="Linux From Scratch" DISTRIB_ID="Linux From Scratch"
DISTRIB_RELEASE="13.0-systemd" DISTRIB_RELEASE="13.0-systemd"
@ -2450,14 +2447,14 @@ EOF
cat > /etc/os-release << "EOF" cat > /etc/os-release << "EOF"
NAME="Linux From Scratch" NAME="Linux From Scratch"
VERSION="13.0-systemd" VERSION="13.0-systemd"
ID=lfs ID=lfsdev
PRETTY_NAME="Linux From Scratch 13.0-systemd" PRETTY_NAME="Linux From Scratch 13.0-systemd"
VERSION_CODENAME="<your name here>" VERSION_CODENAME="<your name here>"
HOME_URL="https://www.linuxfromscratch.org/lfs/" HOME_URL="https://www.linuxfromscratch.org/lfs/"
RELEASE_TYPE="stable" RELEASE_TYPE="stable"
EOF EOF
EOSF EOSF
if lfs_chroot "${sudofile}" if lfsdev_chroot "${sudofile}"
then then
echo "You can edit /etc/lsb-release and /etc/os-release and edit your name" echo "You can edit /etc/lsb-release and /etc/os-release and edit your name"
echo "110100" > "${SLFSB}" echo "110100" > "${SLFSB}"
@ -2470,7 +2467,7 @@ EOSF
echo "Finish successfully" echo "Finish successfully"
echo "Adapt /boot/grub/grub.cfg to your configuration" echo "Adapt /boot/grub/grub.cfg to your configuration"
echo "And install the bootloader if needed with the appropriate boot device" echo "And install the bootloader if needed with the appropriate boot device"
echo "(lfs chroot) root:/$ grub-install /dev/xda" echo "(lfsdev chroot) root:/$ grub-install /dev/xda"
} }

Loading…
Cancel
Save