Avoid to mount tmpfs before debootstrap
This commit is contained in:
parent
f90a1dee19
commit
f5d03149b3
|
@ -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 </sys/class/net/"${net_device}"/address
|
||||
net_netmask=$(ipcalc "${net_address}" | awk '/Netmask:/{print $2;}')
|
||||
|
@ -264,7 +259,7 @@ chroot /target update-grub
|
|||
## }}}
|
||||
## Hostname {{{
|
||||
printf '%b\n' "${new_hostname}" > /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
|
||||
|
|
Loading…
Reference in New Issue