1
0

Use systemd services and timer

OBS-URL: https://build.opensuse.org/package/show/Publishing:TeXLive/texlive-filesystem?expand=0&rev=170
This commit is contained in:
Dr. Werner Fink 2023-05-25 11:06:32 +00:00 committed by Git OBS Bridge
parent d0e4b10c82
commit 9731d105e4
6 changed files with 149 additions and 8 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu May 25 10:58:46 UTC 2023 - Dr. Werner Fink <werner@suse.de>
- Switch over to systemd to a) replace cron usage with timer
and b) to make use the transactional update support of the
update script (boo#1211613)
-------------------------------------------------------------------
Wed May 24 14:28:07 UTC 2023 - Dr. Werner Fink <werner@suse.de>

View File

@ -24,9 +24,9 @@
%define texlive_version 2023
%define texlive_previous 2022
%define texlive_release 20230311
%define texlive_noarch 201
%define texlive_noarch 208
%define texlive_source texlive-20230311-source
%define biber_version 2.18
%define biber_version 2.19
%define __perl_requires %{nil}
%define __os_install_post /usr/lib/rpm/brp-compress \\\
@ -41,21 +41,34 @@ Summary: Basic file system of TeX Live
License: Apache-2.0 AND Artistic-1.0 AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-only AND LPPL-1.3c AND LPPL-1.0 AND MIT AND BSD-3-Clause AND SUSE-TeX AND SUSE-Public-Domain
Group: Productivity/Publishing/TeX/Base
URL: https://www.tug.org/texlive/
%if 0%{?suse_version} <= 1550
Requires: cron
%else
Requires: rpm_macro(_unitdir)
%endif
Requires: python3
Requires(pre): user(mktex)
Requires(pre): group(mktex)
Requires(pre): /usr/bin/stat
%if 0%{?suse_version} > 1550
Requires(pre): rpm_macro(service_add_pre)
%endif
Requires(post): %fillup_prereq
Requires(post): permissions
Requires(post): /usr/bin/mktemp
Requires(post): /usr/bin/mv
Requires(post): /usr/bin/setpriv
%if 0%{?suse_version} > 1550
Requires(pre): rpm_macro(service_add_post)
%endif
Requires(postun):coreutils
Requires(postun):ed
Requires(postun):findutils
Requires(postun):grep
Requires(postun):sed
%if 0%{?suse_version} > 1550
Requires(pre): rpm_macro(service_del_postun)
%endif
Requires(pre): /usr/bin/perl
Requires(pre): /usr/bin/clear
Requires(pre): /usr/bin/dialog
@ -64,6 +77,9 @@ Requires(pre): ed
Requires(pre): findutils
Requires(pre): grep
Requires(pre): sed
%if 0%{?suse_version} > 1550
Requires(preun):rpm_macro(service_del_preun)
%endif
Requires(posttrans):coreutils
Requires(posttrans):ed
Requires(posttrans):findutils
@ -87,6 +103,9 @@ Source14: texlive.csh
Source15: fc-texlive.conf
Source16: fc-t1-texlive.conf
Source17: fc-truetype-texlive.conf
Source18: texlive.timer
Source19: texlive.service
Source20: texlive-initial.service
Source30: texlive-filesystem-rpmlintrc
Source31: dot.dvipsrc
Source42: zypplugin.in
@ -22762,9 +22781,16 @@ popd
install -m 0644 %{S:10} %{buildroot}%{_fillupdir}/sysconfig.texlive
install -m 0755 %{S:11} %{buildroot}%{_texmfdistdir}/texconfig/update
%if 0%{?suse_version} > 1550
install -m 0755 %{S:12} %{buildroot}%{_texmfdistdir}/texconfig/daily
mkdir -p %{buildroot}%{_unitdir}
install -m 0644 %{S:18} %{buildroot}%{_unitdir}/texlive.timer
install -m 0644 %{S:19} %{buildroot}%{_unitdir}/texlive.service
install -m 0644 %{S:20} %{buildroot}%{_unitdir}/texlive-initial.service
%else
mkdir -p %{buildroot}%{_sysconfdir}/cron.daily
install -m 0755 %{S:12} %{buildroot}%{_sysconfdir}/cron.daily/suse-texlive
%endif
%if %{defined verify_permissions}
%verifyscript
@ -22798,6 +22824,9 @@ for dir in %{_texmfconfdir} \
do
rm -f ${dir}/ls-R
done
%if 0%{?suse_version} > 1550
%service_add_pre texlive.timer texlive.service texlive-initial.service
%endif
%post
%fillup_only -n texlive
@ -22837,12 +22866,23 @@ done
%set_permissions %{_fontcache}/source/
%set_permissions %{_fontcache}/tfm/
%endif
%if 0%{?suse_version} > 1550
%service_add_post texlive.timer texlive.service texlive-initial.service
%endif
mkdir -p /var/run/texlive
> /var/run/texlive/run-mktexlsr
> /var/run/texlive/run-update
test $error = 0 || exit 1
%preun
%if 0%{?suse_version} > 1550
%service_del_preun texlive.timer texlive.service texlive-initial.service
%endif
%postun
%if 0%{?suse_version} > 1550
%service_del_postun texlive.timer texlive.service texlive-initial.service
%endif
if test $1 = 1; then
mkdir -p /var/run/texlive
> /var/run/texlive/run-mktexlsr
@ -22858,7 +22898,9 @@ VERBOSE=false %{_texmfdistdir}/texconfig/update || :
%files
%defattr(-,root,root,755)
%if 0%{?suse_version} <= 1550
%config %{_sysconfdir}/cron.daily/suse-texlive
%endif
%config %{_sysconfdir}/permissions.d/texlive*
%config %{_sysconfdir}/profile.d/texlive*
%config %{_sysconfdir}/skel/.dvipsrc
@ -22916,6 +22958,12 @@ VERBOSE=false %{_texmfdistdir}/texconfig/update || :
%dir %{_texmfdistdir}/xdvi/pixmap
%dir %{_texmfdistdir}/texconfig
%attr(0755,root,root) %{_texmfdistdir}/texconfig/update
%if 0%{?suse_version} > 1550
%attr(0755,root,root) %{_texmfdistdir}/texconfig/daily
%{_unitdir}/texlive.timer
%{_unitdir}/texlive.service
%{_unitdir}/texlive-initial.service
%endif
%if %{with zypper_posttrans}
%attr(0755,root,root) %{_texmfdistdir}/texconfig/zypper.py
%endif

37
texlive-initial.service Normal file
View File

@ -0,0 +1,37 @@
[Unit]
Description=Initiate TeXLive Data Bases and Formats
Documentation=info:kpathsea
DefaultDependencies=no
After=local-fs.target
Before=sysinit.target shutdown.target
Conflicts=shutdown.target
RequiresMountsFor=/var/cache/texmf
RequiresMountsFor=/var/lib/texmf
ConditionPathExists=/etc/texmf/TRANSACTIONAL_UPDATE
[Service]
Type=oneshot
RemainAfterExit=yes
# Otherwise the update script can not remove
# our tag file /etc/texmf/TRANSACTIONAL_UPDATE
User=root
Group=mktex
UMask=0002
# Note that /etc/texmf/ls-R should be rw
ProtectSystem=true
ProtectHome=true
PrivateTmp=true
PrivateDevices=true
ProtectHostname=true
ProtectClock=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
LockPersonality=true
RestrictRealtime=true
ExecStart=/usr/share/texmf/texconfig/update
[Install]
WantedBy=sysinit.target

View File

@ -22,6 +22,13 @@ OLDIFS=$IFS; IFS=':;'
VARTEXFONTS="$(kpsewhich --expand-var '$VARTEXFONTS' 2> /dev/null)"
IFS=$OLDIFS
if test "$(id -ur)" = 0
then
groups=--init-groups
else
groups=--keep-groups
fi
if test -n "$VARTEXFONTS" -a "$HAVE_MKTEX_MEMBERS" = yes
then
IFS=:
@ -36,9 +43,9 @@ then
for i in $(seq 3 $u)
do
find -P $p \( \( -type f -and -not -type l \) -and -user ${users[$i]} \) -print0 | \
xargs -r -L100 -0 -- setpriv --reuid ${users[$i]} --regid mktex --init-groups chmod g+rw
xargs -r -L100 -0 -- setpriv --reuid ${users[$i]} --regid mktex $groups chmod g+rw
find -P $p \( \( -type d -and -not -type l \) -and -user ${users[$i]} \) -print0 | \
xargs -r -L100 -0 -- setpriv --reuid ${users[$i]} --regid mktex --init-groups chmod g+rwsx
xargs -r -L100 -0 -- setpriv --reuid ${users[$i]} --regid mktex $groups chmod g+rwsx
done
done
unset i u
@ -51,7 +58,7 @@ then
test -d $p/pk && find -P $p/pk \( -not -type d -and -atime +20 \) -print0
test -d $p/tfm && find -P $p/tfm \( -not -type d -and -atime +60 \) -print0
test -d $p/source && find -P $p/source \( -not -type d -and -atime +60 \) -print0
done > >(exec -a xargs xargs -r -L100 -0 -- setpriv --reuid mktex --regid mktex --init-groups rm -f)
done > >(exec -a xargs xargs -r -L100 -0 -- setpriv --reuid mktex --regid mktex $groups rm -f)
fi
if test -n "$VARTEXFONTS"
then
@ -61,11 +68,11 @@ then
test -d $p/tfm && find -P $p/tfm \( -not -type d -and -not -name '*.tfm' \) -print0
test -d $p/source && find -P $p/source \( -not -type d -and -not -name '*.mf' \) -print0
test -d $p && find -P $p \( -not -type d -and -path '*/[^[:alnum:]]*' \) -print0
done > >(exec -a xargs xargs -r -L100 -0 -- setpriv --reuid mktex --regid mktex --init-groups rm -vf)
done > >(exec -a xargs xargs -r -L100 -0 -- setpriv --reuid mktex --regid mktex $groups rm -vf)
for p in $VARTEXFONTS
do
test -d $p && find -P $p -depth \( -type d -and -path '*/[^[:alnum:]]*' \) -print0
done > >(exec -a xargs xargs -r -L100 -0 -- setpriv --reuid mktex --regid mktex --init-groups rm -vfr)
done > >(exec -a xargs xargs -r -L100 -0 -- setpriv --reuid mktex --regid mktex $groups rm -vfr)
fi
#

31
texlive.service Normal file
View File

@ -0,0 +1,31 @@
[Unit]
Description=Daily TeXLive regeneration
Documentation=info:kpathsea
ConditionACPower=true
ConditionPathExists=/var/cache/texmf
ConditionPathExists=/var/lib/texmf
[Service]
Type=oneshot
# Otherwise we can not change ownerships below /var/cache/texmf
User=root
Group=mktex
UMask=0002
Nice=19
IOSchedulingClass=idle
IOSchedulingPriority=7
# Note that /etc/texmf/ls-R should be rw
ProtectSystem=true
ProtectHome=true
PrivateTmp=true
PrivateDevices=true
ProtectHostname=true
ProtectClock=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
LockPersonality=true
RestrictRealtime=true
ExecStart=/usr/share/texmf/texconfig/daily

11
texlive.timer Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Daily TeXLive regeneration
Documentation=info:kpathsea
[Timer]
OnCalendar=daily
RandomizedDelaySec=12h
Persistent=true
[Install]
WantedBy=timers.target