Add missing file
This commit is contained in:
parent
f290808509
commit
e65a49f00f
29
modules/installer/tools/get-version-suffix
Normal file
29
modules/installer/tools/get-version-suffix
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
getVersion() {
|
||||||
|
local dir="$1"
|
||||||
|
rev=
|
||||||
|
if [ -e "$dir/.git" ]; then
|
||||||
|
if [ -z "$(type -P git)" ]; then
|
||||||
|
echo "warning: Git not found; cannot figure out revision of $dir" >&2
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
cd "$dir"
|
||||||
|
rev=$(git rev-parse --short HEAD)
|
||||||
|
if git describe --always --dirty | grep -q dirty; then
|
||||||
|
rev+=M
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if nixos=$(nix-instantiate --find-file nixos "$@"); then
|
||||||
|
getVersion $nixos
|
||||||
|
if [ -n "$rev" ]; then
|
||||||
|
suffix="pre-$rev"
|
||||||
|
if nixpkgs=$(nix-instantiate --find-file nixpkgs "$@"); then
|
||||||
|
getVersion $nixpkgs
|
||||||
|
if [ -n "$rev" ]; then
|
||||||
|
suffix+="-$rev"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo $suffix
|
||||||
|
fi
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user