aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2019-05-30 20:17:59 -0300
committerEuAndreh <eu@euandre.org>2019-05-30 20:17:59 -0300
commitfb48bdcdc34016a3851a84d17b67f5cac5cdb041 (patch)
treec7618005f9b43da05bc1a5b23bdf5bdf579bbcc5 /scripts
parentTODOs.org (diff)
downloaddotfiles-fb48bdcdc34016a3851a84d17b67f5cac5cdb041.tar.gz
dotfiles-fb48bdcdc34016a3851a84d17b67f5cac5cdb041.tar.xz
Add scripts/burn-nixos.sh
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/burn-nixos.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/burn-nixos.sh b/scripts/burn-nixos.sh
new file mode 100755
index 0000000..7518c1e
--- /dev/null
+++ b/scripts/burn-nixos.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+
+NIXOS_URL="$1"
+USB_STICK="$2"
+ISO_PATH='/tmp/nixos.iso'
+
+yellow "Downloading NixOS ISO..."
+wget -O "${ISO_PATH}" "${NIXOS_URL}"
+wget -O "${ISO_PATH}.sha256" "${NIXOS_URL}.sha256"
+diff <(sha256sum "${ISO_PATH}" | awk '{print $1}') <(awk '{print $1}' < "${ISO_PATH}.sha256") || {
+ red "SHA256 didn't match!"
+ exit 1
+}
+green "Done. SHA256 match."
+
+yellow "Writing ISO image to ${USB_STICK}. We'll need sudo for it..."
+umount "${USB_STICK}1" ||:
+ls -lahp --color "${ISO_PATH}"
+sudo dd if="${ISO_PATH}" of="${USB_STICK}" status=progress
+green "Done. You can remove the USB stick ${USB_STICK} with no unmounting required."