Browse Source

init

master
Robin Thoni 8 years ago
commit
6a7c20bf1a
1 changed files with 34 additions and 0 deletions
  1. 34
    0
      dd_prololive.sh

+ 34
- 0
dd_prololive.sh View File

@@ -0,0 +1,34 @@
1
+#! /usr/bin/env sh
2
+
3
+if [ $# -ne 1 ]
4
+then
5
+  echo "Usage: $0 sdx" >&2
6
+  exit 64
7
+fi
8
+
9
+disk="/dev/$1"
10
+partition=3
11
+
12
+if [ ! -b "${disk}" ]
13
+then
14
+  echo "${disk} does not exists or is not a valid device" >&2
15
+  exit 1
16
+fi
17
+
18
+echo "Copying image..."
19
+dd if=prololive.img of="${disk}" || {
20
+  echo "Failed to copy image" >&2
21
+  exit 2
22
+}
23
+
24
+echo "Creating data partition..."
25
+echo "n\np\n${partition}\n\n\nw\n" | sudo fdisk "${disk}" || {
26
+  echo "Failed to create data partition" >&2
27
+  exit 3
28
+}
29
+
30
+echo "Creating data partition filesystem..."
31
+sudo mkfs.fat -n data -F 32 "${disk}${partition}" || {
32
+  echo "Failed to create data partition filesystem" >&2
33
+  exit 4
34
+}

Loading…
Cancel
Save