From c37db0a41e316515475c2138d1c8f258c0aaf074 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Mon, 11 Jan 2021 11:47:23 +0000 Subject: [PATCH] systemd: add user unit to download packages automatically --- systemd/user/checkupdates.service | 13 +++++++++++++ systemd/user/checkupdates.timer | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100644 systemd/user/checkupdates.service create mode 100644 systemd/user/checkupdates.timer diff --git a/systemd/user/checkupdates.service b/systemd/user/checkupdates.service new file mode 100644 index 0000000..d3788df --- /dev/null +++ b/systemd/user/checkupdates.service @@ -0,0 +1,13 @@ +# Requires following line in sudoers allowing users in wheel +# to download packages without password +# %wheel ALL=(ALL) NOPASSWD: /usr/bin/pacman -Sw --noconfirm * --dbpath * + +[Unit] +Description=Check pacman updates and dowload packages to cache +After=network-online.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/checkupdates -d +# checkupdates returns 2 when there are no updates +SuccessExitStatus=2 diff --git a/systemd/user/checkupdates.timer b/systemd/user/checkupdates.timer new file mode 100644 index 0000000..bed362d --- /dev/null +++ b/systemd/user/checkupdates.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Timer to check pacman updates and dowload packages to cache + +[Timer] +OnCalendar=hourly +Persistent=true + +[Install] +WantedBy=timers.target -- 2.48.1