From f5d03149b34f60f8d85b847beea4ce3debd42a14 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Fri, 5 Apr 2019 23:52:17 +0200 Subject: [PATCH] Avoid to mount tmpfs before debootstrap --- debian/chroot.install | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/debian/chroot.install b/debian/chroot.install index e50da83..3711e09 100755 --- a/debian/chroot.install +++ b/debian/chroot.install @@ -121,16 +121,6 @@ mountpoint -q /target/var/lib/vz || mount -- /dev/mapper/"${vgname}"-vz /target/ ### Swap swapon -- /dev/mapper/"${vgname}"-swap - -### System -mkdir -p -- /target/dev -mountpoint -q /target/dev/ || mount -t devtmpfs -- none /target/dev -mkdir -p -- /target/dev/pts -mountpoint -q /target/dev/pts || mount -t devpts -- /dev/pts /target/dev/pts -mkdir -p -- /target/proc -mountpoint -q /target/proc || mount -t proc -- none /target/proc -mkdir -p -- /target/sys -mountpoint -q /target/sys || mount -t sysfs -- none /target/sys ## }}} ## Run debootstrap debootstrap --arch amd64 --include="${dbs_pkg_include}" --exclude="${dbs_pkg_exclude}" stretch /target http://ftp.fr.debian.org/debian @@ -208,15 +198,20 @@ grep "/var/tmp" /target/etc/fstab || echo "/tmp /var/tmp no sed -i 's;target;;g' /target/etc/fstab sed -i 's;//;/;g' /target/etc/fstab ## }}} -## Ensure to remount device {{{ +## Ensure to (re)mount devices for chroot {{{ +mkdir -p -- /target/dev mountpoint -q /target/dev/ || mount -t devtmpfs -- none /target/dev +mkdir -p -- /target/dev/pts mountpoint -q /target/dev/pts || mount -t devpts -- /dev/pts /target/dev/pts +mkdir -p -- /target/proc mountpoint -q /target/proc || mount -t proc -- none /target/proc +mkdir -p -- /target/sys mountpoint -q /target/sys || mount -t sysfs -- none /target/sys ## }}} ## Network {{{ ### Get all informations from current network configuration in rescue mode net_device=$(ip r | grep "^default" | head -1 | cut -d" " -f5) +#### TODO: Switch to ip a to get ip address net_address=$(ip r | grep -vE "(^default|metric)" | grep "${net_device}.*src" | head -1 | awk -F" " '{print $NF}') read -r net_mac_address /target/etc/hostname -printf '%b\n' "127.0.0.1 ${new_hostname}" >> /target/etc/hosts +#printf '%b\n' "127.0.0.1 ${new_hostname}" >> /target/etc/hosts ## }}} # }}} @@ -292,7 +287,6 @@ chroot /target passwd # Ensure to umount everything #umount /target/var/lib/vz/ /target/var/ /target/usr/ /target/tmp/ /target/sys/ /target/srv/backup/ /target/srv/ /target/proc/ /target/opt/ /target/home/ /target/dev/pts/ /target/dev /target/boot/ /target/ - printf '%b\n' "${GREEN}The system is still available on /target but you can now try to reboot the hardware.${RESET}" exit 0