From cc7cc25f85804849fe8a65d6dde3ee683063c3bd Mon Sep 17 00:00:00 2001 From: Nikhil Jha Date: Feb 18 2020 01:52:15 +0000 Subject: Drive partitioning script UNTESTED --- diff --git a/01-partition-drive.sh b/01-partition-drive.sh new file mode 100644 index 0000000..a8c4aaa --- /dev/null +++ b/01-partition-drive.sh @@ -0,0 +1,69 @@ +#!/bin/bash +set -e + +echo "=====================" +echo "01-partition-drive.sh" +echo "=====================" + +# Functions +infecho () { + echo "[Info] $1" +} +errecho () { + echo $1 1>&2 +} + +# Notify User +infecho "The env vars that will be used in this script..." +infecho "PP_SD_DEVICE = $PP_SD_DEVICE" +PP_PARTA = ${PP_SD_DEVICE}1 +PP_PARTB = ${PP_SD_DEVICE}2 + +# Automatic Preflight Checks +if [[ $EUID -ne 0 ]]; then + errecho "This script must be run as root!" + exit 1 +fi + +# Warning +echo "=== WARNING WARNING WARNING ===" +infecho "This script WILL ERASE ALL DATA on $PP_SD_DEVICE." +infecho "Also, I didn't test this so it might also cause WWIII or something." +infecho "I'm not responsible for anything that happens, you should read the script first." +echo "=== WARNING WARNING WARNING ===" +echo +read -p "Continue? [y/N] " -n 1 -r +echo +if [[ $REPLY =~ ^[Yy]$ ]] +then + infecho "Begining drive partition..." + sfdisk $PP_SD_DEVICE <