init tuto2: new option to format the drive in bootloader

This commit is contained in:
nemunaire 2019-03-15 19:09:15 +01:00
parent 84f23281fd
commit 8c881b0e3a
2 changed files with 8 additions and 8 deletions

View File

@ -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 <CMDLINE> adlin.format=/dev/sda root=/dev/sda1 root=/dev/sr0
LABEL tutorial-hdd
MENU LABEL Enter tutorial without erasing ^disk
KERNEL /boot/kernel
APPEND <CMDLINE> root=/dev/sda1 root=/dev/sr0
APPEND <CMDLINE> 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 <CMDLINE> adlin.format=/dev/sda adlin.alwaysformat=yes root=/dev/sda1 root=/dev/sr0
MENU SEPARATOR

View File

@ -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; }
}