From fb48bdcdc34016a3851a84d17b67f5cac5cdb041 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 30 May 2019 20:17:59 -0300 Subject: Add scripts/burn-nixos.sh --- TODOs.org | 3 ++- scripts/burn-nixos.sh | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 scripts/burn-nixos.sh diff --git a/TODOs.org b/TODOs.org index 52748f0..0d1dc58 100644 --- a/TODOs.org +++ b/TODOs.org @@ -1,6 +1,7 @@ * Tasks ** TODO Simplify the installation of NixOS -*** TODO Preparation phase +*** DONE Preparation phase +CLOSED: [2019-05-30 Thu 20:17] Create =burn-nixos.sh= with something like: #+BEGIN_SOURCE shell NIXOS_URL='https://releases.nixos.org/nixos/19.03/nixos-19.03.172764.50d5d73e22b/nixos-graphical-19.03.172764.50d5d73e22b-x86_64-linux.iso' 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." -- cgit v1.2.3