about summary refs log tree commit diff
path: root/scripts/install-nix-from-closure.sh
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2016-04-12T11·33-0400
committerShea Levy <shea@shealevy.com>2016-04-12T11·33-0400
commit1b3e704fb9d4847965334e63b764f1cc7c1363c4 (patch)
tree0170825ea8d1c4dc7bf8448dbeb12c7a7e48b930 /scripts/install-nix-from-closure.sh
parent867967265b80946dfe1db72d40324b4f9af988ed (diff)
parentef00999fb77a0ca81c48d6a288822dea90dd6ace (diff)
Merge branch 'patch-2' of git://github.com/wmertens/nix
install-nix-from-closure improvments
Diffstat (limited to 'scripts/install-nix-from-closure.sh')
-rw-r--r--scripts/install-nix-from-closure.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/install-nix-from-closure.sh b/scripts/install-nix-from-closure.sh
index bef5cd4f15fa..a6966c414945 100644
--- a/scripts/install-nix-from-closure.sh
+++ b/scripts/install-nix-from-closure.sh
@@ -1,4 +1,4 @@
-#! /usr/bin/env bash
+#!/bin/sh
 
 set -e
 
@@ -49,7 +49,10 @@ for i in $(cd $self/store >/dev/null && echo *); do
     fi
     if ! [ -e "$dest/store/$i" ]; then
         cp -Rp "$self/store/$i" "$i_tmp"
+        chmod -R a-w "$i_tmp"
+        chmod +w "$i_tmp"
         mv "$i_tmp" "$dest/store/$i"
+        chmod -w "$dest/store/$i"
     fi
 done
 echo "" >&2
@@ -65,6 +68,11 @@ if ! $nix/bin/nix-store --load-db < $self/.reginfo; then
     exit 1
 fi
 
+if ! $nix/bin/nix-store --verify; then
+    echo "$0: store verification failed! Consider deleting /nix and starting over" >&2
+    exit 1
+fi
+
 . $nix/etc/profile.d/nix.sh
 
 if ! $nix/bin/nix-env -i "$nix"; then