Last active
July 24, 2025 01:56
-
-
Save dylanmtaylor/33456b095803592b5dd8dbbc6f74e04e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script installs the systemd service and timer units for rpm-ostree updates. | |
# It should be run as root or with sudo. | |
echo "Creating rpm-ostree-update.service..." | |
sudo tee /etc/systemd/system/rpm-ostree-update.service > /dev/null <<EOF | |
[Unit] | |
Description=Perform rpm-ostree update --reboot | |
Documentation=man:rpm-ostree(1) | |
Wants=network-online.target | |
After=network-online.target | |
[Service] | |
Type=oneshot | |
ExecStart=/usr/bin/rpm-ostree update --reboot | |
StandardOutput=journal | |
StandardError=journal | |
# Set a timeout for the update process (e.g., 30 minutes) | |
TimeoutSec=1800 | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
echo "Creating rpm-ostree-update.timer..." | |
sudo tee /etc/systemd/system/rpm-ostree-update.timer > /dev/null <<EOF | |
[Unit] | |
Description=Daily rpm-ostree update timer | |
Documentation=man:rpm-ostree(1) | |
[Timer] | |
OnCalendar=*-*-* 04:00:00 | |
RandomizedDelaySec=300 | |
Persistent=true | |
[Install] | |
WantedBy=timers.target | |
EOF | |
echo "Reloading systemd daemon..." | |
sudo systemctl daemon-reload | |
echo "Enabling and starting rpm-ostree-update.timer..." | |
sudo systemctl enable --now rpm-ostree-update.timer | |
echo "Installation complete. You can check the status with:" | |
echo " systemctl status rpm-ostree-update.timer" | |
echo " journalctl -u rpm-ostree-update.service" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment