Skip to content

Enabling automatic updates on flatpak (ehancement request) #635

Description

@Anthonyntilelli

I know this is a relatively simple issue to solve. Though I think its a bit of an oversight that its not in the documentation.

Cron

crontab -e <<'EOF'
15 3 * * * /usr/bin/flatpak update -y --noninteractive >>"$HOME/flatpak-update.log" 2>&1
EOF

Systemd Timers

#!/usr/bin/env bash
set -euo pipefail

SERVICE_DIR="${HOME}/.config/systemd/user"
mkdir -p "$SERVICE_DIR"

cat >"$SERVICE_DIR/flatpak-update.service" <<'EOF'
[Unit]
Description=Daily Flatpak update (user)

[Service]
Type=oneshot
ExecStart=/usr/bin/flatpak update -y --noninteractive
EOF

cat >"$SERVICE_DIR/flatpak-update.timer" <<'EOF'
[Unit]
Description=Run Flatpak update daily

[Timer]
OnCalendar=daily
Persistent=true

[Install]
WantedBy=timers.target
EOF

systemctl --user daemon-reload
systemctl --user enable --now flatpak-update.timer
systemctl --user list-timers --all | sed -n '1,5p'

Potantial issues:

I would think it would be bad if an update and flatpak install ran at the same time, does that flatpak binary check a lock file or something similar before updating or installing??

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions