diff --git a/Einrichter-CLI.sh b/Einrichter-CLI.sh index 2f2bfc0..af998ce 100755 --- a/Einrichter-CLI.sh +++ b/Einrichter-CLI.sh @@ -7,23 +7,30 @@ fi SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) EINRICHTER_VER=0.1.0 -function main() { +function booter() { einrichter.colours echo "Einrichter - TylkoLinux Installer Shell $EINRICHTER_VER The script is located at $SCRIPT_DIR Run einrichter.help for commands" - read -p "einrichter>" Command_Input + main +} + +function main() { + read -p "einrichter> " Command_Input $Command_Input main } -einrichter.help() { +function einrichter.help() { echo "Einrichter commands: einrichter.installer.pkgs - Prepare packages for installation einrichter.installer.DirLayout - Set up the directories at the target system einrichter.installer.SafeUser - Set up LFS user on host and starting package compilation einrichter.installer.chroot - Enter the environment using chroot einrichter.help - Show this help dialog +einrichter.backup.create - Create a backup of the system to the home folder +einrichter.backup.restore - Restore the aforementioned backup +exit - Exit the script For more information, see https://github.com/kevadesu/TylkoLinux" } @@ -100,7 +107,7 @@ function einrichter.colours() { export On_IPurple='\033[0;105m' # Purple export On_ICyan='\033[0;106m' # Cyan export On_IWhite='\033[0;107m' # White - echo "[i] The colour variables have been set." + echo -e "${Purple}[i] The colour variables have been set.${Color_Off}" } function einrichter.installer.pkgs() { @@ -218,6 +225,7 @@ function einrichter.installer.chroot() { MAKEFLAGS="-j$(nproc)" \ TESTSUITEFLAGS="-j$(nproc)" \ /bin/bash --login + einrichter.installer.chroot.end } @@ -231,9 +239,9 @@ function einrichter.installer.chroot.end() { } function einrichter.backup.create() { - echo -e "[?] Variable LFS points to $LFS. This needs to point to the target LFS system. + echo -e "${BRed}[?] Variable LFS points to ${LFS}. This needs to point to the target LFS system. If this does NOT point to the LFS directory, EXIT NOW AND SET THE VARIABLE. This will otherwise -DESTROY THE ENTIRE HOST SYSTEM. YOU ARE WARNED." +DESTROY THE ENTIRE HOST SYSTEM. YOU ARE WARNED.${Color_Off}" read -p "[?] Continue? (y/n) " OPT if [ "$OPT" = "y" ]; then echo "Continuing..."; else exit 1; fi echo "[i] Unmounting the virtual file systems..." @@ -248,9 +256,9 @@ DESTROY THE ENTIRE HOST SYSTEM. YOU ARE WARNED." } function einrichter.backup.restore() { - echo -e "[?] Variable LFS points to $LFS. This needs to point to the target LFS system. + echo -e "${BRed}[?] Variable LFS points to ${LFS}. This needs to point to the target LFS system. If this does NOT point to the LFS directory, EXIT NOW AND SET THE VARIABLE. This will otherwise -DESTROY THE ENTIRE HOST SYSTEM. YOU ARE WARNED." +DESTROY THE ENTIRE HOST SYSTEM. YOU ARE WARNED.${Color_Off}" read -p "[?] Continue? (y/n) " OPT echo "[i] Restoring from backup..." cd $LFS @@ -274,4 +282,4 @@ function einrichter.installer.fail() { esac } -main +booter diff --git a/Einrichter-in-chroot.sh b/Einrichter-in-chroot.sh index c3e798c..d69fd70 100755 --- a/Einrichter-in-chroot.sh +++ b/Einrichter-in-chroot.sh @@ -19,7 +19,7 @@ chown root:root /bin/bash echo "Switched to Einrichter-in-chroot mode. Type eic.help for list of commands, exit to exit." function main() { - read -p "einrichter/eic>" OPT + read -p "einrichter/eic> " OPT $OPT main } @@ -33,6 +33,8 @@ function eic.help() { eic.system.build - build the system eic.system.build.gcc - build GCC. this has been put in a separate function because building GCC alone takes 46 SBU. eic.system.build.continue - continue building the system after successfully building GCC + eic.strip - removes unnecessary debug symbols + eic.system.build.clean - clean up files after the build process eic.help - show this message " } @@ -1512,4 +1514,79 @@ if ( j > 0 ) return j;\ make make check 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 + popd + popd + echo "[i] The system build has successfully finished." +} + +function eic.strip() { + 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.33 + libitm.so.1.0.0 + libatomic.so.1.2.0" + + cd /usr/lib + + for LIB in $save_usrlib; do + objcopy --only-keep-debug --compress-debug-sections=zlib $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.43.1.so + libsframe.so.1.0.0 + libhistory.so.8.2 + libncursesw.so.6.5 + libm.so.6 + libreadline.so.8.2 + libz.so.1.3.1 + libzstd.so.1.5.6 + $(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 +} + +function eic.system.build.clean() { + 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 } diff --git a/wget-list-systemd b/wget-list-systemd index be0501d..557f7a3 100644 --- a/wget-list-systemd +++ b/wget-list-systemd @@ -76,7 +76,7 @@ https://downloads.sourceforge.net/tcl/tcl8.6.14-html.tar.gz https://ftp.gnu.org/gnu/texinfo/texinfo-7.1.tar.xz https://www.iana.org/time-zones/repository/releases/tzdata2024a.tar.gz https://www.kernel.org/pub/linux/utils/util-linux/v2.40/util-linux-2.40.2.tar.xz -https://github.com/vim/vim/archive/v9.1.0660/vim-9.1.0660.tar.gz +# https://github.com/vim/vim/archive/v9.1.0660/vim-9.1.0660.tar.gz https://pypi.org/packages/source/w/wheel/wheel-0.44.0.tar.gz https://cpan.metacpan.org/authors/id/T/TO/TODDR/XML-Parser-2.47.tar.gz https://github.com//tukaani-project/xz/releases/download/v5.6.2/xz-5.6.2.tar.xz