about summary refs log tree commit diff stats
path: root/core/scripts/setup-target.sh
diff options
context:
space:
mode:
Diffstat (limited to 'core/scripts/setup-target.sh')
-rw-r--r--core/scripts/setup-target.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/core/scripts/setup-target.sh b/core/scripts/setup-target.sh
new file mode 100644
index 0000000..4f38853
--- /dev/null
+++ b/core/scripts/setup-target.sh
@@ -0,0 +1,35 @@
+#!/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 720MiB \
+    mkpart primary ext4 720MiB 2720MiB \
+    mkpart primary ext4 2720MiB 5000MiB \
+    set 1 boot on
+
+exit 0;