From 33d25dba1260a9735e2e84c0bebbb459ca0ee6db Mon Sep 17 00:00:00 2001 From: Gardouille Date: Mon, 5 Aug 2019 15:12:14 +0200 Subject: [PATCH] =?UTF-8?q?Add=20possibility=20to=20disable=20extra=20lv?= =?UTF-8?q?=20(backup,=20vz,=E2=80=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/chroot.install | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/debian/chroot.install b/debian/chroot.install index b00e4d8..a936bcf 100755 --- a/debian/chroot.install +++ b/debian/chroot.install @@ -17,6 +17,8 @@ vgname="ovhsys" manage_part=0 ## If the script should use BTRFS manage_btrfs=1 +## If the script should create extra volume (eg. backup, virt, Proxmox,…) +manage_extra_lv=0 ## Colors definition {{{ BLACK='\033[49;30m' BLACKB='\033[49;90m' @@ -79,8 +81,10 @@ else [ ! -b /dev/mapper/"${vgname}"-var ] && lvcreate -n var -L 10g "${vgname}" fi ### Create extra LVs -[ ! -b /dev/mapper/"${vgname}"-vz ] && lvcreate -n vz -L 150g "${vgname}" -[ ! -b /dev/mapper/"${vgname}"-bkp ] && lvcreate -n bkp -L 150g "${vgname}" +if [ "${manage_extra_lv}" -eq 0 ]; then + [ ! -b /dev/mapper/"${vgname}"-vz ] && lvcreate -n vz -L 150g "${vgname}" + [ ! -b /dev/mapper/"${vgname}"-bkp ] && lvcreate -n bkp -L 150g "${vgname}" +fi [ ! -b /dev/mapper/"${vgname}"-swap ] && lvcreate -n swap -L 2g "${vgname}" ### Format LVs in ext4 @@ -147,14 +151,16 @@ else ### Or for ext4, create mountpoint and mount LV printf '%b\n' "/dev/mapper/${vgname}-var /var ext4 defaults 0 0" >> /tmp/target.fstab fi -### Extra bkp LV -mkdir -p -- /target/srv/backup -mountpoint -q /target/srv/backup || mount -- /dev/mapper/"${vgname}"-bkp /target/srv/backup -printf '%b\n' "/dev/mapper/${vgname}-bkp /srv/backup ext4 defaults 0 0" >> /tmp/target.fstab -### Extra vz LV -mkdir -p -- /target/var/lib/vz -mountpoint -q /target/var/lib/vz || mount -- /dev/mapper/"${vgname}"-vz /target/var/lib/vz -printf '%b\n' "/dev/mapper/${vgname}-vz /var/lib/vz ext4 defaults 0 0" >> /tmp/target.fstab +if [ "${manage_extra_lv}" -eq 0 ]; then + ### Extra bkp LV + mkdir -p -- /target/srv/backup + mountpoint -q /target/srv/backup || mount -- /dev/mapper/"${vgname}"-bkp /target/srv/backup + printf '%b\n' "/dev/mapper/${vgname}-bkp /srv/backup ext4 defaults 0 0" >> /tmp/target.fstab + ### Extra vz LV + mkdir -p -- /target/var/lib/vz + mountpoint -q /target/var/lib/vz || mount -- /dev/mapper/"${vgname}"-vz /target/var/lib/vz + printf '%b\n' "/dev/mapper/${vgname}-vz /var/lib/vz ext4 defaults 0 0" >> /tmp/target.fstab +fi ### Swap swapon -- /dev/mapper/"${vgname}"-swap