From e5dbbe5b14d96a6952b73cf04d93bfdbb9d03b9e Mon Sep 17 00:00:00 2001 From: Gardouille Date: Tue, 2 Apr 2019 18:07:53 +0200 Subject: [PATCH] Init chroot.install Only prepare hard disk partitions right now. --- debian/chroot.install | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 debian/chroot.install diff --git a/debian/chroot.install b/debian/chroot.install new file mode 100755 index 0000000..36f53b1 --- /dev/null +++ b/debian/chroot.install @@ -0,0 +1,33 @@ +#!/bin/sh + +# Vars +## Define the hard drive to use +if [ -b '/dev/sda' ]; then + hdd="/dev/sda" +else + printf '%b\n' "Please check the hard drive to use" + exit 0 +fi +## Volume Group name to use for LVM +vgname="ovhsys" + +# 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 + +## 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 + +## }}} +# }}}