Package: update-linux
update-linux commandCommand to automate the routine updating of packages and system upgrading for Unix systems.update-linuk can check for updates (--check), install updates (--update) and do a system upgrade (--system-upgrade).Supports Fedora like and Debian Like OS.Fedora like includes Fedora, RHEL, Centos, Rocky etc that use DNF.Debian like includes Dedian, Ubuntu etc that use apt.update-linux uses ssh to run commands on the hosts being worked on.It assumes that it canssh root@<host>without a password prompt.However when using the --self option to update localhost sudo will be used if not running as root. This will prompt for the sudo password as necessary.
Normally update-linux will reboot a host if that is required, but when working on --self no reboot is done unless --force-reboot is used.If running update-linux on a macOS system it is necessary to flush DNS so that freshly booted hosts can be accessed by host-name.This is done with the commandsudo killall -HUP mDNSResponder.update-linux will refuse to update the host it is running on unless the -self options is used.Normally a reboot is done at the conclusion of an update unless update-linux can determine that the reboot is not required.update-linux update process$ update-linux --update hostFor an update the following steps are performed:Update packages  - if there is nothing to update stop hereFedora:dnf -vy update --refreshDebian:apt-get update --assume-yesthenapt-get upgrade --assume-yesWait until all systemd jobs have finishedsystemctl list-jobsFor example akmod building nvidia drivers for a new kernelCheck if a reboot is needed.dnf needs-restart -rReboot the hostrebootReport on state of any failed servicessystemctl --failedudpate-linux check for updates$ update-linux host --checkWith the--checkoptions these steps are performed:Check if there are packages to updateFedora:dnf check-update --refreshDebian:apt-get update --assume-yesthenapt-get upgrade --assume-noReport on state of any failed services. Not possible upgrading localhost with --self.systemctl --failedupdate-linux system-upgrade process$ update-linux --system-upgrade=38 hostFor a system-upgrade update-linux will update one release at a time.This means that a host running Fedora 36 that is being upgraded to Fedora 38 will first be upgraded to Fedora 37.This is done as it is the safer then attempting skip over releases that can have required side-effects.Run theupdate-linux --system-upgradeonce for each release that is be upgraded.For a system-upgrade these steps are used:Check the current version of the Fedora installation against the requested version.If the host is already running the requested version stop here.Download packagesdnf system-upgrade download --releasever=<version> --assumeyesReboot to run the system-upgradednf system-upgrade rebootWait for the system to rebootThere is a limit of 45 minutes to wait for the rebootReport on state of any failed services. Not possible upgrading localhost with --self.systemctl --failedupdate-linux commandUsage: update-linux <options> <group>|<host>...
    group - read from the JSON config file:
            /home/barry/.config/org.barrys-emacs.update-linux.json

        each group is a list of hosts to be updated

    host - host to be updated

    options:
        --check default Off
            check if update is required

        --debug default Off
            print debug messages

        --exclude=<host> default None
            exclude the <host> from being updated

        --force-reboot default Off
            always reboot host even if no packages where updated

        --help default Off
            print this help

        --install-package=<package> default None
            install <package> only

        --list-config default Off
            list the configuration from the JSON config file

        --system-upgrade=<version> default None
            perform a system upgrade to version <version>update-linux log filesAll the log files are written to the configuredlogdirfolder.
Each log file include the date in its name.
If update-linux is run more then once in a day the output of each run is appended the log files.update-summary-date.logReport the run of update-linux for all hosts.check-update-host-date.logCheck update report for ahostondate.install--host-date.logInstall package report for ahostondate.update-host-date.logUpdate report for ahostondate.status-host-date.logStaus report for ahostondate.ExamplesCheck to see of updates are available for some Fedora hosts:$ update-linux --check host1 host2Install updates:$ update-linux host1 host2Apply a system upgrade to Fedora 38:$ update-linux --system-upgrade=38 host3update-linux configurationThe configuration for update-linux is stored in a JSON file.On linux this is in ~/.config/org.barrys-emacs.update-linux.json and
on macOS this is in ~/Library/Preferences/org.barrys-emacs.update-linux.jsonExample configuration:{"logdir":"~/tmpdir","group":{"all":["router","player","vm"],"vm":["armf36","armf37"]}}Thelogdiris the where all the logs of the updates are written to which defaults to tempdir.Groups are named list of hosts in thegroupdictionary.