From f4a23ea078c385fd3f9bfe23f935cd6886d4571d Mon Sep 17 00:00:00 2001 From: jeschli Date: Tue, 9 Jan 2018 22:04:02 +0100 Subject: infest prepare: add _which --- krebs/4lib/infest/prepare.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/krebs/4lib/infest/prepare.sh b/krebs/4lib/infest/prepare.sh index 4179d8294..ee5f334c7 100644 --- a/krebs/4lib/infest/prepare.sh +++ b/krebs/4lib/infest/prepare.sh @@ -94,11 +94,14 @@ prepare_nixos_iso() { mkdir -p bin rm -f bin/nixos-install - cp "$(type -p nixos-install)" bin/nixos-install + cp "$(_which nixos-install)" bin/nixos-install sed -i "s@NIX_PATH=\"[^\"]*\"@NIX_PATH=$target_path@" bin/nixos-install } prepare_hetzner_rescue() { + _which() ( + which "$1" + ) mountpoint /mnt type bzip2 2>/dev/null || apt-get install bzip2 @@ -138,6 +141,9 @@ EOF } prepare_common() {( + _which() ( + type -p "$1" + ) _prepare_nix_users @@ -245,7 +251,7 @@ _prepare_nixos_install() { mkdir -p bin rm -f bin/nixos-install - cp "$(type -p nixos-install)" bin/nixos-install + cp "$(_which nixos-install)" bin/nixos-install sed -i "s@NIX_PATH=\"[^\"]*\"@NIX_PATH=$target_path@" bin/nixos-install if ! grep -q '^PATH.*#krebs' .bashrc; then -- cgit v1.2.3