mirror of https://github.com/Sonarr/Sonarr
Also force branch if an external updater is used.
This commit is contained in:
parent
565e625e21
commit
524048c4b4
|
@ -1,4 +1,5 @@
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
|
@ -48,6 +49,17 @@ namespace NzbDrone.Core.Update
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_deploymentInfoProvider.IsExternalUpdateMechanism)
|
||||||
|
{
|
||||||
|
var currentBranch = _configFileProvider.Branch;
|
||||||
|
var packageBranch = _deploymentInfoProvider.PackageBranch;
|
||||||
|
if (packageBranch.IsNotNullOrWhiteSpace() & packageBranch != currentBranch)
|
||||||
|
{
|
||||||
|
_logger.Info("External updater uses branch {0} instead of the currently selected {1}, changing to {0}.", packageBranch, currentBranch);
|
||||||
|
ChangeBranch(packageBranch);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChangeUpdateMechanism(UpdateMechanism updateMechanism)
|
private void ChangeUpdateMechanism(UpdateMechanism updateMechanism)
|
||||||
|
@ -58,5 +70,14 @@ namespace NzbDrone.Core.Update
|
||||||
};
|
};
|
||||||
_configFileProvider.SaveConfigDictionary(config);
|
_configFileProvider.SaveConfigDictionary(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ChangeBranch(string branch)
|
||||||
|
{
|
||||||
|
var config = new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
[nameof(_configFileProvider.Branch)] = branch
|
||||||
|
};
|
||||||
|
_configFileProvider.SaveConfigDictionary(config);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue