#!/bin/sh # First we define the function ConfirmOrExit () { while true do echo -n "Please confirm (y or n) :" read CONFIRM case $CONFIRM in y|Y|YES|yes|Yes) break ;; n|N|no|NO|No) echo "Aborting - you entered $CONFIRM" exit ;; *) echo "Please enter only y or n" esac done echo "You entered $CONFIRM. Continuing ..." } DEV=$1 echo "Device: $DEV\n" ConfirmOrExit parted --script $DEV \ mklabel gpt \ unit mib \ mkpart primary 1 3 \ name 1 grub \ set 1 bios_grub on \ mkpart ESP fat32 3 125 \ name 2 efi \ set 2 boot on \ mkpart primary ext4 125 1128 \ name 3 boot \ mkpart primary ext4 1128 5128 \ name 4 root \ mkpart primary ext4 5128 6128 \ name 5 var \ mkpart primary ext4 6128 14128 \ name 6 usr \ mkpart primary linux-swap 14128 18128 \ name 7 swap \ mkpart primary ext4 18128 100% \ name 8 home exit 0;