]> git.rmz.io Git - dotfiles.git/commitdiff
systemd: add user unit to download packages automatically
authorSamir Benmendil <me@rmz.io>
Mon, 11 Jan 2021 11:47:23 +0000 (11:47 +0000)
committerSamir Benmendil <me@rmz.io>
Mon, 11 Jan 2021 12:46:27 +0000 (12:46 +0000)
systemd/user/checkupdates.service [new file with mode: 0644]
systemd/user/checkupdates.timer [new file with mode: 0644]

diff --git a/systemd/user/checkupdates.service b/systemd/user/checkupdates.service
new file mode 100644 (file)
index 0000000..d3788df
--- /dev/null
@@ -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 (file)
index 0000000..bed362d
--- /dev/null
@@ -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