From eb0797b7edcdfd6b01e5c99735799ccfdbf12153 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 13 Feb 2016 16:22:23 +0100 Subject: krebs/4lib/infest/prepare.sh: recognize NixOS ISO --- krebs/4lib/infest/prepare.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'krebs/4lib') diff --git a/krebs/4lib/infest/prepare.sh b/krebs/4lib/infest/prepare.sh index d9271da73..b3824c7d4 100644 --- a/krebs/4lib/infest/prepare.sh +++ b/krebs/4lib/infest/prepare.sh @@ -36,6 +36,13 @@ prepare() {( ;; esac ;; + nixos) + case $(cat /proc/cmdline) in + *' root=LABEL=NIXOS_ISO '*) + prepare_nixos_iso "$@" + exit + esac + ;; esac elif test -e /etc/centos-release; then case $(cat /etc/centos-release) in @@ -73,6 +80,24 @@ prepare_debian() { prepare_common } +prepare_nixos_iso() { + mountpoint /mnt + + type git 2>/dev/null || nix-env -iA nixos.git + + mkdir -p /mnt/"$target_path" + mkdir -p "$target_path" + + if ! mountpoint "$target_path"; then + mount --rbind /mnt/"$target_path" "$target_path" + fi + + mkdir -p bin + rm -f bin/nixos-install + cp "$(type -p nixos-install)" bin/nixos-install + sed -i "s@^NIX_PATH=\"[^\"]*\"@NIX_PATH=$target_path@" bin/nixos-install +} + prepare_common() {( if ! getent group nixbld >/dev/null; then -- cgit v1.2.3