From 8c881b0e3a268acad33c719d4d37edd98108fb67 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Fri, 15 Mar 2019 19:09:15 +0100 Subject: [PATCH] init tuto2: new option to format the drive in bootloader --- pkg/debian-tuto2/isolinux.cfg | 12 ++++++------ tuto2.yml | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/debian-tuto2/isolinux.cfg b/pkg/debian-tuto2/isolinux.cfg index 735f25c..f284a06 100644 --- a/pkg/debian-tuto2/isolinux.cfg +++ b/pkg/debian-tuto2/isolinux.cfg @@ -13,15 +13,15 @@ timeout 0 menu title Welcome to the EPITA ADvanced LINux administration course! -LABEL tutorial-nohdd - MENU LABEL ^Erase my first drive if necessary, then enter tutorial - KERNEL /boot/kernel - APPEND adlin.format=/dev/sda root=/dev/sda1 root=/dev/sr0 - LABEL tutorial-hdd MENU LABEL Enter tutorial without erasing ^disk KERNEL /boot/kernel - APPEND root=/dev/sda1 root=/dev/sr0 + APPEND adlin.format=/dev/sda root=/dev/sda1 root=/dev/sr0 + +LABEL tutorial-forceformat + MENU LABEL ^Erase my first drive, then enter tutorial + KERNEL /boot/kernel + APPEND adlin.format=/dev/sda adlin.alwaysformat=yes root=/dev/sda1 root=/dev/sr0 MENU SEPARATOR diff --git a/tuto2.yml b/tuto2.yml index 352c00b..4ad8664 100644 --- a/tuto2.yml +++ b/tuto2.yml @@ -67,9 +67,9 @@ files: echo "rootfs=$ROOTFS" [ -z "$ROOTFS" ] && { echo "No root= provided, continuing on initramfs only."; exec "${INITP}"; } [ "$ROOTFS" = "/dev/sr0" ] && { echo "No root= provided, continuing on initramfs only."; exec "${INITP}"; } - [ -b "$ROOTFS" ] || { + [ -b "$ROOTFS" -a -z "$(cmdline adlin.alwaysformat)" ] || { FORMATDD=$(cmdline adlin.format) - [ -b "$FORMATDD" ] && { echo "o\nn\np\n1\n\n\np\nw\nq\n" | fdisk "${FORMATDD}" && mkfs.ext4 "$FORMATDD"1; } + [ -b "$FORMATDD" ] && { echo "o\nn\np\n1\n\n\np\nw\nq\n" | fdisk "${FORMATDD}" && mkfs.ext4 -q "$FORMATDD"1; } [ -b "$ROOTFS" ] || { echo "Invalid provided rootfs: not a valid block device."; exit 1; } }