summaryrefslogtreecommitdiffstats
path: root/krebs/4lib/infest
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-02-13 16:22:23 +0100
committertv <tv@krebsco.de>2016-02-13 16:22:23 +0100
commiteb0797b7edcdfd6b01e5c99735799ccfdbf12153 (patch)
tree671c4da9fe3431b917a46df9c6b0b18f2addc958 /krebs/4lib/infest
parent67b77ae4d7626d6007cc8e0726ca3b8239429681 (diff)
krebs/4lib/infest/prepare.sh: recognize NixOS ISO
Diffstat (limited to 'krebs/4lib/infest')
-rw-r--r--krebs/4lib/infest/prepare.sh25
1 files changed, 25 insertions, 0 deletions
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