{"id":26978387,"url":"https://github.com/keganedwards/opensuse-automatic-offline-updates","last_synced_at":"2026-05-03T02:38:26.694Z","repository":{"id":258321534,"uuid":"863649036","full_name":"keganedwards/opensuse-automatic-offline-updates","owner":"keganedwards","description":"Services to automate dist-upgrade on startup.","archived":false,"fork":false,"pushed_at":"2024-10-20T18:15:16.000Z","size":106,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-14T16:50:44.526Z","etag":null,"topics":["automatic-updates","bash","linux","opensuse"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keganedwards.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-26T16:57:22.000Z","updated_at":"2025-03-03T20:00:43.000Z","dependencies_parsed_at":"2025-03-14T16:50:49.807Z","dependency_job_id":"c8c9b2c6-6a31-44ea-a60e-9b701a17dde2","html_url":"https://github.com/keganedwards/opensuse-automatic-offline-updates","commit_stats":null,"previous_names":["kedwar83/opensuse-automatic-offline-updates","keganedwards/opensuse-automatic-offline-updates"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keganedwards%2Fopensuse-automatic-offline-updates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keganedwards%2Fopensuse-automatic-offline-updates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keganedwards%2Fopensuse-automatic-offline-updates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keganedwards%2Fopensuse-automatic-offline-updates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keganedwards","download_url":"https://codeload.github.com/keganedwards/opensuse-automatic-offline-updates/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247006668,"owners_count":20868033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automatic-updates","bash","linux","opensuse"],"created_at":"2025-04-03T13:20:07.906Z","updated_at":"2026-05-03T02:38:26.659Z","avatar_url":"https://github.com/keganedwards.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zypper Automatic Update System\n\nThis system provides automated management of system updates for openSUSE/SUSE Linux using zypper. It consists of three main components that work together to safely download and apply updates while keeping users informed of the process.\n\n## Features\n\n- Automated daily download of system updates\n- Offline update application during system shutdown\n- Desktop notifications for update status and failures\n- Non-interactive operation\n- Configurable timing with randomized delays\n- Safe update practices (no automatic recommendations)\n\n## Components\n\n### 1. Zypper Refresh and Download Service\nDownloads updates on a daily schedule without applying them.\n- Downloads updates in non-interactive mode\n- Runs daily with a randomized delay\n- Creates a flag file when updates are ready to apply\n\n#### Script (`/usr/local/bin/zypper-refresh-download.sh`):\n```bash\n#!/bin/bash\n\n# Refresh repositories\n/usr/bin/zypper refresh\n\n# Download updates (non-interactive) without changing recommendations and other specified options\nif /usr/bin/zypper dup -y --no-recommends --download-only; then\n    # Create a flag file to indicate the update was triggered and completed successfully\n    /usr/bin/touch /var/run/zypper-update-triggered\n    echo \"Update download completed successfully\" | systemd-cat -t zypper-auto-update -p info\nelse\n    echo \"Update download failed\" | systemd-cat -t zypper-auto-update -p err\n    exit 1\nfi\n\n# Ensure the service exits cleanly\nexit 0\n```\n\n#### Service Configuration (`/etc/systemd/system/zypper-refresh-download.service`):\n```ini\n[Unit]\nDescription=Zypper Refresh and Download Updates (Non-interactive)\nWants=network-online.target\nAfter=network-online.target\n\n[Service]\nType=oneshot\nTimeoutStartSec=0\nExecStartPre=/bin/sleep 10\nExecStart=/usr/local/bin/zypper-refresh-download.sh\nExecStop=/bin/rm -f /var/run/zypper-update-triggered\n\n[Install]\nWantedBy=multi-user.target\n```\n\n#### Timer Configuration (`/etc/systemd/system/zypper-refresh-download.timer`):\n```ini\n[Unit]\nDescription=Run Zypper Refresh and Download Updates daily\n\n[Timer]\nOnBootSec=10m\nOnUnitActiveSec=24h\nRandomizedDelaySec=2h\n\n[Install]\nWantedBy=timers.target\n```\n\n### 2. Zypper Offline Update Service\nApplies downloaded updates during system shutdown.\n- Ensures updates are applied when the system is in a clean state\n- Prevents interruption of running applications\n- Only runs if updates were successfully downloaded\n\n#### Script (`/usr/local/bin/zypper-offline-update.sh`):\n```bash\n#!/bin/bash\n\n# Check if updates were downloaded successfully\nif [ -f /var/run/zypper-update-triggered ]; then\n    # Apply updates\n    if /usr/bin/zypper dup -y --no-recommends; then\n        echo \"Offline update applied successfully\" | systemd-cat -t zypper-auto-update -p info\n    else\n        echo \"Offline update failed\" | systemd-cat -t zypper-auto-update -p err\n    fi\n\n    # Remove the trigger file\n    rm /var/run/zypper-update-triggered\nelse\n    echo \"No updates to apply or download was incomplete\" | systemd-cat -t zypper-auto-update -p info\nfi\n\n# Ensure the service exits cleanly\nexit 0\n```\n\n#### Service Configuration (`/etc/systemd/system/zypper-offline-update.service`):\n```ini\n[Unit]\nDescription=Zypper Offline Update\nDefaultDependencies=no\nConflicts=shutdown.target\nBefore=shutdown.target reboot.target halt.target\n\n[Service]\nType=oneshot\nRemainAfterExit=yes\nExecStart=/usr/local/bin/zypper-offline-update.sh\n\n[Install]\nWantedBy=shutdown.target\n```\n\n### 3. Update Notification Service\nNotifies users about update status upon login.\n- Provides desktop notifications about update success or failure\n- Triggers automatically when users log in\n- Uses the system's native notification system\n\n#### Script (`/usr/local/bin/zypper-update-notify.sh`):\n```bash\n#!/bin/bash\n\n# Get the current user\nuser=$PAM_USER\n\n# Ensure we have a user\nif [ -z \"$user\" ]; then\n    echo \"No user specified\" | systemd-cat -t zypper-auto-update -p err\n    exit 1\nfi\n\n# Wait a few seconds for the session to be fully initialized\nsleep 5\n\n# Check if either service failed\nif systemctl is-failed --quiet zypper-refresh-download.service || \\\n   systemctl is-failed --quiet zypper-offline-update.service; then\n    sudo -u $user DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $user)/bus \\\n    notify-send -u critical \"Zypper Update Failed\" \"One of the Zypper services has failed. Please check the logs.\"\nelse\n    # Optionally notify of success\n    sudo -u $user DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $user)/bus \\\n    notify-send \"Zypper Update Status\" \"System updates are working normally.\"\nfi\n\nexit 0\n```\n\n#### PAM Configuration (`/etc/pam.d/login-notification`):\n```\nsession optional pam_exec.so /usr/local/bin/zypper-update-notify.sh\n```\n\n#### Service Configuration (`/etc/systemd/system/zypper-update-notify.service`):\n```ini\n[Unit]\nDescription=Zypper Update Notification Service\nAfter=zypper-refresh-download.service zypper-offline-update.service\n\n[Service]\nType=simple\nExecStart=/usr/bin/true\n\n[Install]\nWantedBy=multi-user.target\n```\n\n## Installation\n\n1. Create all scripts:\n```bash\n# Create script directories if they don't exist\nsudo mkdir -p /usr/local/bin\n\n# Create all scripts with the content shown above\nsudo nano /usr/local/bin/zypper-refresh-download.sh\nsudo nano /usr/local/bin/zypper-offline-update.sh\nsudo nano /usr/local/bin/zypper-update-notify.sh\n\n# Make scripts executable\nsudo chmod +x /usr/local/bin/zypper-refresh-download.sh\nsudo chmod +x /usr/local/bin/zypper-offline-update.sh\nsudo chmod +x /usr/local/bin/zypper-update-notify.sh\n```\n\n2. Create systemd service files:\n```bash\n# Create service files with the content shown above\nsudo nano /etc/systemd/system/zypper-refresh-download.service\nsudo nano /etc/systemd/system/zypper-refresh-download.timer\nsudo nano /etc/systemd/system/zypper-offline-update.service\nsudo nano /etc/systemd/system/zypper-update-notify.service\n```\n\n3. Create PAM configuration:\n```bash\n# Create PAM configuration file\nsudo nano /etc/pam.d/login-notification\n```\n\n4. Enable and start the services:\n```bash\n# Reload systemd\nsudo systemctl daemon-reload\n\n# Enable services\nsudo systemctl enable zypper-refresh-download.timer\nsudo systemctl enable zypper-offline-update.service\nsudo systemctl enable zypper-update-notify.service\n\n# Start the timer\nsudo systemctl start zypper-refresh-download.timer\n```\n\n## Configuration\n\n### Update Schedule\nThe default schedule downloads updates daily with a 2-hour random delay. To modify this, edit the timer configuration shown above in the Components section.\n\n### Update Options\nThe update process uses `--no-recommends` by default. To modify update options, edit the respective scripts shown above in the Components section.\n\n## Troubleshooting\n\n### Checking Service Status\n```bash\n# Check timer status\nsystemctl status zypper-refresh-download.timer\n\n# Check download service status\nsystemctl status zypper-refresh-download.service\n\n# Check offline update service status\nsystemctl status zypper-offline-update.service\n\n# Check notification service status\nsystemctl status zypper-update-notify.service\n```\n\n### Viewing Logs\n```bash\n# View all related logs\njournalctl -t zypper-auto-update\n\n# View specific service logs\njournalctl -u zypper-refresh-download.service\njournalctl -u zypper-offline-update.service\njournalctl -u zypper-update-notify.service\n```\n\n## Security Considerations\n\n- Scripts run with root privileges through systemd\n- Update downloads are separate from installation for safety\n- Updates are applied during shutdown to prevent service interruption\n- Notifications are delivered safely to user sessions\n\n## Contributing\n\nFeel free to submit issues and pull requests for improvements to the system.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeganedwards%2Fopensuse-automatic-offline-updates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeganedwards%2Fopensuse-automatic-offline-updates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeganedwards%2Fopensuse-automatic-offline-updates/lists"}