functions/fixups: edit /etc/fstab when it exists

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: I5b8054b8951f16ba48da4cacdab5f7af23f91f1c
This commit is contained in:
Dongjin Kim
2024-01-21 00:14:26 +09:00
parent f94f0e39f6
commit 04f9e36adf
2 changed files with 11 additions and 6 deletions

View File

@@ -1,7 +1,12 @@
#!/bin/sh
if [ -f /etc/fstab ]; then
# Remove BOOT/ROOTFS mount points
sed -i "/ \/boot /d" /etc/fstab
sed -i "/ \/ /d" /etc/fstab
# Remove EFI partition not to mount
sed -i "/\/boot\/efi/d" /etc/fstab
fi
if [ "x@@DEFAULT_DEV_ROOTFS@@" != "x" ]; then
cat <<__EOF | tee -a /etc/fstab >/dev/null
@@ -15,7 +20,4 @@ UUID="@@DEFAULT_DEV_BOOT@@" /boot ext2 rw,relatime,errors=continue 0 0
__EOF
fi
# Remove EFI partition not to mount
sed -i "/\/boot\/efi/d" /etc/fstab
update-initramfs -u

View File

@@ -242,7 +242,10 @@ do_mount() {
}
get_uuid_by_path() {
grep " ${1} " ${rootfs_mnt}/etc/fstab | cut -d' ' -f1 | cut -d'=' -f2 | tr -d '"'
if [ -f ${rootfs_mnt}/etc/fstab ]; then
grep " ${1} " ${rootfs_mnt}/etc/fstab \
| cut -d' ' -f1 | cut -d'=' -f2 | tr -d '"'
fi
}
do_create_squashfs() {