Chroot: Set the default system mount

This commit is contained in:
Jeremy Gardais 2019-04-05 17:40:33 +02:00
parent fc69b8633f
commit 85275feeea
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 5 additions and 1 deletions

View File

@ -188,12 +188,16 @@ 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
grep target /etc/mtab | grep -vE '(tmpfs|pts|proc|sysfs)' > /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 "^proc" /target/etc/fstab || echo "proc /proc proc rw,nodev,size=100M 0 0" >> /target/etc/fstab
grep "^sysfs" /target/etc/fstab || echo "sysfs /sys sysfs rw,nodev,size=100M 0 0" >> /target/etc/fstab
grep "/dev/shm" /target/etc/fstab || echo "tmpfs /dev/shm tmpfs rw,nodev,size=100M 0 0" >> /target/etc/fstab
grep "^devpts" /target/etc/fstab || echo "devpts /dev/pts devpts rw,relatime,size=10240k,nr_inodes=2051120,mode=755 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 and avoid double slashs