#!/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 \ mkpart ESP fat32 1MiB 120MiB \ mkpart primary ext4 120MiB 376MiB \ mkpart primary ext4 376MiB 4376MiB \ mkpart primary ext4 4376MiB 5000MiB \ set 1 boot on exit 0;