[PATCH] Add pacman-syncdb: systemd service and timer for `pacman -Fy`.

nl6720 nl6720 at gmail.com
Fri Jul 30 13:26:58 UTC 2021


On Thursday, 29 July 2021 23:27:09 EEST Thiago Perrotta via pacman-contrib wrote:
> From: Thiago Perrotta <tbperrotta at gmail.com>
> 
> `pacman -Fy` is a modern replacement for `pkgfile`[1].
> 
> This service/timer makes `pacman -Fy` have feature parity with
> `pkgfile`.
> 
> The unit files were based on both pkgfile and paccache, for consistency
> with the existing ecosystem.
> 
> Context: https://bbs.archlinux.org/viewtopic.php?pid=1981076
> 
> [1]:
> https://wiki.archlinux.org/title/Pacman#Search_for_a_package_that_contains_
> a_specific_file
> 
> Signed-off-by: Thiago Perrotta <tbperrotta at gmail.com>
> ---
>  CHANGES.md                   |  1 +
>  src/Makefile.am              |  8 ++++++--
>  src/pacman-syncdb.service.in | 12 ++++++++++++
>  src/pacman-syncdb.timer      | 10 ++++++++++
>  4 files changed, 29 insertions(+), 2 deletions(-)
>  create mode 100644 src/pacman-syncdb.service.in
>  create mode 100644 src/pacman-syncdb.timer
> 
> diff --git a/CHANGES.md b/CHANGES.md
> index 80f02bb..96a441b 100644
> --- a/CHANGES.md
> +++ b/CHANGES.md
> @@ -6,6 +6,7 @@ and this project adheres to [Semantic
> Versioning](http://semver.org/spec/v2.0.0.
> 
>  ## [Unreleased]
>  ### Added
> +- pacman-syncdb: systemd service and timer for `pacman -Fy`
> (https://bbs.archlinux.org/viewtopic.php?pid=1981076)
> 
>  ### Changed
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index eef0590..cbc8bd0 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -30,7 +30,8 @@ vim_syntax__DATA = \
>  systemd_dir = ${libdir}/systemd/system
> 
>  systemd__DATA = \
> -	paccache.service paccache.timer
> +	paccache.service paccache.timer \
> +	pacman-syncdb.service pacman-syncdb.timer
> 
>  BASHSCRIPTS = \
>  	checkupdates \
> @@ -50,7 +51,8 @@ OURSCRIPTS = \
>  	$(PERLSCRIPTS)
> 
>  OURFILES = \
> -	paccache.service
> +	paccache.service \
> +	pacman-syncdb.service
> 
>  EXTRA_DIST = \
>  	checkupdates.sh.in \
> @@ -60,6 +62,8 @@ EXTRA_DIST = \
>  	pacdiff.sh.in \
>  	paclist.sh.in \
>  	paclog-pkglist.sh.in \
> +	pacman-syncdb.service.in \
> +	pacman-syncdb.timer \
>  	pacscripts.sh.in \
>  	pacsearch.pl.in \
>  	pacsort.c \
> diff --git a/src/pacman-syncdb.service.in b/src/pacman-syncdb.service.in
> new file mode 100644
> index 0000000..a249045
> --- /dev/null
> +++ b/src/pacman-syncdb.service.in
> @@ -0,0 +1,12 @@
> +[Unit]
> +Description=Download pacman fresh files databases from the server
> +RequiresMountsFor="/var/lib/pacman/sync"
> +After=network-online.target

"After" should include nss-lookup.target:

After=network-online.target nss-lookup.target

>From systemd.special(7):
"All services for which the availability of full host/network name resolution
is essential should be ordered after this target, but not pull it in."

See https://wiki.archlinux.org/title/systemd#Running_services_after_the_network_is_up

> +Wants=network-online.target
> +
> +[Service]
> +Type=oneshot
> +ExecStart=@bindir@/pacman -Fy
> +Nice=19
> +StandardOutput=null
> +StandardError=journal
> diff --git a/src/pacman-syncdb.timer b/src/pacman-syncdb.timer
> new file mode 100644
> index 0000000..2562443
> --- /dev/null
> +++ b/src/pacman-syncdb.timer
> @@ -0,0 +1,10 @@
> +[Unit]
> +Description=Download pacman fresh files databases from the server weekly
> +
> +[Timer]
> +OnCalendar=weekly
> +AccuracySec=1h
> +Persistent=true
> +
> +[Install]
> +WantedBy=timers.target

-- 
nl6720
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.archlinux.org/pipermail/pacman-contrib/attachments/20210730/2d0b0c1a/attachment.sig>


More information about the pacman-contrib mailing list