From d04ed9310b1063f9f4992777e9338d8b4b46e685 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Tue, 2 Apr 2019 18:30:31 +0200 Subject: [PATCH] Test if the script should manage partitions --- debian/chroot.install | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/debian/chroot.install b/debian/chroot.install index 36f53b1..dc6439d 100755 --- a/debian/chroot.install +++ b/debian/chroot.install @@ -10,24 +10,28 @@ else fi ## Volume Group name to use for LVM vgname="ovhsys" +## If the script should manage the partitions (delete, add,…) +manage_part=0 # Partitionning {{{ -## Remove all old partitions -for part_number in 1 2 3 4 5 6 7 8; do - [ -b "${hdd}""${part_number}" ] && parted "${hdd}" rm "${part_number}" -done +if [ "${manage_part}" -eq 0 ]; then + ## Remove all old partitions + for part_number in 1 2 3 4 5 6 7 8; do + [ -b "${hdd}""${part_number}" ] && parted "${hdd}" rm "${part_number}" + done -## Recreate partition (/boot and LV) {{{ -### Partition type -parted "${hdd}" mklabel msdos -### /boot -parted "${hdd}" mkpart primary 0% 512MB -parted "${hdd}" set 1 boot on -### LV -parted "${hdd}" mkpart primary 4194kB 100% -parted "${hdd}" set 2 lvm on -sudo pvcreate "${hdd}"2 -sudo vgcreate "${vgname}" ${hdd}2 + ## Recreate partition (/boot and LV) {{{ + ### Partition type + parted "${hdd}" mklabel msdos + ### /boot + parted "${hdd}" mkpart primary 0% 512MB + parted "${hdd}" set 1 boot on + ### LV + parted "${hdd}" mkpart primary 4194kB 100% + parted "${hdd}" set 2 lvm on + sudo pvcreate "${hdd}"2 + sudo vgcreate "${vgname}" ${hdd}2 +fi ## }}} # }}}