From 0fa8921e803876d85e1a0d49d925c2919714ee56 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 24 Jun 2015 20:00:52 +0200 Subject: infest-cac-CentOS-7-64bit: fetchgit --- newbin/fetchgit | 25 +++++++++++++++++++++++++ newbin/nixos-query | 8 ++++++++ 2 files changed, 33 insertions(+) create mode 100755 newbin/fetchgit create mode 100755 newbin/nixos-query (limited to 'newbin') diff --git a/newbin/fetchgit b/newbin/fetchgit new file mode 100755 index 000000000..b9fe90854 --- /dev/null +++ b/newbin/fetchgit @@ -0,0 +1,25 @@ +#! /bin/sh +# usage: fetchgit REVISION URL WORKTREE +set -euf + +git_rev=$1 +git_url=$2 +worktree=$3 + +if [ ! -d "$worktree" ]; then + mkdir -p "$worktree" +fi + +cd "$worktree" + +git init -q + +if ! current_url=$(git config remote.src.url); then + git remote add src "$git_url" +elif [ "$current_url" != "$git_url" ]; then + git remote set-url src "$git_url" +fi + +git fetch src + +git checkout "$git_rev" diff --git a/newbin/nixos-query b/newbin/nixos-query new file mode 100755 index 000000000..57761b520 --- /dev/null +++ b/newbin/nixos-query @@ -0,0 +1,8 @@ +#! /bin/sh +set -euf +nix-instantiate \ + -A config."$1" \ + --eval \ + --json \ + '' \ + | jq -r . -- cgit v1.2.3