From 1512c07ec2a2756cffa7e638b08aef60d784be29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krizs=C3=A1n=20P=C3=A9ter?= Date: Sat, 9 Nov 2024 20:08:10 +0100 Subject: [PATCH] Adjust fstab script with valid data+ vscode update --- add_packages.sh | 2 +- lfsSetup.sh | 40 ++++++++++++++++++++++++++++++++++++++++ xsoft/other/vscode.xml | 4 ++-- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/add_packages.sh b/add_packages.sh index 12779bf..5a3ad57 100755 --- a/add_packages.sh +++ b/add_packages.sh @@ -43,4 +43,4 @@ grep -qF sdl2-image-version ../blfs_root/blfs-xml/packages.ent || echo '.*/i ' ../blfs_root/blfs-xml/xsoft/other/other.xml -grep -qF vscode-version ../blfs_root/blfs-xml/packages.ent || echo '' >> ../blfs_root/blfs-xml/packages.ent \ No newline at end of file +grep -qF vscode-version ../blfs_root/blfs-xml/packages.ent || echo '' >> ../blfs_root/blfs-xml/packages.ent \ No newline at end of file diff --git a/lfsSetup.sh b/lfsSetup.sh index 9b28a05..3e2788a 100755 --- a/lfsSetup.sh +++ b/lfsSetup.sh @@ -29,6 +29,37 @@ patchKernelVersion() fi } +# Function that createst an fstab based on the incoming folder +createFstab() +{ + # Get mount info from lsblk output + LSBLK_INFO=$(lsblk -l -o MOUNTPOINT,PATH,NAME,PKNAME,UUID,FSTYPE,PTTYPE | sed "/^ /d") + + printf "# Begin /etc/fstab\n\n" + printf '%-41s %-11s %-4s %-16s %-4s %-10s\n' "# File system (UUID)" "mount-point" "type" "options" "dump" "fsck" + printf '#%100s\n\n' "order" + + # Find the root mount point + DIR_ROOT=$(grep "^/ " <<< "$LSBLK_INFO") + if [ -n "$DIR_ROOT" ] ; then + printf '%-41s %-11s %-4s %-16s %-4s %-10s\n' "UUID=$(awk '{print $5}' <<< "$DIR_ROOT")" / "$(awk '{print $6}' <<< "$DIR_ROOT")" defaults 1 1 + fi + + # Find if there is a separate boot drive + DIR_BOOT=$(grep "^/boot " <<< "$LSBLK_INFO") + if [ -n "$DIR_BOOT" ] ; then + printf '%-41s %-11s %-4s %-16s %-4s %-10s\n' "UUID=$(awk '{print $5}' <<< "$DIR_BOOT")" /boot "$(awk '{print $6}' <<< "$DIR_BOOT")" noauto,defaults 0 0 + fi + + # Find if there is a swap partition + DIR_SWAP=$(grep "^\[SWAP\] " <<< "$LSBLK_INFO") + if [ -n "$DIR_SWAP" ] ; then + printf '%-41s %-11s %-4s %-16s %-4s %-10s\n' "UUID=$(awk '{print $5}' <<< "$DIR_SWAP")" swap "$(awk '{print $6}' <<< "$DIR_SWAP")" pri=1 0 0 + fi + + printf "\n# End /etc/fstab\n" +} + # Check if the lfs mount point folder is specified as the first argument if [ -z "$1" ] then @@ -164,6 +195,8 @@ cp -iv lfs_configs/configuration "$DIR_SETUP/" echo Patching setup configuration file... FILE_CFG="$DIR_SETUP/configuration" sed -i -E "\@BUILDDIR=\"xxx\"@s@xxx@$1@g" "$FILE_CFG" +#sed -i -E "\@FSTAB=\"xxx\"@s@xxx@/home/$U/fstab@g" "$FILE_CFG" +sed -i -E "/^FSTAB=/s/^/#/g" "$FILE_CFG" sed -i -E "\@FSTAB=\"xxx\"@s@xxx@/home/$U/fstab@g" "$FILE_CFG" sed -i -E "\@CONFIG=\"xxx\"@s@xxx@/home/$U/config-$LATEST_KERNEL_VER@g" "$FILE_CFG" sed -i -E "\@KEYMAP=\"xxx\"@s@xxx@$(localectl | grep Keymap | awk -F' ' '{printf $NF}')@g" "$FILE_CFG" @@ -195,6 +228,13 @@ if [ -n "$NET_SCRIPT" ] ; then fi fi +# Patch fstab script +FSTAB_SCRIPT=$(find "$DIR_COMMANDS" -type f -iname "*-fstab") +if [ -n "$FSTAB_SCRIPT" ] ; then + sed -i '/^cat /,/^EOF/{/^cat /!{/^EOF/!d}}' "$FSTAB_SCRIPT" + sed -i "/^cat /a $(createFstab | sed '$!s/$/\\/')/" "$FSTAB_SCRIPT" +fi + # Patch LFS kernel script to keep build folder and add new user KERNEL_SCRIPT=$(find "$DIR_COMMANDS" -type f -iname "*-kernel") sed -i "/^rm -rf \$PKGDIR/s/^/#/" "$KERNEL_SCRIPT" diff --git a/xsoft/other/vscode.xml b/xsoft/other/vscode.xml index 1ac59db..227f1f5 100644 --- a/xsoft/other/vscode.xml +++ b/xsoft/other/vscode.xml @@ -4,9 +4,9 @@ %general-entities; - + - +