nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1local role_post
2getHostRole
3
4# Compare the requested deployment target to the existing one. The deployment target has to be a version number,
5# and this hook tries to do the right thing with deployment targets set outside of it, so it has to parse
6# the version numbers for the comparison manually.
7
8local darwinMinVersion=@deploymentTarget@
9local darwinMinVersionVar=@darwinMinVersionVariable@${role_post}
10
11local currentDeploymentTargetArr
12IFS=. read -a currentDeploymentTargetArr <<< "${!darwinMinVersionVar-0.0.0}"
13
14local darwinMinVersionArr
15IFS=. read -a darwinMinVersionArr <<< "$darwinMinVersion"
16
17local currentDeploymentTarget
18currentDeploymentTarget=$(printf "%02d%02d%02d" "${currentDeploymentTargetArr[0]-0}" "${currentDeploymentTargetArr[1]-0}" "${currentDeploymentTargetArr[2]-0}")
19
20darwinMinVersion=$(printf "%02d%02d%02d" "${darwinMinVersionArr[0]-0}" "${darwinMinVersionArr[1]-0}" "${darwinMinVersionArr[2]-0}")
21
22if [ "$darwinMinVersion" -gt "$currentDeploymentTarget" ]; then
23 export "$darwinMinVersionVar"=@deploymentTarget@
24fi
25
26unset -v role_post currentDeploymentTarget currentDeploymentTargetArr darwinMinVersion darwinMinVersionArr darwinMinVersionVar