dotnet-sdk: add updateScript

This update script calls the existing update.sh script with the proper
arguments. If not an SDK package, run a dummy script which allows the update.nix
script to work properly.
This should allow dotnet to be update automatically.
This commit is contained in:
mdarocha 2022-09-19 22:13:11 +02:00
parent d917c76850
commit 328fe32161

View file

@ -23,6 +23,7 @@ assert if type == "sdk" then packages != null else true;
, lttng-ust_2_12
, testers
, runCommand
, writeShellScript
}:
let
@ -121,6 +122,24 @@ stdenv.mkDerivation (finalAttrs: rec {
"aarch64-darwin" = "osx-arm64";
};
updateScript =
if type != "sdk" then
lib.warn "${pname}-${version}: only the SDK package can be updated - this script will do nothing!"
writeShellScript "dummy-update" ''
echo "Doing nothing..."
echo "Run the updateScript from the SDK package"
''
else
let
majorVersion =
with lib;
concatStringsSep "." (take 2 (splitVersion version));
in
writeShellScript "update-dotnet-${majorVersion}" ''
pushd pkgs/development/compilers/dotnet
exec ${./update.sh} "${majorVersion}"
'';
# Convert a "stdenv.hostPlatform.system" to a dotnet RID
systemToDotnetRid = system: runtimeIdentifierMap.${system} or (throw "unsupported platform ${system}");