summaryrefslogtreecommitdiffstats
path: root/nix-script-diff-generations.sh
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2015-07-11 15:38:11 +0200
committerMatthias Beyer <mail@beyermatthias.de>2015-07-11 15:38:11 +0200
commitac925c6f77b1248645e9784c15c48203877b77c7 (patch)
tree8571f8df4688c8dc285c3209743346057857dcb1 /nix-script-diff-generations.sh
parent714ea1e88b457b37a180118a1715cdf5cd05938d (diff)
parent1b650cfacfb1a7714fd5e124e0b2f7b6660af4be (diff)
Merge pull request #55 from matthiasbeyer/docv0.1
Doc
Diffstat (limited to 'nix-script-diff-generations.sh')
-rwxr-xr-xnix-script-diff-generations.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/nix-script-diff-generations.sh b/nix-script-diff-generations.sh
index 0df561d..4dd11d2 100755
--- a/nix-script-diff-generations.sh
+++ b/nix-script-diff-generations.sh
@@ -65,6 +65,9 @@ do
esac
done
+#
+# Helper to generate a path for the profile we want to diff with
+#
gen_path() {
[[ $__SYSTEM -eq 1 ]] && echo "/nix/var/nix/profiles/system-${1}-link"
[[ $__USER -eq 1 ]] && echo "/nix/var/nix/profiles/per-user/$USER/profile-${1}-link"
@@ -81,16 +84,24 @@ stdout "from directory : $DIR_A"
stdout "Generation B : $GEN_B"
stdout "from directory : $DIR_B"
+#
+# Error checking whether the generations exist.
+#
[[ -z "$GEN_A" || -z "$GEN_B" ]] && stderr "No generations" && exit 1
[[ ! -e $DIR_A ]] && stderr "Generation $GEN_A does not exist." && exit 1
[[ ! -e $DIR_B ]] && stderr "Generation $GEN_B does not exist." && exit 1
+#
+# Querying the store for the stuff in a generation A
+#
versA=$(mktemp)
stdout "TMP file '$versA' created"
nix-store -qR $DIR_A | sort -t'-' -k 2 > $versA
stdout "Generation packages written for $GEN_A"
-
+#
+# Querying the store for the stuff in a generation B
+#
versB=$(mktemp)
stdout "TMP file '$versB' created"
nix-store -qR $DIR_B | sort -t'-' -k 2 > $versB