From 98cccfb234867335252ab07bd8ffa366852f2c7b Mon Sep 17 00:00:00 2001 From: tux Date: Sun, 7 May 2023 14:47:59 +0200 Subject: [PATCH] first steps --- README.md | 51 +++ chap5-6.sh | 417 ++++++++++++++++++++++ chap7p1.sh | 28 ++ chap7p2.sh | 178 ++++++++++ chap8p1.sh | 668 ++++++++++++++++++++++++++++++++++ chap8p2.sh | 904 +++++++++++++++++++++++++++++++++++++++++++++++ vars.sh | 90 +++++ version-check.sh | 53 +++ 8 files changed, 2389 insertions(+) create mode 100644 chap5-6.sh create mode 100644 chap7p1.sh create mode 100644 chap7p2.sh create mode 100644 chap8p1.sh create mode 100644 chap8p2.sh create mode 100644 vars.sh create mode 100644 version-check.sh diff --git a/README.md b/README.md index e69de29..2ce72b3 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,51 @@ +# Instructions and scripts to automate the process of building a LFS system # + +- install host requirements + +on debian based systems: + +```Console +sudo apt -y install m4 bison texinfo build-essential && +sudo dpkg-reconfigure dash +``` + +on rhel based systems: + +```Console +sudo dnf -y install gcc g++ make m4 bison byacc patch texinfo +``` + +- check host requirements + +```Console +bash version-check.sh +``` + +- edit vars.sh to set the desired parallel JOBS for compiling + +- proceed with the LFS chapters: +- 2.5. Creating a File System on the Partition +- 2.6. Setting The $LFS Variable +- 2.7. Mounting the New Partition +- 3.1. Introduction +- 4.2. Creating a Limited Directory Layout in the LFS Filesystem +- 4.3. Adding the LFS User +- 4.4. Setting Up the Environment + +- copy the scripts into /mnt/lfs/sources + +- as the lfs user from within the sources directory run chap5-6.sh + +- when prompted logout the lfs user and as the root user from within the sources +directory run chap7p1.sh + +- when prompted from within the sources directory from within the chroot +environment run chap7p2.sh + +- when prompted run chap8p1.sh and chap8p2.sh + +- when prompted continue with the LFS chapters: +- 10.2. Creating the /etc/fstab File +- 10.3. Linux-6.1.11 +- 10.4. Using GRUB to Set Up the Boot Process +- 11.1. The End diff --git a/chap5-6.sh b/chap5-6.sh new file mode 100644 index 0000000..602d021 --- /dev/null +++ b/chap5-6.sh @@ -0,0 +1,417 @@ +#!/bin/bash + +source vars.sh + +echo "5.2. ""$BINUTILS"" - Pass 1" +tar xf "$BINUTILS".tar.xz && +cd "$BINUTILS" && +mkdir -v build && +cd build && +../configure --prefix=$LFS/tools \ + --with-sysroot=$LFS \ + --target=$LFS_TGT \ + --disable-nls \ + --enable-gprofng=no \ + --disable-werror && +make && +make install && +cd ../.. && +rm -rf "$BINUTILS" && +echo "Finished 5.2. ""$BINUTILS"" - Pass 1" >> build.log + +echo "5.3. ""$GCC"" - Pass 1" +tar xf "$GCC".tar.xz && +cd "$GCC" && +tar -xf ../"$MPFR".tar.xz && +mv -v "$MPFR" mpfr && +tar -xf ../"$GMP".tar.xz && +mv -v "$GMP" gmp && +tar -xf ../"$MPC".tar.gz && +mv -v "$MPC" mpc && +case $(uname -m) in + x86_64) + sed -e '/m64=/s/lib64/lib/' \ + -i.orig gcc/config/i386/t-linux64 + ;; +esac && +mkdir -v build && +cd build && +../configure \ + --target=$LFS_TGT \ + --prefix=$LFS/tools \ + --with-glibc-version=2.37 \ + --with-sysroot=$LFS \ + --with-newlib \ + --without-headers \ + --enable-default-pie \ + --enable-default-ssp \ + --disable-nls \ + --disable-shared \ + --disable-multilib \ + --disable-threads \ + --disable-libatomic \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libssp \ + --disable-libvtv \ + --disable-libstdcxx \ + --enable-languages=c,c++ && +make && +make install && +cd .. && +cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \ + `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h && +cd ../.. && +rm -rf "$GCC" && +echo "Finished 5.3. ""$GCC"" - Pass 1" >> build.log + +echo "5.4. ""$LINUX"" API Headers" +tar xf "$LINUX".tar.xz && +cd "$LINUX" && +make mrproper && +make headers && +find usr/include -type f ! -name '*.h' -delete && +cp -rv usr/include $LFS/usr && +cd .. && +rm -rf "$LINUX" + +echo "5.5. ""$GLIBC""" +tar xf "$GLIBC".tar.xz && +cd "$GLIBC" && +case $(uname -m) in + i?86) ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3 + ;; + x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64 + ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3 + ;; +esac && +patch -Np1 -i ../"$GLIBC"-fhs-1.patch && +mkdir -v build && +cd build && +echo "rootsbindir=/usr/sbin" > configparms && +../configure \ + --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(../scripts/config.guess) \ + --enable-kernel=3.2 \ + --with-headers=$LFS/usr/include \ + libc_cv_slibdir=/usr/lib && +make && +make DESTDIR=$LFS install && +sed '/RTLDLIST=/s@/usr@@g' -i $LFS/usr/bin/ldd && +echo 'At this point, it is imperative to stop and ensure that the basic functions (compiling and linking) of the new toolchain are working as expected.' +echo 'int main(){}' | $LFS_TGT-gcc -xc - +readelf -l a.out | grep ld-linux +echo 'If everything is working correctly, there should be no errors, and the output of the last command will be of the form: [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]' +sleep 10 +rm -v a.out && +$LFS/tools/libexec/gcc/$LFS_TGT/12.2.0/install-tools/mkheaders && +cd ../.. && +rm -rf "$GLIBC" && +echo "Finished 5.5. ""$GLIBC""" >> build.log + +echo "5.6. Libstdc++ from ""$GCC""" +tar xf "$GCC".tar.xz && +cd "$GCC" && +mkdir -v build && +cd build && +../libstdc++-v3/configure \ + --host=$LFS_TGT \ + --build=$(../config.guess) \ + --prefix=/usr \ + --disable-multilib \ + --disable-nls \ + --disable-libstdcxx-pch \ + --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/12.2.0 && +make && +make DESTDIR=$LFS install && +rm -v $LFS/usr/lib/lib{stdc++,stdc++fs,supc++}.la && +cd ../.. && +rm -rf "$GCC" && +echo "Finished 5.6. Libstdc++ from ""$GCC""" >> build.log + +echo "6.2. ""$M4""" +tar xf "$M4".tar.xz && +cd "$M4" && +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) && +make && +make DESTDIR=$LFS install && +cd .. && +rm -rf "$M4" && +echo "Finished 6.2. ""$M4""" >> build.log + +echo '6.3. Ncurses-6.4' +tar xf ncurses-6.4.tar.gz && +cd ncurses-6.4 && +sed -i s/mawk// configure && +mkdir build && +pushd build + ../configure + make -C include + make -C progs tic +popd +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(./config.guess) \ + --mandir=/usr/share/man \ + --with-manpage-format=normal \ + --with-shared \ + --without-normal \ + --with-cxx-shared \ + --without-debug \ + --without-ada \ + --disable-stripping \ + --enable-widec && + +make && +make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install && +echo "INPUT(-lncursesw)" > $LFS/usr/lib/libncurses.so && +cd .. && +rm -rf ncurses-6.4 && +echo 'Finished 6.3. Ncurses-6.4' >> build.log + +echo "6.4. ""$BASH""" +tar xf "$BASH".tar.gz && +cd "$BASH" && +./configure --prefix=/usr \ + --build=$(sh support/config.guess) \ + --host=$LFS_TGT \ + --without-bash-malloc && +make && +make DESTDIR=$LFS install && +ln -sv bash $LFS/bin/sh && +cd .. && +rm -rf "$BASH" && +echo "Finished 6.4. ""$BASH""" >> build.log + +echo "6.5. ""$COREUTILS""" +tar xf "$COREUTILS".tar.xz && +cd "$COREUTILS" && +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) \ + --enable-install-program=hostname \ + --enable-no-install-program=kill,uptime && +make && +make DESTDIR=$LFS install && +mv -v $LFS/usr/bin/chroot $LFS/usr/sbin && +mkdir -pv $LFS/usr/share/man/man8 && +mv -v $LFS/usr/share/man/man1/chroot.1 $LFS/usr/share/man/man8/chroot.8 && +sed -i 's/"1"/"8"/' $LFS/usr/share/man/man8/chroot.8 && +cd .. && +rm -rf "$COREUTILS" && +echo "Finished 6.5. ""$COREUTILS""" >> build.log + +echo "6.6. "$DIFFUTILS"" +tar xf "$DIFFUTILS".tar.xz && +cd "$DIFFUTILS" && +./configure --prefix=/usr --host=$LFS_TGT && +make && +make DESTDIR=$LFS install && +cd .. && +rm -rf "$DIFFUTILS" && +echo "Finished 6.6. ""$DIFFUTILS""" >> build.log + +echo "6.7. ""$FILE""" +tar xf "$FILE".tar.gz && +cd "$FILE" && +mkdir build && +pushd build + ../configure --disable-bzlib \ + --disable-libseccomp \ + --disable-xzlib \ + --disable-zlib + make +popd +./configure --prefix=/usr --host=$LFS_TGT --build=$(./config.guess) && +make FILE_COMPILE=$(pwd)/build/src/file && +make DESTDIR=$LFS install && +rm -v $LFS/usr/lib/libmagic.la && +cd .. && +rm -rf "$FILE" && +echo "Finished 6.7. ""$FILE""" >> build.log + +echo "6.8. ""$FINDUTILS""" +tar xf "$FINDUTILS".tar.xz && +cd "$FINDUTILS" && +./configure --prefix=/usr \ + --localstatedir=/var/lib/locate \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) && + +make && +make DESTDIR=$LFS install && +cd .. && +rm -rf "$FINDUTILS" && +echo "Finished 6.8. ""$FINDUTILS""" >> build.log + +echo "6.9. ""$GAWK""" +tar xf "$GAWK".tar.xz && +cd "$GAWK" && +sed -i 's/extras//' Makefile.in && +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) && + +make && +make DESTDIR=$LFS install && +cd .. && +rm -rf "$GAWK" && +echo "Finished 6.9. ""$GAWK""" >> build.log + +echo "6.10. ""$GREP""" +tar xf "$GREP".tar.xz && +cd "$GREP" && +./configure --prefix=/usr \ + --host=$LFS_TGT && +make && +make DESTDIR=$LFS install && +cd .. && +rm -rf "$GREP" && +echo "Finished 6.10. ""$GREP""" >> build.log + +echo "6.11. ""$GZIP""" +tar xf "$GZIP".tar.xz && +cd "$GZIP" && +./configure --prefix=/usr --host=$LFS_TGT && +make && +make DESTDIR=$LFS install && +cd .. && +rm -rf "$GZIP" && +echo "Finished 6.11. ""$GZIP""" >> build.log + +echo "6.12. ""$MAKE""" +tar xf "$MAKE".tar.gz && +cd "$MAKE" && +sed -e '/ifdef SIGPIPE/,+2 d' \ + -e '/undef FATAL_SIG/i FATAL_SIG (SIGPIPE);' \ + -i src/main.c && +./configure --prefix=/usr \ + --without-guile \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) && +make && +make DESTDIR=$LFS install && +cd .. && +rm -rf "$MAKE" && +echo "Finished 6.12. ""$MAKE""" >> build.log + +echo "6.13. ""$PATCH""" +tar xf "$PATCH".tar.xz && +cd "$PATCH" && +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) && +make && +make DESTDIR=$LFS install && +cd .. && +rm -rf "$PATCH" && +echo "Finished 6.13. ""$PATCH""" >> build.log + +echo "6.14. ""$SED""" +tar xf "$SED".tar.xz && +cd "$SED" && +./configure --prefix=/usr \ + --host=$LFS_TGT && +make && +make DESTDIR=$LFS install && +cd .. && +rm -rf "$SED" && +echo "Finished 6.14. ""$SED""" >> build.log + +echo "6.15. ""$TAR""" +tar xf "$TAR".tar.xz && +cd "$TAR" && +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) && + +make && +make DESTDIR=$LFS install && +cd .. && +rm -rf "$TAR" && +echo "Finished 6.15. ""$TAR""" >> build.log + +echo "6.16. ""$XZ""" +tar xf "$XZ".tar.xz && +cd "$XZ" && +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) \ + --disable-static \ + --docdir=/usr/share/doc/"$XZ" && + +make && +make DESTDIR=$LFS install && +rm -v $LFS/usr/lib/liblzma.la && +cd .. && +rm -rf "$XZ" && +echo "Finished 6.16. ""$XZ""" >> build.log + +echo "6.17. ""$BINUTILS"" - Pass 2" +tar xf "$BINUTILS" && +cd "$BINUTILS" && +sed '6009s/$add_dir//' -i ltmain.sh && +mkdir -v build && +cd build && +../configure \ + --prefix=/usr \ + --build=$(../config.guess) \ + --host=$LFS_TGT \ + --disable-nls \ + --enable-shared \ + --enable-gprofng=no \ + --disable-werror \ + --enable-64-bit-bfd && +make && +make DESTDIR=$LFS install && +rm -v $LFS/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes}.{a,la} && +cd .. && +rm -rf "$BINUTILS" && +echo "Finished 6.17. ""$BINUTILS"" - Pass 2" >> build.log + +echo "6.18. ""$GCC"" - Pass 2" +tar xf "$GCC" && +cd "$GCC" && +tar -xf ../"$MPFR".tar.xz && +mv -v "$MPFR" mpfr && +tar -xf ../"$GMP".tar.xz && +mv -v "$GMP" gmp && +tar -xf ../"$MPC".tar.gz && +mv -v "$MPC" mpc && +case $(uname -m) in + x86_64) + sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64 + ;; +esac && +sed '/thread_header =/s/@.*@/gthr-posix.h/' \ + -i libgcc/Makefile.in libstdc++-v3/include/Makefile.in && +mkdir -v build && +cd build && +../configure \ + --build=$(../config.guess) \ + --host=$LFS_TGT \ + --target=$LFS_TGT \ + LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc \ + --prefix=/usr \ + --with-build-sysroot=$LFS \ + --enable-default-pie \ + --enable-default-ssp \ + --disable-nls \ + --disable-multilib \ + --disable-libatomic \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libssp \ + --disable-libvtv \ + --enable-languages=c,c++ && +make && +make DESTDIR=$LFS install && +ln -sv gcc $LFS/usr/bin/cc && +cd ../.. && +rm -rf "$GCC" && +echo "Finished 6.18. ""$GCC"" - Pass 2" >> build.log + +echo "Continue chapter 7 p1 as the root user" diff --git a/chap7p1.sh b/chap7p1.sh new file mode 100644 index 0000000..260fa5f --- /dev/null +++ b/chap7p1.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +source vars.sh + +chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,tools} && +case $(uname -m) in + x86_64) chown -R root:root $LFS/lib64 ;; +esac && +mkdir -pv $LFS/{dev,proc,sys,run} && +mount -v --bind /dev $LFS/dev && +mount -v --bind /dev/pts $LFS/dev/pts && +mount -vt proc proc $LFS/proc && +mount -vt sysfs sysfs $LFS/sys && +mount -vt tmpfs tmpfs $LFS/run && +if [ -h $LFS/dev/shm ]; then + mkdir -pv $LFS/$(readlink $LFS/dev/shm) +else + mount -t tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm +fi + +echo "Entering now the chroot environment, continue with chapter 7 p2" + +chroot "$LFS" /usr/bin/env -i \ + HOME=/root \ + TERM="$TERM" \ + PS1='(lfs chroot) \u:\w\$ ' \ + PATH=/usr/bin:/usr/sbin \ + /bin/bash --login diff --git a/chap7p2.sh b/chap7p2.sh new file mode 100644 index 0000000..fb350e6 --- /dev/null +++ b/chap7p2.sh @@ -0,0 +1,178 @@ +#!/bin/bash + +source vars.sh + +mkdir -pv /{boot,home,mnt,opt,srv} && +mkdir -pv /etc/{opt,sysconfig} && +mkdir -pv /lib/firmware && +mkdir -pv /media/{floppy,cdrom} && +mkdir -pv /usr/{,local/}{include,src} && +mkdir -pv /usr/local/{bin,lib,sbin} && +mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man} && +mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo} && +mkdir -pv /usr/{,local/}share/man/man{1..8} && +mkdir -pv /var/{cache,local,log,mail,opt,spool} && +mkdir -pv /var/lib/{color,misc,locate} && +ln -sfv /run /var/run && +ln -sfv /run/lock /var/lock && +install -dv -m 0750 /root && +install -dv -m 1777 /tmp /var/tmp +mkdir -pv /usr/local/games && +mkdir -pv /usr/share/games && +ln -sv /proc/self/mounts /etc/mtab && +cat > /etc/hosts << EOF +127.0.0.1 localhost $(hostname) +::1 localhost +EOF +cat > /etc/passwd << "EOF" +root:x:0:0:root:/root:/bin/bash +bin:x:1:1:bin:/dev/null:/usr/bin/false +daemon:x:6:6:Daemon User:/dev/null:/usr/bin/false +messagebus:x:18:18:D-Bus Message Daemon User:/run/dbus:/usr/bin/false +systemd-journal-gateway:x:73:73:systemd Journal Gateway:/:/usr/bin/false +systemd-journal-remote:x:74:74:systemd Journal Remote:/:/usr/bin/false +systemd-journal-upload:x:75:75:systemd Journal Upload:/:/usr/bin/false +systemd-network:x:76:76:systemd Network Management:/:/usr/bin/false +systemd-resolve:x:77:77:systemd Resolver:/:/usr/bin/false +systemd-timesync:x:78:78:systemd Time Synchronization:/:/usr/bin/false +systemd-coredump:x:79:79:systemd Core Dumper:/:/usr/bin/false +uuidd:x:80:80:UUID Generation Daemon User:/dev/null:/usr/bin/false +systemd-oom:x:81:81:systemd Out Of Memory Daemon:/:/usr/bin/false +nobody:x:65534:65534:Unprivileged User:/dev/null:/usr/bin/false +EOF +cat > /etc/group << "EOF" +root:x:0: +bin:x:1:daemon +sys:x:2: +kmem:x:3: +tape:x:4: +tty:x:5: +daemon:x:6: +floppy:x:7: +disk:x:8: +lp:x:9: +dialout:x:10: +audio:x:11: +video:x:12: +utmp:x:13: +usb:x:14: +cdrom:x:15: +adm:x:16: +messagebus:x:18: +systemd-journal:x:23: +input:x:24: +mail:x:34: +kvm:x:61: +systemd-journal-gateway:x:73: +systemd-journal-remote:x:74: +systemd-journal-upload:x:75: +systemd-network:x:76: +systemd-resolve:x:77: +systemd-timesync:x:78: +systemd-coredump:x:79: +uuidd:x:80: +systemd-oom:x:81: +wheel:x:97: +users:x:999: +nogroup:x:65534: +EOF +echo "tester:x:101:101::/home/tester:/bin/bash" >> /etc/passwd && +echo "tester:x:101:" >> /etc/group && +install -o tester -d /home/tester && +exec /usr/bin/bash --login && +touch /var/log/{btmp,lastlog,faillog,wtmp} && +chgrp -v utmp /var/log/lastlog && +chmod -v 664 /var/log/lastlog && +chmod -v 600 /var/log/btmp && +cd /sources && + +echo "7.7. ""$GETTEXT""" +tar xf "$GETTEXT".tar.xz && +cd "$GETTEXT" && +./configure --disable-shared && +make && +cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /usr/bin && +cd .. && +rm -rf "$GETTEXT" && +echo "Finished 7.7. ""$GETTEXT""" >> build.log + +echo "7.8 ""$BISON""" +tar xf "$BISON".tar.xz && +cd "$BISON" && +./configure --prefix=/usr \ + --docdir=/usr/share/doc/bison-3.8.2 && +make && +make install && +cd .. && +rm -rf "$BISON" && +echo "Finished 7.8 ""$BISON""" >> build.log + +echo "7.9 ""$PERL""" +tar xf "$PERL".tar.xz && +cd "$PERL" && +sh Configure -des \ + -Dprefix=/usr \ + -Dvendorprefix=/usr \ + -Dprivlib=/usr/lib/perl5/5.36/core_perl \ + -Darchlib=/usr/lib/perl5/5.36/core_perl \ + -Dsitelib=/usr/lib/perl5/5.36/site_perl \ + -Dsitearch=/usr/lib/perl5/5.36/site_perl \ + -Dvendorlib=/usr/lib/perl5/5.36/vendor_perl \ + -Dvendorarch=/usr/lib/perl5/5.36/vendor_perl && +make && +make install && +cd .. && +rm -rf "$PERL" && +echo "Finished 7.9 ""$PERL""" >> build.log + +echo "7.10 ""$PYTHON""" +tar xf "$PYTHON".tar.xz && +cd "$PYTHON" && +./configure --prefix=/usr \ + --enable-shared \ + --without-ensurepip && +make && +make install && +cd .. && +rm -rf "$PYTHON" && +echo "Finished 7.10 ""$PYTHON""" >> build.log + +echo "7.11 ""$TEXINFO""" +tar xf "$TEXINFO".tar.xz && +cd "$TEXINFO" && +./configure --prefix=/usr && +make && +make install && +cd .. && +rm -rf "$TEXINFO" && +echo "Finished 7.11 ""$TEXINFO""" >> build.log + +echo "7.12 ""$UTILLINUX""" +tar xf "$UTILLINUX".tar.xz && +cd "$UTILLINUX" && +mkdir -pv /var/lib/hwclock && +./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ + --libdir=/usr/lib \ + --docdir=/usr/share/doc/util-linux-2.38.1 \ + --disable-chfn-chsh \ + --disable-login \ + --disable-nologin \ + --disable-su \ + --disable-setpriv \ + --disable-runuser \ + --disable-pylibmount \ + --disable-static \ + --without-python \ + runstatedir=/run && +make && +make install && +cd .. && +rm -rf "$UTILLINUX" && +echo "Finished 7.12 ""$UTILLINUX""" >> build.log + +rm -rf /usr/share/{info,man,doc}/* && +find /usr/{lib,libexec} -name \*.la -delete && +rm -rf /tools + +echo "If a backup is desired logout the chroot environment and run chapter 7.13.2. Backup" +echo "Continue with chapter 8 p1" diff --git a/chap8p1.sh b/chap8p1.sh new file mode 100644 index 0000000..5db7fb0 --- /dev/null +++ b/chap8p1.sh @@ -0,0 +1,668 @@ +#!/bin/bash + +source vars.sh + +echo "8.3 ""$MANPAGES""" +tar xf "$MANPAGES".tar.xz && +cd "$MANPAGES" && +make prefix=/usr install && +cd .. && +rm -rf "$MANPAGES" && +echo "Finished 8.3 ""$MANPAGES""" >> build.log && +echo "$MANPAGES" >> /installed.txt + +echo "8.4 ""$IANAETC""" +tar xz "$IANAETC".tar.gz && +cd "$IANAETC" && +cp services protocols /etc && +cd .. && +rm -rf "$IANAETC" && +echo "Finished 8.4 ""$IANAETC""" >> build.log +echo "$IANAETC" >> /installed.txt + +echo "8.5 ""$GLIBC""" +tar xf "$GLIBC".tar.xz && +cd "$GLIBC" && +patch -Np1 -i ../glibc-2.37-fhs-1.patch && +sed '/width -=/s/workend - string/number_length/' \ + -i stdio-common/vfprintf-process-arg.c && +mkdir -v build && +cd build && +echo "rootsbindir=/usr/sbin" > configparms && +../configure --prefix=/usr \ + --disable-werror \ + --enable-kernel=3.2 \ + --enable-stack-protector=strong \ + --with-headers=/usr/include \ + libc_cv_slibdir=/usr/lib && +make && +make check | tee ../../check-log_"$GLIBC".log; +touch /etc/ld.so.conf && +sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile && +make install && +sed '/RTLDLIST=/s@/usr@@g' -i /usr/bin/ldd && +cp -v ../nscd/nscd.conf /etc/nscd.conf && +mkdir -pv /var/cache/nscd && +install -v -Dm644 ../nscd/nscd.tmpfiles /usr/lib/tmpfiles.d/nscd.conf && +install -v -Dm644 ../nscd/nscd.service /usr/lib/systemd/system/nscd.service && +make localedata/install-locales +localedef -i POSIX -f UTF-8 C.UTF-8 2> /dev/null || true +localedef -i ja_JP -f SHIFT_JIS ja_JP.SJIS 2> /dev/null || true +cat > /etc/nsswitch.conf << "EOF" +# Begin /etc/nsswitch.conf + +passwd: files +group: files +shadow: files + +hosts: files dns +networks: files + +protocols: files +services: files +ethers: files +rpc: files + +# End /etc/nsswitch.conf +EOF +tar -xf ../../tzdata2022g.tar.gz && +ZONEINFO=/usr/share/zoneinfo && +mkdir -pv $ZONEINFO/{posix,right} && +for tz in etcetera southamerica northamerica europe africa antarctica \ + asia australasia backward; do + zic -L /dev/null -d $ZONEINFO ${tz} + zic -L /dev/null -d $ZONEINFO/posix ${tz} + zic -L leapseconds -d $ZONEINFO/right ${tz} +done && +cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO && +zic -d $ZONEINFO -p America/New_York && +unset ZONEINFO && + ln -sfv /usr/share/zoneinfo/UTC /etc/localtime && + cat > /etc/ld.so.conf << "EOF" +# Begin /etc/ld.so.conf +/usr/local/lib +/opt/lib + +EOF +cat >> /etc/ld.so.conf << "EOF" +# Add an include directory +include /etc/ld.so.conf.d/*.conf + +EOF +mkdir -pv /etc/ld.so.conf.d && +cd ../.. && +rm -rf "$GLIBC" && +echo "Finished 8.5 ""$GLIBC""" >> build.log && +echo "$GLIBC" >> /installed.txt + +echo "8.6 ""$ZLIB""" +tar xf "$ZLIB".tar.xz && +cd "$ZLIB" && +./configure --prefix=/usr && +make && +make check | tee ../check-log_"$ZLIB".log; +make install && +rm -fv /usr/lib/libz.a && +cd .. && +rm -rf "$ZLIB" && +echo "Finished 8.6 ""$ZLIB""" >> build.log && +echo "$ZLIB" >> /installed.txt + +echo "8.7 ""$BZIP2""" +tar xf "$BZIP2".tar.gz && +cd "$BZIP2" && +patch -Np1 -i ../bzip2-1.0.8-install_docs-1.patch && +sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile && +sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile && +make -f Makefile-libbz2_so && +make clean && +make && +make PREFIX=/usr install && +cp -av libbz2.so.* /usr/lib && +ln -sv libbz2.so.1.0.8 /usr/lib/libbz2.so && +cp -v bzip2-shared /usr/bin/bzip2 && +for i in /usr/bin/{bzcat,bunzip2}; do + ln -sfv bzip2 $i +done && +rm -fv /usr/lib/libbz2.a && +cd .. && +rm -rf "$BZIP2" && +echo " Finished 8.7 ""$BZIP2""" >> build.log && +echo "$BZIP2" >> /installed.txt + +echo "8.8 ""$XZ""" +tar xf "$XZ".tar.xz && +cd "$XZ" && +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/xz-5.4.1 && +make && +make check | tee ../check-log_"$XZ".log; +make install && +cd .. && +rm -rf "XZ" && +echo "Finished 8.8 ""$XZ""" >> build.log && +echo "$XZ" >> /installed.txt + +echo "8.9 ""$ZSTD""" +tar xf "$ZSTD".tar.gz && +cd "$ZSTD" && +make prefix=/usr && +make check | tee ../check-log_"$ZSTD".log; +make prefix=/usr install && +rm -v /usr/lib/libzstd.a && +cd .. && +rm -rf "$ZSTD" && +echo "Finished 8.9 ""$ZSTD""" >> build.log && +echo "$ZSTD" >> /installed.txt + +echo "8.10 ""$FILE""" +tar xf "$FILE".tar.gz && +cd "$FILE" && +./configure --prefix=/usr && +make && +make check | tee ../check-log_"$FILE".log; +make install && +cd .. && +rm -rf "$FILE" && +echo "Finished 8.10 ""$FILE""" >> build.log && +echo "$FILE" >> /installed.txt + +echo "8.11 ""$READLINE""" +tar xf "$READLINE".tar.gz && +cd "$READLINE" && +sed -i '/MV.*old/d' Makefile.in && +sed -i '/{OLDSUFF}/c:' support/shlib-install && +patch -Np1 -i ../readline-8.2-upstream_fix-1.patch && +./configure --prefix=/usr \ + --disable-static \ + --with-curses \ + --docdir=/usr/share/doc/readline-8.2 && +make SHLIB_LIBS="-lncursesw" && +make SHLIB_LIBS="-lncursesw" install && +install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-8.2 && +cd .. && +rm -rf "$READLINE" && +echo "Finished 8.11 ""$READLINE""" >> build.log && +echo "$READLINE" >> /installed.txt + +echo "8.12 ""$M4""" +tar xf "$M4".tar.xz && +cd "$M4" && +./configure --prefix=/usr && +make && +make check | tee ../check-log_"$M4".log; +make install && +cd .. && +rm -rf "$M4" && +echo "Finished 8.12 ""$M4""" >> build.log && +echo "$M4" >> /installed.txt + +echo "8.13 ""$BC""" +tar xf "$BC".tar.xz && +cd "$BC" && +CC=gcc ./configure --prefix=/usr -G -O3 -r && +make && +make test | tee ../check-log_"$BC".log; +make install && +cd .. && +rm -rf "$BC" && +echo "Finished 8.13 ""$BC""" >> build.log +echo "$BC" >> /installed.txt + +echo "8.14 ""$FLEX""" +tar xf "$FLEX".tar.gz && +cd "$FLEX" && +./configure --prefix=/usr \ + --docdir=/usr/share/doc/flex-2.6.4 \ + --disable-static && +make && +make check | tee ../check-log_"$FLEX".log; +make install && +ln -sv flex /usr/bin/lex && +cd .. && +rm -rf "$FLEX" && +echo "Finished 8.14 ""$FLEX""" >> build.log && +echo "$FLEX" >> /installed.txt + +echo "8.15 ""$TCL""" +tar xf "$TCL"-src.tar.gz && +cd "$TCL" && +SRCDIR=$(pwd) && +cd unix && +./configure --prefix=/usr \ + --mandir=/usr/share/man && +make && +sed -e "s|$SRCDIR/unix|/usr/lib|" \ + -e "s|$SRCDIR|/usr/include|" \ + -i tclConfig.sh && +sed -e "s|$SRCDIR/unix/pkgs/tdbc1.1.5|/usr/lib/tdbc1.1.5|" \ + -e "s|$SRCDIR/pkgs/tdbc1.1.5/generic|/usr/include|" \ + -e "s|$SRCDIR/pkgs/tdbc1.1.5/library|/usr/lib/tcl8.6|" \ + -e "s|$SRCDIR/pkgs/tdbc1.1.5|/usr/include|" \ + -i pkgs/tdbc1.1.5/tdbcConfig.sh && +sed -e "s|$SRCDIR/unix/pkgs/itcl4.2.3|/usr/lib/itcl4.2.3|" \ + -e "s|$SRCDIR/pkgs/itcl4.2.3/generic|/usr/include|" \ + -e "s|$SRCDIR/pkgs/itcl4.2.3|/usr/include|" \ + -i pkgs/itcl4.2.3/itclConfig.sh && +unset SRCDIR && +make test | tee ../../check-log_"$TCL".log; +make install && +chmod -v u+w /usr/lib/libtcl8.6.so && +make install-private-headers && +ln -sfv tclsh8.6 /usr/bin/tclsh && +mv /usr/share/man/man3/{Thread,Tcl_Thread}.3 && +cd .. && +tar -xf ../tcl8.6.13-html.tar.gz --strip-components=1 && +mkdir -v -p /usr/share/doc/tcl-8.6.13 && +cp -v -r ./html/* /usr/share/doc/tcl-8.6.13 && +cd .. && +rm -rf "$TCL" && +echo "Finished 8.15 ""$TCL""" >> build.log && +echo "$TCL" >> /installed.txt + +echo "8.16 ""$EXPECT""" +tar xf "$EXPECT".tar.gz && +cd "$EXPECT" && +./configure --prefix=/usr \ + --with-tcl=/usr/lib \ + --enable-shared \ + --mandir=/usr/share/man \ + --with-tclinclude=/usr/include && +make && +make test | tee ../check-log_"$EXPECT".log; +make install && +ln -svf expect5.45.4/libexpect5.45.4.so /usr/lib && +cd .. && rm -rf "$EXPECT" && +echo "Finished 8.16 ""$EXPECT""" >> build.log && +echo "$EXPECT" >> /installed.txt + +echo "8.17 ""$DEJAGNU""" +tar xf "$DEJAGNU".tar.gz && +cd "$DEJAGNU" && +mkdir -v build && +cd build && +../configure --prefix=/usr && +makeinfo --html --no-split -o doc/dejagnu.html ../doc/dejagnu.texi && +makeinfo --plaintext -o doc/dejagnu.txt ../doc/dejagnu.texi && +make install && +install -v -dm755 /usr/share/doc/dejagnu-1.6.3 && +install -v -m644 doc/dejagnu.{html,txt} /usr/share/doc/dejagnu-1.6.3 && +make check | tee ../../check-log_"$DEJAGNU".log; +cd .. && +rm -rf "$DEJAGNU" && +echo "Finished 8.17 ""$DEJAGNU""" >> build.log && +echo "$DEJAGNU" >> /installed.txt + +echo "8.18 ""$BINUTILS""" +tar xf "$BINUTILS".tar.xz && +cd "$BINUTILS" && +echo "Verify that the PTYs are working properly inside the chroot environment" +echo "The output should be: spawn ls" +expect -c "spawn ls" +sleep 5; +mkdir -v build && +cd build && +../configure --prefix=/usr \ + --sysconfdir=/etc \ + --enable-gold \ + --enable-ld=default \ + --enable-plugins \ + --enable-shared \ + --disable-werror \ + --enable-64-bit-bfd \ + --with-system-zlib && +make tooldir=/usr && +make -k check | tee ../../check-log_"$BINUTILS".log; +grep '^FAIL:' $(find -name '*.log') && +make tooldir=/usr install && +rm -fv /usr/lib/lib{bfd,ctf,ctf-nobfd,sframe,opcodes}.a && +rm -fv /usr/share/man/man1/{gprofng,gp-*}.1 && +cd ../.. && +rm -rf "$BINUTILS" && +echo "Finished 8.18 ""$BINUTILS""" >> build.log && +echo "$BINUTILS" >> /installed.txt + +echo "8.19 ""$GMP""" +tar xf "$GMP".tar.xz && +cd "$GMP" && +./configure --prefix=/usr \ + --enable-cxx \ + --disable-static \ + --docdir=/usr/share/doc/gmp-6.2.1 && +make && +make html && +make check 2>&1 | tee gmp-check-log; +awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log && +cp gmp-check-log ../check-log_"$GMP".log && +make install && +make install-html && +cd .. && +rm -rf "$GMP" && +echo "Finished 8.19 ""$GMP""" >> build.txt && +echo "$GMP" >> /installed.txt + +echo "8.20 ""$MPFR""" +tar xf "$MPFR".tar.xz && +cd "$MPFR" && +sed -e 's/+01,234,567/+1,234,567 /' \ + -e 's/13.10Pd/13Pd/' \ + -i tests/tsprintf.c && +./configure --prefix=/usr \ + --disable-static \ + --enable-thread-safe \ + --docdir=/usr/share/doc/mpfr-4.2.0 && +make && +make html && +make check | tee ../check-log_"$MPFR".log; +make install && +make install-html && +cd .. && +rm -rf "$MPFR" && +echo "Finished 8.20 ""$MPFR""" >> build.log && +echo "$MPFR" >> /installed.txt + +echo "8.21 ""$MPC""" +tar xf "$MPC".tar,gz && +cd "$MPC" && +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/mpc-1.3.1 && +make && +make html && +make check | tee ../check-log_"$MPC".log; +make install && +make install-html && +cd .. && +rm -rf "$MPC" && +echo "Finished 8.21 ""$MPC""" >> build.log && +echo "$MPC" >> /installed.txt + +echo "8.22 ""$ATTR""" +tar xf "$ATTR".tar.gz && +cd "$ATTR" && +./configure --prefix=/usr \ + --disable-static \ + --sysconfdir=/etc \ + --docdir=/usr/share/doc/attr-2.5.1 && +make && +make check | tee ../check-log_"$ATTR".log; +make install && +cd .. && +rm -rf "$ATTR" && +echo "Finished 8.22 ""$ATTR""" >> build.log && +echo "$ATTR" >> /installed.txt + +echo "8.23 ""$ACL""" +tar xf "$ACL".tar.xz && +cd "$ACL" && +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/acl-2.3.1 && +make && +make install && +cd .. && +rm -rf "$ACL" && +echo "Finished 8.23 ""$ACL""" >> build.log && +echo "$ACL" >> /installed.txt + +echo "8.24 ""$LIBCAP""" +tar xf "$LIBCAP".tar.xz && +cd "$LIBCAP" && +sed -i '/install -m.*STA/d' libcap/Makefile && +make prefix=/usr lib=lib && +make test | tee ../check-log_"$LIBCAP".log; +make prefix=/usr lib=lib install && +cd .. && +rm -rf "$LIBCAP" && +echo "Finished 8.24 ""$LIBCAP""" >> build.log && +echo "$LIBCAP" >> /installed.txt + +echo "8.25 ""$SHADOW""" +tar xf "$SHADOW".tar.xz && +cd "$SHADOW" && +sed -i 's/groups$(EXEEXT) //' src/Makefile.in && +find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; +find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \; +find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \; +sed -e 's:#ENCRYPT_METHOD DES:ENCRYPT_METHOD SHA512:' \ + -e 's@#\(SHA_CRYPT_..._ROUNDS 5000\)@\100@' \ + -e 's:/var/spool/mail:/var/mail:' \ + -e '/PATH=/{s@/sbin:@@;s@/bin:@@}' \ + -i etc/login.defs && +touch /usr/bin/passwd && +./configure --sysconfdir=/etc \ + --disable-static \ + --with-group-name-max-length=32 && +make && +make exec_prefix=/usr install && +make -C man install-man && +pwconv && +grpconv && +mkdir -p /etc/default && +useradd -D --gid 999 && +# sed -i '/MAIL/s/yes/no/' /etc/default/useradd +echo root:root | chpasswd #Set the root password +echo "The password for the user root has been set to 'root'" +sleep 5 +cd .. && +rm -rf "$SHADOW" && +echo "Finished 8.25 ""$SHADOW""" >> build.log && +echo "$SHADOW" >> /installed.txt + +echo "8.26 ""$GCC""" +tar xf "$GCC".tar.xz && +cd "$GCC" && +case $(uname -m) in + x86_64) + sed -e '/m64=/s/lib64/lib/' \ + -i.orig gcc/config/i386/t-linux64 + ;; +esac && +mkdir -v build && +cd build && +../configure --prefix=/usr \ + LD=ld \ + --enable-languages=c,c++ \ + --enable-default-pie \ + --enable-default-ssp \ + --disable-multilib \ + --disable-bootstrap \ + --with-system-zlib && +make && +ulimit -s 32768 && +chown -Rv tester . && +su tester -c "PATH=$PATH make -k -j""$JOBS"" check"; +../contrib/test_summary | tee ../../check-log_"$GCC".log && +../contrib/test_summary | grep -A7 Summ && +make install && +chown -v -R root:root \ + /usr/lib/gcc/$(gcc -dumpmachine)/12.2.0/include{,-fixed} && +ln -svr /usr/bin/cpp /usr/lib && +ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/12.2.0/liblto_plugin.so \ + /usr/lib/bfd-plugins/ && +echo "Now that our final toolchain is in place, it is important to again ensure that compiling and linking will work as expected. We do this by performing some sanity checks" +echo "There should be no errors, and the output of the last command will be (allowing for platform-specific differences in the dynamic linker name):" +echo "[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]" +echo 'int main(){}' > dummy.c && +cc dummy.c -v -Wl,--verbose &> dummy.log && +readelf -l a.out | grep ': /lib' +echo "Now make sure that we're set up to use the correct start files" +echo "The output should be:" +echo "/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/Scrt1.o succeeded" +echo "/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crti.o succeeded" +echo "/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/crtn.o succeeded" +grep -E -o '/usr/lib.*/S?crt[1in].*succeeded' dummy.log +echo "Verify that the compiler is searching for the correct header files" +echo "The output should be:" +echo "#include <...> search starts here:" +echo" /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/include" +echo" /usr/local/include" +echo" /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/include-fixed" +echo" /usr/include" +grep -B4 '^ /usr/include' dummy.log +echo "Verify that the new linker is being used with the correct search paths" +echo "References to paths that have components with '-linux-gnu' should be ignored, but otherwise the output should be:" +echo 'SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib64")' +echo 'SEARCH_DIR("/usr/local/lib64")' +echo 'SEARCH_DIR("/lib64")' +echo 'SEARCH_DIR("/usr/lib64")' +echo 'SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib")' +echo 'SEARCH_DIR("/usr/local/lib")' +echo 'SEARCH_DIR("/lib")"' +echo 'SEARCH_DIR("/usr/lib");' +grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g' +echo "Next make sure that we're using the correct libc" +echo "The output should be:" +echo "attempt to open /usr/lib/libc.so.6 succeeded" +grep "/lib.*/libc.so.6 " dummy.log +echo "Make sure GCC is using the correct dynamic linker" +echo "The output should be (allowing for platform-specific differences in dynamic linker name):" +echo "found ld-linux-x86-64.so.2 at /usr/lib/ld-linux-x86-64.so.2" +grep found dummy.log +sleep 5 +rm -v dummy.c a.out dummy.log && +mkdir -pv /usr/share/gdb/auto-load/usr/lib && +mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib && +cd ../.. && +rm -rf "$GCC" && +echo "Finished 8.26 ""$GCC""" >> build.log && +echo "$GCC" >> /installed.txt + +echo "8.27 ""$PKGCONFIG""" +tar xf "$PKGONFIG".tar.gz +cd "$PKGCONFIG" && +./configure --prefix=/usr \ + --with-internal-glib \ + --disable-host-tool \ + --docdir=/usr/share/doc/pkg-config-0.29.2 && +make && +make check | tee ../check-log_"$PKGCONFIG".log; +make install && +cd .. && +rm -rf "$PKGCONFIG" && +echo "Finished 8.27 ""$PKGCONFIG""" >> build.log && +echo "$PKGCONFIG" >> /installed.txt + +echo "8.28 ""$NCURSES""" +tar xf "$NCURSES".tar.gz && +cd "$NCURSES" && +./configure --prefix=/usr \ + --mandir=/usr/share/man \ + --with-shared \ + --without-debug \ + --without-normal \ + --with-cxx-shared \ + --enable-pc-files \ + --enable-widec \ + --with-pkg-config-libdir=/usr/lib/pkgconfig && +make && +make DESTDIR=$PWD/dest install && +install -vm755 dest/usr/lib/libncursesw.so.6.4 /usr/lib && +rm -v dest/usr/lib/libncursesw.so.6.4 && +cp -av dest/* / && +for lib in ncurses form panel menu ; do + rm -vf /usr/lib/lib${lib}.so + echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so + ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc +done && +rm -vf /usr/lib/libcursesw.so && +echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so && +ln -sfv libncurses.so /usr/lib/libcurses.so && +mkdir -pv /usr/share/doc/ncurses-6.4 && +cp -v -R doc/* /usr/share/doc/ncurses-6.4 && +cd .. && +rm -rf "$NCURSES" && +echo "Finished 8.28 ""$NCURSES""" >> build.log && +echo "$NCURSES" >> /installed.txt + +echo "8.29 ""$SED""" +tar xf "$SED".tar.xz && +cd "$SED" && +./configure --prefix=/usr && +make && +make html && +chown -Rv tester . && +su tester -c "PATH=$PATH make check" | tee ../check-log_"$GCC".log; +make install && +install -d -m755 /usr/share/doc/sed-4.9 && +install -m644 doc/sed.html /usr/share/doc/sed-4.9 && +cd .. && +rm -rf "$SED" && +echo "Finished 8.29 ""$SED""" >> build.txt && +echo "$SED" >> /installed.txt + +echo "8.30 ""$PSMISC""" +tar xf "$PSMISC".tar.xz && +cd "$PSMISC" && +./configure --prefix=/usr && +make && +make install && +cd .. && +rm -rf "$PSMISC" && +echo "Finished 8.30 ""$PSMISC""" >> build.txt && +echo "$PSMISC" >> /installed.txt + +echo "8.31 ""$GETTEXT""" +tar xf "$GETTEXT".tar.xz && +cd "$GETTEXT" && +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/gettext-0.21.1 && +make && +make check | tee ../check-log_"$GCC".log; +make install && +chmod -v 0755 /usr/lib/preloadable_libintl.so && +cd .. && +rm -rf "$GETTEXT" && +echo "Finished 8.31 ""$GETTEXT""" >> build.log && +echo "$GETTEXT" >> /installed.txt + +echo "8.32 ""$BISON""" +tar xf "$BISON".tar.xz && +cd "$BISON" && +./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.8.2 && +make && +make check | tee ../check-log_"$BISON".log; +make install && +cd .. && +rm -rf "$BISON" && +echo "Finished 8.32 ""$BISON""" >> build.log && +echo "$BISON" >> /installed.txt + +echo "8.33 ""$GREP""" +tar xf "$GREP".tar.xz && +cd "$GREP" && +sed -i "s/echo/#echo/" src/egrep.sh && +./configure --prefix=/usr && +make && +make check | tee ../check-log_"$GREP".log; +make install && +cd .. && +rm -rf "$GREP" && +echo "Finished 8.33 ""$GREP""" >> build.log && +echo "$GREP" >> /installed.txt + +echo "8.34 ""$BASH""" +tar xf "$BASH".tar.gz && +cd "$BASH" && +./configure --prefix=/usr \ + --without-bash-malloc \ + --with-installed-readline \ + --docdir=/usr/share/doc/bash-5.2.15 && +make && +chown -Rv tester . && +su -s /usr/bin/expect tester << EOF | tee ../check-log_"$BASH".log; +set timeout -1 +spawn make tests +expect eof +lassign [wait] _ _ _ value +exit $value +EOF +make install && +cd .. && +rm -rf "$BASH" && +echo "Finished 8.34 ""$BASH""" && +echo "$GREP" >> /installed.txt +echo "Executing new bash, continue with chapter 8 p2" +exec /usr/bin/bash --login diff --git a/chap8p2.sh b/chap8p2.sh new file mode 100644 index 0000000..9177ad0 --- /dev/null +++ b/chap8p2.sh @@ -0,0 +1,904 @@ +#!/bin/bash + +source vars.sh + +echo "8.35 ""$LIBTOOL""" +tar xf "$LIBTOOL".tar.xz && +cd "$LIBTOOL" && +./configure --prefix=/usr && +make && +TESTSUITEFLAGS=-j"$JOBS" make -k check | tee ../check-log_"$LIBTOOL".log; +make install && +rm -fv /usr/lib/libltdl.a && +cd .. && +rm -rf "$LIBTOOL" && +echo "Finished 8.35 ""$LIBTOOL""" >> build.log && +echo "$LIBTOOL" >> /installed.txt + +echo "8.36 ""$GDBM""" +tar xf "$GDBM".tar.gz && +cd "$GDBM" && +./configure --prefix=/usr \ + --disable-static \ + --enable-libgdbm-compat && +make && +make check | tee ../check-log_"$GDBM".log; +make install && +cd .. && +rm -rf "$GDBM" && +echo "Finished 8.36 ""$GDBM""" >> build.log && +echo "$GDBM" >> /installed.txt + +echo "8.37 ""$GPERF""" +tar xf "$GPERF".tar.gz && +cd "$GPERF" && +./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.1 && +make && +make -j1 check | tee ../check-log_"$GPERF".log; +make install && +cd .. && +rm -rf "$GPERF" && +echo "Finished 8.37 ""$GPERF""" >> build.log && +echo "$GPERF" >> /installed.txt + +echo "8.38 ""$EXPAT""" +tar xf "$EXPAT".tar.xz && +cd "$EXPAT" && +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/expat-2.5.0 && +make && +make check | tee ../check-log_"$EXPAT".log; +make install && +install -v -m644 doc/*.{html,css} /usr/share/doc/expat-2.5.0 && +cd .. && +rm -rf "$EXPAT" && +echo "Finished 8.38 ""$EXPAT""" >> build.log && +echo "$EXPAT" >> /installed.txt + +echo "8.39 ""$INETUTILS""" +tar xf "$INETUTILS".tar.xz && +cd "$INETUTILS" && +if [ "$TELNETD" = TRUE ]; then + ./configure --prefix=/usr \ + --bindir=/usr/bin \ + --localstatedir=/var \ + --disable-logger \ + --disable-whois \ + --disable-rcp \ + --disable-rexec \ + --disable-rlogin \ + --disable-rsh \ + --disable-servers \ + --enable-telnetd +else + ./configure --prefix=/usr \ + --bindir=/usr/bin \ + --localstatedir=/var \ + --disable-logger \ + --disable-whois \ + --disable-rcp \ + --disable-rexec \ + --disable-rlogin \ + --disable-rsh \ + --disable-servers +fi && +make && +make check | tee ../check-log_"$INETUTILS".log; +make install && +mv -v /usr/{,s}bin/ifconfig && +if [ "$TELNETD" = TRUE ]; then + cp -v telnetd/telnetd /usr/sbin/in.telnetd && + cat > /lib/systemd/system/telnetd.socket << "EOF" +[Unit] +Description=Telnet Socket for Per-Connection Servers + +[Socket] +ListenStream=23 +Accept=yes + +[Install] +WantedBy=sockets.target +EOF + cat > /lib/systemd/system/telnetd@.service << "EOF" + [Unit] +Description=Telnet Per-Connection Server + +[Service] +ExecStart=-/usr/sbin/in.telnetd +StandardInput=socket +EOF +fi && +cd .. && +rm -rf "$INETUTILS" && +echo "Finished 8.39 ""$INETUTILS""" >> build.log && +echo "$INETUTILS" >> /installed.txt + +echo "8.40 ""$LESS""" +tar xf "$LESS".tar.gz && +cd "$LESS" && +./configure --prefix=/usr --sysconfdir=/etc && +make && +make install && +cd .. && +rm -rf "$LESS" && +echo "Finished 8.40 ""$LESS""" >> build.log && +echo "$LESS" >> /installed.txt + +echo "8.41 ""$PERL""" +tar xf "$PERL".tar.xz && +cd "$PERL" && +export BUILD_ZLIB=False && +export BUILD_BZIP2=0 && +sh Configure -des \ + -Dprefix=/usr \ + -Dvendorprefix=/usr \ + -Dprivlib=/usr/lib/perl5/5.36/core_perl \ + -Darchlib=/usr/lib/perl5/5.36/core_perl \ + -Dsitelib=/usr/lib/perl5/5.36/site_perl \ + -Dsitearch=/usr/lib/perl5/5.36/site_perl \ + -Dvendorlib=/usr/lib/perl5/5.36/vendor_perl \ + -Dvendorarch=/usr/lib/perl5/5.36/vendor_perl \ + -Dman1dir=/usr/share/man/man1 \ + -Dman3dir=/usr/share/man/man3 \ + -Dpager="/usr/bin/less -isR" \ + -Duseshrplib \ + -Dusethreads && +make && +make test | tee ../check-log_"$PERL".log; +make install && +unset BUILD_ZLIB BUILD_BZIP2 && +cd .. && +rm -rf "$PERL" && +echo "Finished 8.41 ""$PERL""" >> build.log && +echo "$PERL" >> /installed.txt + +echo "8.42 ""$XMLPARSER""" +tar xf "$XMLPARSER".tar.gz && +cd "$XMLPARSER" && +perl Makefile.PL && +make && +make test | tee ../check-log_"$XMLPARSER".log; +make install && +cd .. && +rm -rf "$XMLPARSER" && +echo "Finished 8.42 ""$XMLPARSER""" >> build.log && +echo "$PERL" >> /installed.txt + +echo "8.43 ""$INTLTOOL""" +tar xf "$INTLTOOL".tar.gz && +cd "$INTLTOOL" && +sed -i 's:\\\${:\\\$\\{:' intltool-update.in && +./configure --prefix=/usr && +make && +make check | tee ../check-log_"$INTLTOOL".log; +make install && +install -v -Dm644 doc/I18N-HOWTO /usr/share/doc/intltool-0.51.0/I18N-HOWTO && +cd .. && +rm -rf "$INTLTOOL" && +echo "Finished 8.43 ""$INTLTOOL""" >> build.log && +echo "$INTLTOOL" >> /installed.txt + +echo "8.44 ""$AUTOCONF""" +tar xf "$AUTOCONF".tar.xz && +cd "$AUTOCONF" && +sed -e 's/SECONDS|/&SHLVL|/' \ + -e '/BASH_ARGV=/a\ /^SHLVL=/ d' \ + -i.orig tests/local.at && +./configure --prefix=/usr && +make && +TESTSUITEFLAGS=-j"$JOBS" make check | tee ../check-log_"$AUTOCONF".log; +make install && +cd .. && +rm -rf "$AUTOCONF" && +echo "Finished 8.44 ""$AUTOCONF""" >> build.log && +echo "$AUTOCONF" >> /installed.txt + +echo "8.45 ""$AUTOMAKE""" +tar xf "$AUTOMAKE".tar.xz && +cd "$AUTOMAKE" && +./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.16.5 && +make && +make -j4 check | tee ../check-log_"$AUTOMAKE".log; +make install && +cd .. && +rm -rf "$AUTOMAKE" && +echo "8.45 ""$AUTOMAKE""" >> build.log && +echo "$AUTOMAKE" >> /installed.txt + +echo "8.46 ""$OPENSSL""" +tar xf "$OPENSSL".tar.gz && +cd "$OPENSSL" && +./config --prefix=/usr \ + --openssldir=/etc/ssl \ + --libdir=lib \ + shared \ + zlib-dynamic && +make && +make test | tee ../check-log_"$OPENSSL".log; +sed -i '/INSTALL_LIBS/s/libcrypto.a libssl.a//' Makefile && +make MANSUFFIX=ssl install && +mv -v /usr/share/doc/openssl /usr/share/doc/openssl-3.0.8 && +cp -vfr doc/* /usr/share/doc/openssl-3.0.8 && +cd .. && +rm -rf "$OPENSSL" && +echo "Finished 8.46 ""$OPENSSL""" >> build.log && +echo "$OPENSSL" >> /installed.txt + +echo "8.47 ""$KMOD""" +tar xf "$KMOD".tar.xz && +cd "$KMOD" && +./configure --prefix=/usr \ + --sysconfdir=/etc \ + --with-openssl \ + --with-xz \ + --with-zstd \ + --with-zlib && +make && +make install && +for target in depmod insmod modinfo modprobe rmmod; do + ln -sfv ../bin/kmod /usr/sbin/$target +done && +ln -sfv kmod /usr/bin/lsmod && +cd .. && +rm -rf "$KMOD" && +echo "Finished 8.47 ""$KMOD""" >> build.log && +echo "$KMOD" >> /installed.txt + +echo "8.48 Libelf from ""$ELFUTILS""" +tar xf "$ELFUTILS".tar.bz2 && +cd "$ELFUTILS" && +./configure --prefix=/usr \ + --disable-debuginfod \ + --enable-libdebuginfod=dummy && +make && +make check | tee ../check-log_"$ELFUTILS".log; +make -C libelf install && +install -vm644 config/libelf.pc /usr/lib/pkgconfig && +rm /usr/lib/libelf.a && +cd .. && +rm -rf "$ELFUTILS" && +echo "Finished 8.48 Libelf from ""$ELFUTILS""" >> build.log && +echo "Libelf from $ELFUTILS" >> /installed.txt + +echo "8.49 ""$LIBFFI""" +tar xf "$LIBFFI" && +cd "$LIBFFI" && +./configure --prefix=/usr \ + --disable-static \ + --with-gcc-arch=native && +make && +make check | tee ../check-log_"$LIBFFI".log; +make install && +cd .. && +rm -rf "$LIBFFI" && +echo "Finished 8.49 ""$LIBFFI""" >> build.log && +echo "$LIBFFI" >> /installed.txt + +echo "8.50 ""$PYTHON""" +tar xf "$PYTHON".tar.xz && +cd "$PYTHON" && +./configure --prefix=/usr \ + --enable-shared \ + --with-system-expat \ + --with-system-ffi \ + --enable-optimizations && +make && +make install && +cat > /etc/pip.conf << EOF +[global] +root-user-action = ignore +disable-pip-version-check = true +EOF +install -v -dm755 /usr/share/doc/python-3.11.2/html && +tar --strip-components=1 \ + --no-same-owner \ + --no-same-permissions \ + -C /usr/share/doc/python-3.11.2/html \ + -xvf ../python-3.11.2-docs-html.tar.bz2 && +cd .. && +rm -rf "$PYTHON" && +echo "Finished 8.50 ""$PYTHON""" >> build.log && +echo "$PYTHON" >> /installed.txt + +echo "8.51 ""$WHEEL""" +tar xf "$WHEEL".tar.gz && +cd "$WHEEL" && +PYTHONPATH=src pip3 wheel -w dist --no-build-isolation --no-deps $PWD && +pip3 install --no-index --find-links=dist wheel && +cd .. && +rm -rf "$WHEEL" && +echo "Finished 8.51 ""$WHEEL""" >> build.log && +echo "$WHEEL" >> /installed.txt + +echo "8.52 ""$NINJA""" +tar xf "$NINA".tar.gz && +cd "$NINJA" && +sed -i '/int Guess/a \ + int j = 0;\ + char* jobs = getenv( "NINJAJOBS" );\ + if ( jobs != NULL ) j = atoi( jobs );\ + if ( j > 0 ) return j;\ +' src/ninja.cc && +python3 configure.py --bootstrap && +./ninja ninja_test | tee ../check-log_"$NINJA".log; +./ninja_test --gtest_filter=-SubprocessTest.SetWithLots | tee -a ../check-log_"$NINJA".log; +install -vm755 ninja /usr/bin/ && +install -vDm644 misc/bash-completion /usr/share/bash-completion/completions/ninja && +install -vDm644 misc/zsh-completion /usr/share/zsh/site-functions/_ninja && +cd .. && +rm -rf "$NINJA" && +echo "Finished 8.52 ""$NINJA""" >> build.log && +echo "$NINJA" >> /installed.txt + +echo "8.53 ""$MESON""" +tar xf "$MESON" && +cd "$MESON" && +pip3 wheel -w dist --no-build-isolation --no-deps $PWD && +pip3 install --no-index --find-links dist meson && +install -vDm644 data/shell-completions/bash/meson /usr/share/bash-completion/completions/meson && +install -vDm644 data/shell-completions/zsh/_meson /usr/share/zsh/site-functions/_meson && +cd .. && +rm -rf "$MESON" && +echo "Finished 8.53 ""$MESON""" >> build.log && +echo "$MESON" >> /installed.txt + +echo "8.54 ""$COREUTILS" +tar xf "$COREUTILS".tar.xz && +cd "$COREUTILS" && +patch -Np1 -i ../coreutils-9.1-i18n-1.patch && +autoreconf -fiv && +FORCE_UNSAFE_CONFIGURE=1 ./configure \ + --prefix=/usr \ + --enable-no-install-program=kill,uptime && +make && +make NON_ROOT_USERNAME=tester check-root && +echo "dummy:x:102:tester" >> /etc/group && +chown -Rv tester . && +su tester -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check" | tee ../check-log_"$COREUTILS".log; +sed -i '/dummy/d' /etc/group && +make install && +mv -v /usr/bin/chroot /usr/sbin && +mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8 && +sed -i 's/"1"/"8"/' /usr/share/man/man8/chroot.8 && +cd .. && +rm -rf "$COREUTILS" && +echo "Finished 8.54 ""$COREUTILS" >> build.log && +echo "$COREUTILS" >> /installed.txt + +echo "8.55 ""$CHECK""" +tar xf "$CHECK".tar.gz && +cd "$CHECK" && +./configure --prefix=/usr --disable-static && +make && +make check | tee ../check-log_"$CHECK".log; +make docdir=/usr/share/doc/check-0.15.2 install && +cd .. && +rm -rf "$CHECK" && +echo "Finished 8.55 ""$CHECK""" >> build.log && +echo "$CHECK" >> /installed.txt + +echo "8.56 ""$DIFFUTILS""" +tar xf "$DIFFUTILS".tar.xz && +cd "$DIFFUTILS" && +./configure --prefix=/usr && +make && +make check | tee ../check-log_"$DIFFUTILS".log; +make install && +cd .. && +rm -rf "$DIFFUTILS" && +echo "Finished 8.56 ""$DIFFUTILS""" >> build.log && +echo "$DIFFUTILS" >> /installed.txt + +echo "8.57 ""$GAWK""" +tar xf "$GAWK".tar.xz && +cd "$GAWK" && +sed -i 's/extras//' Makefile.in && +./configure --prefix=/usr && +make && +make check | tee ../check-log_"$GAWK".log; +make LN='ln -f' install && +mkdir -pv /usr/share/doc/gawk-5.2.1 && +cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-5.2.1 && +cd .. && +rm -rf "$GAWK" && +echo "Finished 8.57 ""$GAWK""" >> build.log && +echo "$GAWK" >> /installed.txt + +echo "8.58 ""$FINDUTILS""" +tar xf "$FINDUTILS".tar.xz && +cd "$FINDUTILS" && +case $(uname -m) in + i?86) TIME_T_32_BIT_OK=yes ./configure --prefix=/usr --localstatedir=/var/lib/locate ;; + x86_64) ./configure --prefix=/usr --localstatedir=/var/lib/locate ;; +esac && +make && +chown -Rv tester . && +su tester -c "PATH=$PATH make check" | tee ../check-log_"$FINDUTILS".log; +make install && +cd .. && +rm -rf "$FINDUTILS" && +echo "Finished 8.58 ""$FINDUTILS""" >> build.log && +echo "$FINDUTILS" >> /installed.txt + +echo "8.59 ""$GROFF""" +tar xf "$GROFF".tar.gz && +cd "$GROFF" && +PAGE="$PAPERSIZE" ./configure --prefix=/usr && +make && +make install && +cd .. && +rm -rf "$GROFF" && +echo "Finished 8.59 ""$GROFF""" >> build.log && +echo "$GROFF" >> /installed.txt + +echo "8.60 ""$GRUB""" +tar xf "$GRUB".tar.xz && +cd "$GRUB" && +unset {C,CPP,CXX,LD}FLAGS && +patch -Np1 -i ../grub-2.06-upstream_fixes-1.patch && +./configure --prefix=/usr \ + --sysconfdir=/etc \ + --disable-efiemu \ + --disable-werror && +make && +make install && +mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions && +cd .. && +rm -rf "$GRUB" && +echo "Finished 8.60 ""$GRUB""" >> build.log && +echo "$GRUB" >> /installed.txt + +echo "8.61 ""$GZIP""" +tar xf "$GZIP".tar.xz && +cd "$GZIP" && +./configure --prefix=/usr && +make && +make check | tee ../check-log_"$GZIP".log; +make install && +cd .. && +rm -rf "$GZIP" && +echo "Finished 8.61 ""$GZIP""" >> build.log && +echo "$GZIP" >> /installed.txt + +echo "8.62 ""$IPROUTE2""" +tar xf "$IPROUTE2".tar.xz && +cd "$IPROUTE2" && +sed -i /ARPD/d Makefile && +rm -fv man/man8/arpd.8 && +make NETNS_RUN_DIR=/run/netns && +make SBINDIR=/usr/sbin install && +mkdir -pv /usr/share/doc/iproute2-6.1.0 && +cp -v COPYING README* /usr/share/doc/iproute2-6.1.0 && +cd .. && +rm -rf "$IPROUTE2" && +echo "Finished 8.62 ""$IPROUTE2""" >> build.log && +echo "$IPROUTE2" >> /installed.txt + +echo "8.63 ""$KBD""" +tar xf "$KBD".tar.xz && +cd "$KBD" && +patch -Np1 -i ../kbd-2.5.1-backspace-1.patch && +sed -i '/RESIZECONS_PROGS=/s/yes/no/' configure && +sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in && +./configure --prefix=/usr --disable-vlock && +make && +make check | tee ../check-log_"$KBD".log; +make install && +mkdir -pv /usr/share/doc/kbd-2.5.1 && +cp -R -v docs/doc/* /usr/share/doc/kbd-2.5.1 && +cd .. && +rm -rf "$KBD" && +echo "Finished 8.63 ""$KBD""" >> build.log && +echo "$KBD" >> /installed.txt + +echo "8.64 ""$LIBPIPELINE""" +tar xf "$LIBPIPELINE".tar.gz && +cd "$LIBPIPELINE" && +./configure --prefix=/usr && +make && +make check | tee ../check-log_"$LIBPIPELINE".log; +make install && +cd .. && +rm -rf "$LIBPIPELINE" && +echo "Finished 8.64 ""$LIBPIPELINE""" >> build.log && +echo "$LIBPIPELINE" >> /installed.txt + +echo "8.65 ""$MAKE""" +tar xf "$MAKE".tar.gz && +cd "$MAKE" && +sed -e '/ifdef SIGPIPE/,+2 d' \ + -e '/undef FATAL_SIG/i FATAL_SIG (SIGPIPE);' \ + -i src/main.c && +./configure --prefix=/usr && +make && +make check | tee ../check-log_"$MAKE".log; +make install && +cd .. && +rm -rf "$MAKE" && +echo "Finished 8.65 ""$MAKE""" >> build.log && +echo "$MAKE" >> /installed.txt + +echo "8.66 ""$PATCH""" +tar xf "$PATCH".tar.xz && +cd "$PATCH" && +./configure --prefix=/usr && +make && +make check | tee ../check-log_"$PATCH".log; +make install && +cd .. && +rm -rf "$PATCH" && +echo "FInished 8.66 ""$PATCH""" >> build.log && +echo "$PATCH" >> /installed.txt + +echo "8.67 ""$TAR""" +tar xf "$TAR".tar.xz && +cd "$TAR" && +FORCE_UNSAFE_CONFIGURE=1 \ +./configure --prefix=/usr && +make && +make check | tee ../check-log_"$TAR".log; +make install && +make -C doc install-html docdir=/usr/share/doc/tar-1.34 && +cd .. && +rm -rf "$TAR" && +echo "Finished 8.67 ""$TAR""" >> build.log && +echo "$TAR" >> /installed.txt + +echo "8.68 ""$TEXINFO""" +tar xf "$TEXINFO" && +cd "$TEXINFO" && +./configure --prefix=/usr && +make && +make check | tee ../check-log_"$TEXINFO".log; +make install && +cd .. && +rm -rf "$TEXINFO" && +echo "Finished 8.68 ""$TEXINFO""" >> build.log && +echo "$TEXINFO" >> /installed.txt + +echo "8.69 ""$VIM""" +tar xf "$VIM".tar.xz && +cd "$VIM" && +echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h && +./configure --prefix=/usr && +make && +chown -Rv tester . && +su tester -c "LANG=en_US.UTF-8 make -j1 test" &> vim-test.log; +cp vim-test.log ../check-log_"$VIM".log && +make install && +ln -sv vim /usr/bin/vi && +for L in /usr/share/man/{,*/}man1/vim.1; do + ln -sv vim.1 $(dirname $L)/vi.1 +done && +ln -sv ../vim/vim90/doc /usr/share/doc/vim-9.0.1273 && +cat > /etc/vimrc << "EOF" && +" Begin /etc/vimrc + +" Ensure defaults are set before customizing settings, not after +source $VIMRUNTIME/defaults.vim +let skip_defaults_vim=1 + +set nocompatible +set backspace=2 +set mouse= +syntax on +if (&term == "xterm") || (&term == "putty") + set background=dark +endif + +" End /etc/vimrc +EOF +cd .. && +rm -rf "$VIM" && +echo "Finished 8.69 ""$VIM""" >> build.log && +echo "$VIM" >> /installed.txt + +echo "8.70 ""$MARKUPSAFE""" +tar xf "$MARKUPSAFE".tar.gz && +cd "$MARKUPSAFE" && +pip3 wheel -w dist --no-build-isolation --no-deps $PWD && +pip3 install --no-index --no-user --find-links dist Markupsafe && +cd .. && +rm -rf "$MARKUPSAFE" && +echo "Finished 8.70 ""$MARKUPSAFE""" >> build.log && +echo "$MARKUPSAFE" >> /installed.txt + +echo "8.71 ""$JINJA2""" +tar xf "$JINJA2".tar.gz && +cd "$JINJA2" && +pip3 wheel -w dist --no-build-isolation --no-deps $PWD && +pip3 install --no-index --no-user --find-links dist Jinja2 && +cd .. && +rm -rf "$JINJA2" && +echo "Finished 8.71 ""$JINJA2""" >> build.log && +echo "$JINJA2" >> /installed.txt + +echo "8.72 ""$SYSTEMD""" +tar xf "$SYSTEMD".tar.gz +cd "$SYSTEMD" && +patch -Np1 -i ../systemd-252-security_fix-1.patch && +sed -i -e 's/GROUP="render"/GROUP="video"/' \ + -e 's/GROUP="sgx", //' rules.d/50-udev-default.rules.in && +mkdir -p build && +cd build && +meson --prefix=/usr \ + --buildtype=release \ + -Ddefault-dnssec=no \ + -Dfirstboot=false \ + -Dinstall-tests=false \ + -Dldconfig=false \ + -Dsysusers=false \ + -Drpmmacrosdir=no \ + -Dhomed=false \ + -Duserdb=false \ + -Dman=false \ + -Dmode=release \ + -Dpamconfdir=no \ + -Ddocdir=/usr/share/doc/systemd-252 \ + .. && +ninja && +ninja install && +tar -xf ../../systemd-man-pages-252-2.tar.xz --strip-components=1 -C /usr/share/man && +systemd-machine-id-setup && +systemctl preset-all && +systemctl disable systemd-sysupdate{,-reboot} && +if [ "$TELNETD" = TRUE ]; then + systemctl enable telnetd.socket +fi && +cd ../.. && +rm -rf "$SYSTEMD" && +echo "Finished 8.72 ""$SYSTEMD""" >> build.log && +echo "$SYSTEMD" >> /installed.txt + +echo "8.73 ""$DBUS""" +tar xf "$DBUS".tar.xz && +cd "$DBUS" && +./configure --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --runstatedir=/run \ + --disable-static \ + --disable-doxygen-docs \ + --disable-xml-docs \ + --docdir=/usr/share/doc/dbus-1.14.6 \ + --with-system-socket=/run/dbus/system_bus_socket && +make && +make install && +ln -sfv /etc/machine-id /var/lib/dbus && +cd .. && +rm -rf "$DBUS" && +echo "Finished 8.73 ""$DBUS""" >> build.log && +echo "$DBUS" >> /installed.txt + +echo "8.74 ""$MANDB""" +tar xf "$MANDB".tar.xz && +cd "$MANDB" && +./configure --prefix=/usr \ + --docdir=/usr/share/doc/man-db-2.11.2 \ + --sysconfdir=/etc \ + --disable-setuid \ + --enable-cache-owner=bin \ + --with-browser=/usr/bin/lynx \ + --with-vgrind=/usr/bin/vgrind \ + --with-grap=/usr/bin/grap && +make && +make check | tee ../check-log_"$MANDB".log; +make install && +cd .. && +rm -rf "$MANDB" && +echo "Finished 8.74 ""$MANDB""" >> build.log && +echo "$MANDB" >> /installed.txt + +echo "8.75 ""$PROCPSNG""" +tar xf "$PROCPSNG".tar.xz +cd "$PROCPSNG" && +./configure --prefix=/usr \ + --docdir=/usr/share/doc/procps-ng-4.0.2 \ + --disable-static \ + --disable-kill \ + --with-systemd && +make && +make check | tee ../check-log_"$MANDB".log; +make install && +cd .. && +rm -rf "$PROCPSNG" && +echo "Finished 8.75 ""$PROCPSNG""" >> build.log && +echo "$PROCPSNG" >> /installed.txt + +echo "8.76 ""$UTILLINUX""" +tar xf "$UTILLINUX".tar.xz && +cd "$UTILLINUX" && +./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ + --bindir=/usr/bin \ + --libdir=/usr/lib \ + --sbindir=/usr/sbin \ + --disable-chfn-chsh \ + --disable-login \ + --disable-nologin \ + --disable-su \ + --disable-setpriv \ + --disable-runuser \ + --disable-pylibmount \ + --disable-static \ + --without-python \ + --docdir=/usr/share/doc/util-linux-2.38.1 && +make && +make install && +cd .. && +rm -rf "$UTILLINUX" && +echo "Finished 8.76 ""$UTILLINUX""" >> build.log && +echo "$UTILLINUX" >> /installed.txt + +echo "8.77 ""$E2FSPROGS""" +tar xf "$E2FSPROGS".tar.gz && +cd "$E2FSPROGS" && +mkdir -v build && +cd build && +../configure --prefix=/usr \ + --sysconfdir=/etc \ + --enable-elf-shlibs \ + --disable-libblkid \ + --disable-libuuid \ + --disable-uuidd \ + --disable-fsck && +make && +make check | tee ../check-log_"$E2FSPROGS".log; +make install && +rm -fv /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a && +gunzip -v /usr/share/info/libext2fs.info.gz && +install-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info && +makeinfo -o doc/com_err.info ../lib/et/com_err.texinfo && +install -v -m644 doc/com_err.info /usr/share/info && +install-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info && +cd .. && +rm -rf "$E2FSPROGS" && +echo "Finished 8.77 ""$E2FSPROGS""" >> build.log && +echo "$E2FSPROGS" >> /installed.txt + +save_usrlib="$(cd /usr/lib; ls ld-linux*[^g]) + libc.so.6 + libthread_db.so.1 + libquadmath.so.0.0.0 + libstdc++.so.6.0.30 + libitm.so.1.0.0 + libatomic.so.1.2.0" && +cd /usr/lib && +for LIB in $save_usrlib; do + objcopy --only-keep-debug $LIB $LIB.dbg + cp $LIB /tmp/$LIB + strip --strip-unneeded /tmp/$LIB + objcopy --add-gnu-debuglink=$LIB.dbg /tmp/$LIB + install -vm755 /tmp/$LIB /usr/lib + rm /tmp/$LIB +done && +online_usrbin="bash find strip" && +online_usrlib="libbfd-2.40.so + libsframe.so.0.0.0 + libhistory.so.8.2 + libncursesw.so.6.4 + libm.so.6 + libreadline.so.8.2 + libz.so.1.2.13 + $(cd /usr/lib; find libnss*.so* -type f)" && +for BIN in $online_usrbin; do + cp /usr/bin/$BIN /tmp/$BIN + strip --strip-unneeded /tmp/$BIN + install -vm755 /tmp/$BIN /usr/bin + rm /tmp/$BIN +done && +for LIB in $online_usrlib; do + cp /usr/lib/$LIB /tmp/$LIB + strip --strip-unneeded /tmp/$LIB + install -vm755 /tmp/$LIB /usr/lib + rm /tmp/$LIB +done && +for i in $(find /usr/lib -type f -name \*.so* ! -name \*dbg) \ + $(find /usr/lib -type f -name \*.a) \ + $(find /usr/{bin,sbin,libexec} -type f); do + case "$online_usrbin $online_usrlib $save_usrlib" in + *$(basename $i)* ) + ;; + * ) strip --strip-unneeded $i + ;; + esac +done && +unset BIN LIB save_usrlib online_usrbin online_usrlib && + +rm -rf /tmp/* && +find /usr/lib /usr/libexec -name \*.la -delete && +find /usr -depth -name $(uname -m)-lfs-linux-gnu\* | xargs rm -rf && +userdel -r tester && + +cat > /etc/systemd/network/10-eth-dhcp.network << "EOF" && +Name="$NETWORKINTERFACE" + +[Network] +DHCP=ipv4 + +[DHCPv4] +UseDomains=true +EOF +echo "$HOSTNAME" > /etc/hostname && +cat > /etc/hosts << "EOF" && +# Begin /etc/hosts + +127.0.0.1 localhost.localdomain localhost +127.0.1.1 "$HOSTNAME"."$DOMAIN" "$HOSTNAME" +::1 localhost ip6-localhost ip6-loopback +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters + +# End /etc/hosts +EOF +cat > /etc/vconsole.conf << "EOF" && +KEYMAP="$KEYMAP" +FONT=Lat2-Terminus16 +EOF +cat > /etc/locale.conf << "EOF" && +LANG="$LOCALE" +EOF +cat > /etc/inputrc << "EOF" && +# Begin /etc/inputrc +# Modified by Chris Lynn + +# Allow the command prompt to wrap to the next line +set horizontal-scroll-mode Off + +# Enable 8-bit input +set meta-flag On +set input-meta On + +# Turns off 8th bit stripping +set convert-meta Off + +# Keep the 8th bit for display +set output-meta On + +# none, visible or audible +set bell-style none + +# All of the following map the escape sequence of the value +# contained in the 1st argument to the readline specific functions +"\eOd": backward-word +"\eOc": forward-word + +# for linux console +"\e[1~": beginning-of-line +"\e[4~": end-of-line +"\e[5~": beginning-of-history +"\e[6~": end-of-history +"\e[3~": delete-char +"\e[2~": quoted-insert + +# for xterm +"\eOH": beginning-of-line +"\eOF": end-of-line + +# for Konsole +"\e[H": beginning-of-line +"\e[F": end-of-line + +# End /etc/inputrc +EOF +cat > /etc/shells << "EOF" && +# Begin /etc/shells + +/bin/sh +/bin/bash + +# End /etc/shells +EOF +mkdir -pv /etc/systemd/system/getty@tty1.service.d && +cat > /etc/systemd/system/getty@tty1.service.d/noclear.conf << EOF && +[Service] +TTYVTDisallocate=yes +EOF +# ln -sfv /dev/null /etc/systemd/system/tmp.mount +mkdir -pv /etc/systemd/coredump.conf.d && +cat > /etc/systemd/coredump.conf.d/maxuse.conf << EOF +[Coredump] +MaxUse=5G +EOF + +echo "Continue with chapter 10.2. Creating the /etc/fstab File" diff --git a/vars.sh b/vars.sh new file mode 100644 index 0000000..82ac1a7 --- /dev/null +++ b/vars.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +export JOBS="4" +export NINJAJOBS=$JOBS +export TELNETD=true +export PAPERSIZE="A4" +export NETWORKINTERFACE="enp11s0" +export HOSTNAME="lfs" +export DOMAIN="fritz.box" +export KEYMAP="de-latin1" +export LOCALE="en_US.utf8" + +export LFS="/mnt/lfs" + +export BINUTILS="binutils-2.40" +export GCC="gcc-12.2.0" +export LINUX="Linux-6.1.11" +export M4="M4-1.4.19" +export GLIBC="Glibc-2.37" +export BASH="bash-5.2.15" +export COREUTILS="coreutils-9.1" +export DIFFUTILS="diffutils-3.9" +export FILE="file-5.44" +export FINDUTILS="findutils-4.9.0" +export GAWK="gawk-5.2.1" +export GREP="grep-3.8" +export GZIP="gzip-1.12" +export MAKE="make-4.4" +export PATCH="patch-2.7.6" +export SED="sed-4.9" +export TAR="tar-1.34" +export XZ="xz-5.4.1" +export GETTEXT="gettext-0.21.1" +export BISON="bison-3.8.2" +export PERL="perl-5.36.0" +export PYTHON="Python-3.11.2" +export TEXINFO="texinfo-7.0.2" +export UTILLINUX="util-linux-2.38.1" +export MANPAGES="man-pages-6.03" +export IANAETC="iana-etc-20230202" +export ZLIB="zlib-1.2.13" +export BZIP2="bzip2-1.0.8" +export ZSTD="zstd-1.5.4" +export READLINE="readline-8.2" +export BC="bc-6.2.4" +export FLEX="flex-2.6.4" +export TCL="tcl8.6.13" +export EXPECT="expect5.45.4" +export DEJAGNU="dejagnu-1.6.3" +export MPFR="mpfr-4.2.0" +export GMP="gmp-6.2.1" +export MPC="mpc-1.3.1" +export ATTR="attr-2.5.1" +export ACL="acl-2.3.1" +export LIBCAP="libcap-2.67" +export SHADOW="shadow-4.13" +export PKGCONFIG="pkg-config-0.29.2" +export NCURSES="ncurses-6.4" +export PSMISC="psmisc-23.6" +export LIBTOOL="libtool-2.4.7" +export GDBM="gdbm-1.23" +export GPERF="gperf-3.1" +export EXPAT="expat-2.5.0" +export INETUTILS="inetutils-2.4" +export LESS="less-608" +export XMLPARSER="XML-Parser-2.46" +export INTLTOOL="intltool-0.51.0" +export AUTOCONF="autoconf-2.71" +export AUTOMAKE="automake-1.16.5" +export OPENSSL="openssl-3.0.8" +export KMOD="kmod-30" +export ELFUTILS="elfutils-0.188" +export LIBFFI="libffi-3.4.4" +export WHEEL="wheel-0.38.4" +export NINJA="ninja-1.11.1" +export MESON="meson-1.0.0" +export CHECK="check-0.15.2" +export GROFF="groff-1.22.4" +export GRUB="grub-2.06" +export IPROUTE2="iproute2-6.1.0" +export KBD="kbd-2.5.1" +export LIBPIPELINE="libpipeline-1.5.7" +export VIM="vim-9.0.1273" +export MARKUPSAFE="MarkupSafe-2.1.2" +export JINJA2="Jinja2-3.1.2" +export SYSTEMD="systemd-252" +export DBUS="dbus-1.14.6" +export MANDB="man-db-2.11.2" +export PROCPSNG="procps-ng" +export E2FSPROGS="e2fsprogs-1.47.0" \ No newline at end of file diff --git a/version-check.sh b/version-check.sh new file mode 100644 index 0000000..46ca604 --- /dev/null +++ b/version-check.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Simple script to list version numbers of critical development tools +export LC_ALL=C +bash --version | head -n1 | cut -d" " -f2-4 +MYSH=$(readlink -f /bin/sh) +echo "/bin/sh -> $MYSH" +echo "$MYSH" | grep -q bash || echo "ERROR: /bin/sh does not point to bash" +unset MYSH + +echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3- +bison --version | head -n1 + +if [ -h /usr/bin/yacc ]; then + echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`"; +elif [ -x /usr/bin/yacc ]; then + echo yacc is `/usr/bin/yacc --version | head -n1` +else + echo "yacc not found" +fi + +echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2 +diff --version | head -n1 +find --version | head -n1 +gawk --version | head -n1 + +if [ -h /usr/bin/awk ]; then + echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`"; +elif [ -x /usr/bin/awk ]; then + echo awk is `/usr/bin/awk --version | head -n1` +else + echo "awk not found" +fi + +gcc --version | head -n1 +g++ --version | head -n1 +grep --version | head -n1 +gzip --version | head -n1 +cat /proc/version +m4 --version | head -n1 +make --version | head -n1 +patch --version | head -n1 +echo Perl `perl -V:version` +python3 --version +sed --version | head -n1 +tar --version | head -n1 +makeinfo --version | head -n1 # texinfo version +xz --version | head -n1 + +echo 'int main(){}' > dummy.c && g++ -o dummy dummy.c +if [ -x dummy ] + then echo "g++ compilation OK"; + else echo "g++ compilation failed"; fi +rm -f dummy.c dummy \ No newline at end of file