示例#1
0
        public static SystemUpdateInfo GetUpdateInfo(SshClient sshClient)
        {
            var info = new SystemUpdateInfo();

            var running = sshClient.CreateCommand("sudo freebsd-version").Execute().Replace("\n", "");

            var latestMinorVersion = GetLatestMinorVersion(sshClient);

            var runningVersionOnly = sshClient.CreateCommand("sudo freebsd-version | cut -d \"-\" -f 1").Execute().Replace("\n", "");

            var latestVersion = GetLatestVersion(sshClient);

            info.CurrentVersion = running;

            if (running != latestMinorVersion)
            {
                info.Description = $"Update {running} to {latestMinorVersion}";
                info.CanUpdate   = true;
                info.HasUpdate   = true;
                info.NewVersion  = latestMinorVersion;
            }
            else if (runningVersionOnly != latestVersion)
            {
                info.Description = $"{info.Description} \n System has new version {latestVersion} available. Major version updates are not supported in PACO.";
                info.HasUpdate   = true;
            }

            info.Description = info.Description?.Trim();

            return(info);
        }
示例#2
0
        public SystemUpdateInfo GetInformationAboutSystemUpdate(ManagedSystem system)
        {
            Logger.LogInformation("Getting update info for {system}.", system.Name);

            SystemUpdateInfo updateInfo = null;

            ExecuteWorkWithSystem(system, managedSystem =>
            {
                updateInfo = GetDistributionManager(managedSystem).GetInformationAboutSystemUpdate();
            });

            return(updateInfo);
        }