diff options
author | tv <tv@shackspace.de> | 2015-10-22 00:23:02 +0200 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-10-22 00:25:24 +0200 |
commit | 4b8ffc1bfd494de1fafde2527a337ad5eb31a27c (patch) | |
tree | 475fae06816a49adaedf03046dd1a3a74ad36f15 /krebs/default.nix | |
parent | fc64fd18cb8677f08d038a086de879fd69f89b8c (diff) |
krebs.nixos-install: fail if pkg cannot be found
Collaterally, search in /nix instead of /mnt/nix
Diffstat (limited to 'krebs/default.nix')
-rw-r--r-- | krebs/default.nix | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/krebs/default.nix b/krebs/default.nix index 08de72294..40d245f98 100644 --- a/krebs/default.nix +++ b/krebs/default.nix @@ -132,16 +132,20 @@ let out = { s:.*\(/nix/store/[a-z0-9]*-nix-[0-9.]\+/bin/nix-env\).*:\1:p;T;q ') echo "nix-env is $nix_env" >&2 - getchrootpath() {( + findpkg() {( name=$1 - path=$(find /mnt/nix/store \ + path=$(find /nix/store \ -mindepth 1 -maxdepth 1 -type d -name '*-'"$name"'-*' \ | head -n 1 | sed s:^/mnt::) - echo "$name is $path" >&2 - echo "$path" + if echo "$path" | grep .; then + echo "$name is $path" >&2 + else + echo "Error: package not found: $name" >&2 + exit 1 + fi )} - cacert=$(getchrootpath cacert) - coreutils=$(getchrootpath coreutils) + cacert=$(findpkg cacert) + coreutils=$(findpkg coreutils) env="$coreutils/bin/env \ SSL_CERT_FILE=$cacert/etc/ssl/certs/ca-bundle.crt" sed -i ' |