Chroot: Fix mount of some tmpfs for chroot

And remove some useless tmpfs from fstab.
This commit is contained in:
Jeremy Gardais 2019-04-03 23:17:58 +02:00
parent 6583d32ddf
commit 166253b508
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 11 additions and 7 deletions

18
debian/chroot.install vendored
View File

@ -117,12 +117,14 @@ mountpoint -q /target/var/lib/vz || mount -- /dev/mapper/"${vgname}"-vz /target/
swapon -- /dev/mapper/"${vgname}"-swap swapon -- /dev/mapper/"${vgname}"-swap
### System ### System
mkdir -p -- /target/dev
mountpoint -q /target/dev/ || mount -t devtmpfs -- none /target/dev
mkdir -p -- /target/dev/pts mkdir -p -- /target/dev/pts
mountpoint -q /target/dev/pts || mount -o bind -- /dev/pts /target/dev/pts mountpoint -q /target/dev/pts || mount -t devpts -- /dev/pts /target/dev/pts
mkdir -p -- /target/proc mkdir -p -- /target/proc
mountpoint -q /target/proc || mount -t proc -- proc /target/proc mountpoint -q /target/proc || mount -t proc -- none /target/proc
mkdir -p -- /target/sys mkdir -p -- /target/sys
mountpoint -q /target/sys || mount -o bind -- /sys /target/sys mountpoint -q /target/sys || mount -t sysfs -- none /target/sys
## }}} ## }}}
## Run debootstrap ## Run debootstrap
debootstrap --arch amd64 --include="${dbs_pkg_include}" --exclude="${dbs_pkg_exclude}" stretch /target http://ftp.fr.debian.org/debian debootstrap --arch amd64 --include="${dbs_pkg_include}" --exclude="${dbs_pkg_exclude}" stretch /target http://ftp.fr.debian.org/debian
@ -190,10 +192,6 @@ grep target /etc/mtab > /target/etc/fstab
grep swap /target/etc/fstab || echo "/dev/mapper/${vgname}-swap swap swap sw,pri=0 0 0" >> /target/etc/fstab 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 ### 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 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 ### Remove all occurrences to /target
@ -223,6 +221,12 @@ iface ${net_device} inet static
source-directory /etc/network/interfaces.d" > /target/etc/network/interfaces source-directory /etc/network/interfaces.d" > /target/etc/network/interfaces
## }}}
## Ensure to remount device {{{
mountpoint -q /target/dev/ || mount -t devtmpfs -- none /target/dev
mountpoint -q /target/dev/pts || mount -t devpts -- /dev/pts /target/dev/pts
mountpoint -q /target/proc || mount -t proc -- none /target/proc
mountpoint -q /target/sys || mount -t sysfs -- none /target/sys
## }}} ## }}}
## Locale {{{ ## Locale {{{
### Enable locale(s) ### Enable locale(s)