update-linux


Nameupdate-linux JSON
Version 3.1.1 PyPI version JSON
download
home_pageNone
SummaryCommand to automate the routine updating of packages and system upgrading for Unix systems.
upload_time2024-04-27 19:43:02
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseApache-2.0
keywords development
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # update-linux command

Command 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 can `ssh 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 command `sudo 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 host
```

For an update the following steps are performed:

1. Update packages  - if there is nothing to update stop here

    Fedora: `dnf -vy update --refresh`

    Debian: `apt-get update --assume-yes` then `apt-get upgrade --assume-yes`

1. Wait until all systemd jobs have finished

    `systemctl list-jobs`

    For example akmod building nvidia drivers for a new kernel

1. Check if a reboot is needed.

    `dnf needs-restart -r`

1. Reboot the host

    `reboot`

1. Report on state of any failed services

    `systemctl --failed`

## udpate-linux check for updates

```
$ update-linux host --check
```

With the `--check` options these steps are performed:

1. Check if there are packages to update

    Fedora: `dnf check-update --refresh`

    Debian: `apt-get update --assume-yes` then `apt-get upgrade --assume-no`

1. Report on state of any failed services. Not possible upgrading localhost with --self.

    `systemctl --failed`

## update-linux system-upgrade process

```
$ update-linux --system-upgrade=38 host
```

For 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 the `update-linux --system-upgrade` once for each release that is be upgraded.

For a system-upgrade these steps are used:

1. Check the current version of the Fedora installation against the requested version.

    If the host is already running the requested version stop here.

1. Download packages

    `dnf system-upgrade download --releasever=<version> --assumeyes`

1. Reboot to run the system-upgrade

    `dnf system-upgrade reboot`

1. Wait for the system to reboot

    There is a limit of 45 minutes to wait for the reboot

1. Report on state of any failed services. Not possible upgrading localhost with --self.

    `systemctl --failed`

## update-linux command

```
Usage: 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 files

All the log files are written to the configured `logdir` folder.
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***.log

    Report the run of update-linux for all hosts.

* check-update-***host***-***date***.log

    Check update report for a ***host*** on ***date***.

* install--***host***-***date***.log

    Install package report for a ***host*** on ***date***.

* update-***host***-***date***.log

    Update report for a ***host*** on ***date***.

* status-***host***-***date***.log

    Staus report for a ***host*** on ***date***.

## Examples

Check to see of updates are available for some Fedora hosts:

```
$ update-linux --check host1 host2
```

Install updates:

```
$ update-linux host1 host2
```

Apply a system upgrade to Fedora 38:

```
$ update-linux --system-upgrade=38 host3
```

## update-linux configuration

The 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.json

Example configuration:

```json
{
    "logdir":   "~/tmpdir",
    "group":
        {
            "all": [
                "router",
                "player",
                "vm"
                ],
            "vm": [
                "armf36",
                "armf37"
                ]
        }
}

```

The `logdir` is the where all the logs of the updates are written to which defaults to tempdir.

Groups are named list of hosts in the `group` dictionary.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "update-linux",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "development",
    "author": null,
    "author_email": "Barry Scott <barry@barrys-emacs.org>",
    "download_url": "https://files.pythonhosted.org/packages/a9/f8/5d6a77ba0b31cedfbed1106022a7a7f940b25a28bcf6050266e6a5ddbba9/update_linux-3.1.1.tar.gz",
    "platform": null,
    "description": "# update-linux command\n\nCommand to automate the routine updating of packages and system upgrading for Unix systems.\n\nupdate-linuk can check for updates (--check), install updates (--update) and do a system upgrade (--system-upgrade).\n\nSupports Fedora like and Debian Like OS.\n\nFedora like includes Fedora, RHEL, Centos, Rocky etc that use DNF.\n\nDebian like includes Dedian, Ubuntu etc that use apt.\n\nupdate-linux uses ssh to run commands on the hosts being worked on.\n\nIt assumes that it can `ssh root@<host>` without a password prompt.\n\nHowever 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.\nNormally update-linux will reboot a host if that is required, but when working on --self no reboot is done unless --force-reboot is used.\n\nIf running update-linux on a macOS system it is necessary to flush DNS so that freshly booted hosts can be accessed by host-name.\n\nThis is done with the command `sudo killall -HUP mDNSResponder`.\n\nupdate-linux will refuse to update the host it is running on unless the -self options is used.\n\nNormally a reboot is done at the conclusion of an update unless update-linux can determine that the reboot is not required.\n\n## update-linux update process\n\n```\n$ update-linux --update host\n```\n\nFor an update the following steps are performed:\n\n1. Update packages  - if there is nothing to update stop here\n\n    Fedora: `dnf -vy update --refresh`\n\n    Debian: `apt-get update --assume-yes` then `apt-get upgrade --assume-yes`\n\n1. Wait until all systemd jobs have finished\n\n    `systemctl list-jobs`\n\n    For example akmod building nvidia drivers for a new kernel\n\n1. Check if a reboot is needed.\n\n    `dnf needs-restart -r`\n\n1. Reboot the host\n\n    `reboot`\n\n1. Report on state of any failed services\n\n    `systemctl --failed`\n\n## udpate-linux check for updates\n\n```\n$ update-linux host --check\n```\n\nWith the `--check` options these steps are performed:\n\n1. Check if there are packages to update\n\n    Fedora: `dnf check-update --refresh`\n\n    Debian: `apt-get update --assume-yes` then `apt-get upgrade --assume-no`\n\n1. Report on state of any failed services. Not possible upgrading localhost with --self.\n\n    `systemctl --failed`\n\n## update-linux system-upgrade process\n\n```\n$ update-linux --system-upgrade=38 host\n```\n\nFor a system-upgrade update-linux will update one release at a time.\n\nThis means that a host running Fedora 36 that is being upgraded to Fedora 38 will first be upgraded to Fedora 37.\n\nThis is done as it is the safer then attempting skip over releases that can have required side-effects.\n\nRun the `update-linux --system-upgrade` once for each release that is be upgraded.\n\nFor a system-upgrade these steps are used:\n\n1. Check the current version of the Fedora installation against the requested version.\n\n    If the host is already running the requested version stop here.\n\n1. Download packages\n\n    `dnf system-upgrade download --releasever=<version> --assumeyes`\n\n1. Reboot to run the system-upgrade\n\n    `dnf system-upgrade reboot`\n\n1. Wait for the system to reboot\n\n    There is a limit of 45 minutes to wait for the reboot\n\n1. Report on state of any failed services. Not possible upgrading localhost with --self.\n\n    `systemctl --failed`\n\n## update-linux command\n\n```\nUsage: update-linux <options> <group>|<host>...\n    group - read from the JSON config file:\n            /home/barry/.config/org.barrys-emacs.update-linux.json\n\n        each group is a list of hosts to be updated\n\n    host - host to be updated\n\n    options:\n        --check default Off\n            check if update is required\n\n        --debug default Off\n            print debug messages\n\n        --exclude=<host> default None\n            exclude the <host> from being updated\n\n        --force-reboot default Off\n            always reboot host even if no packages where updated\n\n        --help default Off\n            print this help\n\n        --install-package=<package> default None\n            install <package> only\n\n        --list-config default Off\n            list the configuration from the JSON config file\n\n        --system-upgrade=<version> default None\n            perform a system upgrade to version <version>\n```\n\n## update-linux log files\n\nAll the log files are written to the configured `logdir` folder.\nEach log file include the date in its name.\nIf update-linux is run more then once in a day the output of each run is appended the log files.\n\n* update-summary-***date***.log\n\n    Report the run of update-linux for all hosts.\n\n* check-update-***host***-***date***.log\n\n    Check update report for a ***host*** on ***date***.\n\n* install--***host***-***date***.log\n\n    Install package report for a ***host*** on ***date***.\n\n* update-***host***-***date***.log\n\n    Update report for a ***host*** on ***date***.\n\n* status-***host***-***date***.log\n\n    Staus report for a ***host*** on ***date***.\n\n## Examples\n\nCheck to see of updates are available for some Fedora hosts:\n\n```\n$ update-linux --check host1 host2\n```\n\nInstall updates:\n\n```\n$ update-linux host1 host2\n```\n\nApply a system upgrade to Fedora 38:\n\n```\n$ update-linux --system-upgrade=38 host3\n```\n\n## update-linux configuration\n\nThe configuration for update-linux is stored in a JSON file.\n\nOn linux this is in ~/.config/org.barrys-emacs.update-linux.json and\non macOS this is in ~/Library/Preferences/org.barrys-emacs.update-linux.json\n\nExample configuration:\n\n```json\n{\n    \"logdir\":   \"~/tmpdir\",\n    \"group\":\n        {\n            \"all\": [\n                \"router\",\n                \"player\",\n                \"vm\"\n                ],\n            \"vm\": [\n                \"armf36\",\n                \"armf37\"\n                ]\n        }\n}\n\n```\n\nThe `logdir` is the where all the logs of the updates are written to which defaults to tempdir.\n\nGroups are named list of hosts in the `group` dictionary.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Command to automate the routine updating of packages and system upgrading for Unix systems.",
    "version": "3.1.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/barry-scott/CLI-tools/issues",
        "Homepage": "https://github.com/barry-scott/CLI-tools"
    },
    "split_keywords": [
        "development"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "593ec942e639faef650b1c5b6deefb9ef0a1930264feece987f9e0125d529ebd",
                "md5": "e078f8b1f514731486d54cb94f0d4077",
                "sha256": "2a9222e29c7f89abba2ce115b03b8c0ba91aaf0a17b86b8020fc006cbec18e99"
            },
            "downloads": -1,
            "filename": "update_linux-3.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e078f8b1f514731486d54cb94f0d4077",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 14389,
            "upload_time": "2024-04-27T19:43:01",
            "upload_time_iso_8601": "2024-04-27T19:43:01.095483Z",
            "url": "https://files.pythonhosted.org/packages/59/3e/c942e639faef650b1c5b6deefb9ef0a1930264feece987f9e0125d529ebd/update_linux-3.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a9f85d6a77ba0b31cedfbed1106022a7a7f940b25a28bcf6050266e6a5ddbba9",
                "md5": "eec1514f9042fbed103444d4c6115896",
                "sha256": "791d95085ecb3bb01c5837959d35dbfee3850575477e6293b4c182cfa7f969d2"
            },
            "downloads": -1,
            "filename": "update_linux-3.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "eec1514f9042fbed103444d4c6115896",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 16002,
            "upload_time": "2024-04-27T19:43:02",
            "upload_time_iso_8601": "2024-04-27T19:43:02.601609Z",
            "url": "https://files.pythonhosted.org/packages/a9/f8/5d6a77ba0b31cedfbed1106022a7a7f940b25a28bcf6050266e6a5ddbba9/update_linux-3.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-27 19:43:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "barry-scott",
    "github_project": "CLI-tools",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "update-linux"
}
        
Elapsed time: 0.23079s