From 743842268327b5fd12ba4d19b6260d47535976a3 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 28 Dec 2015 10:58:13 +0100 Subject: k 5 default: populate supports infesting arg by setting infesting for populate, data will be written to /mnt instead of root. --- krebs/default.nix | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'krebs/default.nix') diff --git a/krebs/default.nix b/krebs/default.nix index ad0205426..81ddd3ea6 100644 --- a/krebs/default.nix +++ b/krebs/default.nix @@ -36,6 +36,7 @@ let out = { { system ? current-host-name , target ? system }@args: let + config = get-config system; in '' #! /bin/sh # ${current-date} ${current-user-name}@${current-host-name} @@ -47,6 +48,10 @@ let out = { ${builtins.readFile ./4lib/infest/install-nix.sh} ''} + # Prepare target source via bind-mounting + + (${populate (args // { infesting = true;}) }) + (${nixos-install args}) ${rootssh target '' @@ -98,7 +103,6 @@ let out = { #! /bin/sh # ${current-date} ${current-user-name}@${current-host-name} # krebs.nixos-install - (${populate args}) ${rootssh target '' export PATH; PATH=/root/.nix-profile/bin:$PATH @@ -205,6 +209,7 @@ let out = { populate = { system ? current-host-name , target ? system + , infesting ? false }@args: let out = '' #! /bin/sh @@ -217,6 +222,8 @@ let out = { ["dir" "git"])} ''; + + target_prefix=lib.optionalString infesting "/mnt"; config = get-config system; current-host = config.krebs.hosts.${current-host-name}; @@ -225,17 +232,18 @@ let out = { methods.dir = config: let can-push = config.host.name == current-host.name; + target-path = target_prefix + config.target-path; push-method = '' rsync \ --exclude .git \ --exclude .graveyard \ --exclude old \ --exclude tmp \ - --rsync-path='mkdir -p ${config.target-path} && rsync' \ + --rsync-path='mkdir -p ${target-path} && rsync' \ --delete-excluded \ -vrLptgoD \ ${config.path}/ \ - root@${target}:${config.target-path} + root@${target}:${target-path} ''; in if can-push then push-method else @@ -244,9 +252,10 @@ let out = { throw "No way to push ${dir} from ${current-host.name} to ${target}"; methods.git = config: - rootssh target '' - mkdir -p ${config.target-path} - cd ${config.target-path} + let target-path = target_prefix + config.target-path; + in rootssh target '' + mkdir -p ${target-path} + cd ${target-path} if ! test -e .git; then git init fi -- cgit v1.2.3 From f916b84ebd6629d7471f50fbb468161285f5026e Mon Sep 17 00:00:00 2001 From: makefu Date: Sat, 2 Jan 2016 17:31:06 +0100 Subject: k default: root path for populate --- krebs/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'krebs/default.nix') diff --git a/krebs/default.nix b/krebs/default.nix index 81ddd3ea6..15d0e8e2e 100644 --- a/krebs/default.nix +++ b/krebs/default.nix @@ -50,7 +50,6 @@ let out = { # Prepare target source via bind-mounting - (${populate (args // { infesting = true;}) }) (${nixos-install args}) @@ -103,6 +102,7 @@ let out = { #! /bin/sh # ${current-date} ${current-user-name}@${current-host-name} # krebs.nixos-install + (${populate (args // { root = "/mnt"; })}) ${rootssh target '' export PATH; PATH=/root/.nix-profile/bin:$PATH @@ -209,7 +209,7 @@ let out = { populate = { system ? current-host-name , target ? system - , infesting ? false + , root ? "" }@args: let out = '' #! /bin/sh @@ -223,7 +223,6 @@ let out = { ''; - target_prefix=lib.optionalString infesting "/mnt"; config = get-config system; current-host = config.krebs.hosts.${current-host-name}; @@ -232,7 +231,7 @@ let out = { methods.dir = config: let can-push = config.host.name == current-host.name; - target-path = target_prefix + config.target-path; + target-path = root + config.target-path; push-method = '' rsync \ --exclude .git \ @@ -252,7 +251,7 @@ let out = { throw "No way to push ${dir} from ${current-host.name} to ${target}"; methods.git = config: - let target-path = target_prefix + config.target-path; + let target-path = root + config.target-path; in rootssh target '' mkdir -p ${target-path} cd ${target-path} -- cgit v1.2.3