Test if the script should manage partitions

This commit is contained in:
Jeremy Gardais 2019-04-02 18:30:31 +02:00
parent e5dbbe5b14
commit d04ed9310b
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 19 additions and 15 deletions

34
debian/chroot.install vendored
View File

@ -10,24 +10,28 @@ else
fi fi
## Volume Group name to use for LVM ## Volume Group name to use for LVM
vgname="ovhsys" vgname="ovhsys"
## If the script should manage the partitions (delete, add,…)
manage_part=0
# Partitionning {{{ # Partitionning {{{
## Remove all old partitions if [ "${manage_part}" -eq 0 ]; then
for part_number in 1 2 3 4 5 6 7 8; do ## Remove all old partitions
[ -b "${hdd}""${part_number}" ] && parted "${hdd}" rm "${part_number}" for part_number in 1 2 3 4 5 6 7 8; do
done [ -b "${hdd}""${part_number}" ] && parted "${hdd}" rm "${part_number}"
done
## Recreate partition (/boot and LV) {{{ ## Recreate partition (/boot and LV) {{{
### Partition type ### Partition type
parted "${hdd}" mklabel msdos parted "${hdd}" mklabel msdos
### /boot ### /boot
parted "${hdd}" mkpart primary 0% 512MB parted "${hdd}" mkpart primary 0% 512MB
parted "${hdd}" set 1 boot on parted "${hdd}" set 1 boot on
### LV ### LV
parted "${hdd}" mkpart primary 4194kB 100% parted "${hdd}" mkpart primary 4194kB 100%
parted "${hdd}" set 2 lvm on parted "${hdd}" set 2 lvm on
sudo pvcreate "${hdd}"2 sudo pvcreate "${hdd}"2
sudo vgcreate "${vgname}" ${hdd}2 sudo vgcreate "${vgname}" ${hdd}2
fi
## }}} ## }}}
# }}} # }}}