From 28428ffb18619ffba381afe4a2c49dace3fed98a Mon Sep 17 00:00:00 2001 From: Gardouille Date: Wed, 3 Apr 2019 16:34:29 +0200 Subject: [PATCH] Chroot: Create the fstab file on the target system --- debian/chroot.install | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/debian/chroot.install b/debian/chroot.install index 14c54f0..bdc91c5 100755 --- a/debian/chroot.install +++ b/debian/chroot.install @@ -181,6 +181,23 @@ do done < "${tmp_list_lv}" rm -f -- "${tmp_list_lv}" +## }}} +## Fstab {{{ +### Use the current mtab content as default fstab file for the target system +grep target /etc/mtab > /target/etc/fstab + +### Ensure to enable swap +grep swap /target/etc/fstab || echo "/dev/mapper/${vgname}-swap swap swap sw,pri=0 0 0" >> /target/etc/fstab + +### Add extra tmpfs mount point +grep devtmpfs /target/etc/fstab || echo "udev /dev devtmpfs rw,relatime,size=10240k,nr_inodes=2051120,mode=755 0 0" >> /target/etc/fstab +grep "/run " /target/etc/fstab || echo "tmpfs /run tmpfs rw,size=15M,mode=755 0 0" >> /target/etc/fstab +grep "/run/lock" /target/etc/fstab || echo "tmpfs /run/lock tmpfs rw,size=5120k 0 0" >> /target/etc/fstab +grep "/run/shm" /target/etc/fstab || echo "tmpfs /run/shm tmpfs rw,nodev,size=100M 0 0" >> /target/etc/fstab +grep "/var/tmp" /target/etc/fstab || echo "/tmp /var/tmp none rw,bind,size=1M,mode=1777 0 0" >> /target/etc/fstab + +### Remove all occurrences to /target +sed -i 's;/target;;g' /target/etc/fstab ## }}} # }}} # Finish {{{