From: Samir Benmendil Date: Mon, 11 Jan 2021 11:47:23 +0000 (+0000) Subject: systemd: add user unit to download packages automatically X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/c37db0a41e316515475c2138d1c8f258c0aaf074 systemd: add user unit to download packages automatically --- 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