summaryrefslogtreecommitdiff
path: root/pkgs/by-name/gc/gclient2nix/gclient-unpack-hook.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/gc/gclient2nix/gclient-unpack-hook.sh')
-rw-r--r--pkgs/by-name/gc/gclient2nix/gclient-unpack-hook.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/pkgs/by-name/gc/gclient2nix/gclient-unpack-hook.sh b/pkgs/by-name/gc/gclient2nix/gclient-unpack-hook.sh
new file mode 100644
index 000000000000..6dac91b9e25a
--- /dev/null
+++ b/pkgs/by-name/gc/gclient2nix/gclient-unpack-hook.sh
@@ -0,0 +1,28 @@
+# shellcheck shell=bash
+
+gclientUnpackHook() {
+ echo "Executing gclientUnpackHook"
+
+ runHook preUnpack
+
+ if [ -z "${gclientDeps-}" ]; then
+ echo "gclientDeps missing"
+ exit 1
+ fi
+
+ for dep in $(@jq@ -c "to_entries[]" "$gclientDeps")
+ do
+ local name="$(echo "$dep" | @jq@ -r .key)"
+ echo "copying $name..."
+ local path="$(echo "$dep" | @jq@ -r .value.path)"
+ mkdir -p $(dirname "$name")
+ cp -r "$path/." "$name"
+ chmod u+w -R "$name"
+ done
+
+ runHook postUnpack
+}
+
+if [ -z "${dontGclientUnpack-}" ] && [ -z "${unpackPhase-}" ]; then
+ unpackPhase=(gclientUnpackHook)
+fi