From ea717c0a75047d188f6101968e28bfa4cdc30dcf Mon Sep 17 00:00:00 2001 From: Gardouille Date: Wed, 3 Apr 2019 10:41:51 +0200 Subject: [PATCH] Create disk/partitions on target system --- debian/chroot.install | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/debian/chroot.install b/debian/chroot.install index 6e87c6f..fdad55d 100755 --- a/debian/chroot.install +++ b/debian/chroot.install @@ -114,3 +114,23 @@ mountpoint -q /target/sys || mount -o bind -- /sys /target/sys debootstrap --arch amd64 --include="${dbs_pkg_include}" --exclude="${dbs_pkg_exclude}" stretch /target http://ftp.fr.debian.org/debian # }}} +# Configure system {{{ +## Create the disk/partitions (eg. /dev/sda, /dev/sda1,…) on the target system {{{ +### Create the disk +[ -b /target"${hdd}" ] || mknod --mode=660 /target"${hdd}" b 8 0 + +### Count the number of partitions on the rescue system +nb_part=$(ls -l -- "${hdd}"? | wc -l) +part=1 +### Start at 1 and less/equal $nb_part +while [ "${part}" -le "${nb_part}" ]; do + #### Create the partitions on the target system + [ -b /target"${hdd}${part}" ] || mknod --mode=660 /target"${hdd}${part}" b 8 "${part}" + (( part++ )) +done + +### Fix group of disk/partitions +chgrp disk -- /target"${hdd}"* +## }}} + +# }}}