Chroot: Create the fstab file on the target system

This commit is contained in:
Jeremy Gardais 2019-04-03 16:34:29 +02:00
parent c4ce689763
commit 28428ffb18
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 17 additions and 0 deletions

17
debian/chroot.install vendored
View File

@ -181,6 +181,23 @@ do
done < "${tmp_list_lv}" done < "${tmp_list_lv}"
rm -f -- "${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 {{{ # Finish {{{