[packages/libutempter] - rel 6; pretrans needs to be in lua according to https://docs.fedoraproject.org/en-US/packaging-gui
arekm
arekm at pld-linux.org
Tue Feb 9 16:25:47 CET 2021
commit c5f94ed1ac558af4c22a7ea6a355d6655f1220e5
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Tue Feb 9 16:25:30 2021 +0100
- rel 6; pretrans needs to be in lua according to https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#pretrans; otherwise fails on install in empty --root dir
libutempter.spec | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/libutempter.spec b/libutempter.spec
index 92e5d14..6164351 100644
--- a/libutempter.spec
+++ b/libutempter.spec
@@ -7,7 +7,7 @@ Summary(uk.UTF-8): Привілейована програма для внесе
%define utempter_compat_ver 0.5.5
Name: libutempter
Version: 1.1.6
-Release: 5
+Release: 6
License: LGPL v2.1+
Group: Base
Source0: ftp://ftp.altlinux.org/pub/people/ldv/utempter/%{name}-%{version}.tar.bz2
@@ -117,15 +117,23 @@ rm -rf $RPM_BUILD_ROOT
# not in trigger because utmpx is %%ghost, and %%ghost-ed files
# are removed when they'are uninstalled
-%pretrans
-if [ -e /var/run/utmpx ]; then
- if [ -s /var/run/utmp ]; then
- # utmp always takes precedence, it's safe to remove utmpx
- rm -f /var/run/utmpx
+%pretrans -p <lua>
+utmpx = io.open("/var/run/utmpx", "rb")
+if utmpx then
+ utmpx:close()
+ utmp_size = 0
+ utmp = io.open("/var/run/utmp", "rb")
+ if utmp then
+ utmp_size = utmp:seek("end")
+ utmp:close()
+ end
+ if utmp_size > 0 then
+ os.remove("/var/run/utmpx")
else
- mv -f /var/run/utmpx /var/run/utmp
- fi
-fi
+ os.remove("/var/run/utmp")
+ os.rename("/var/run/utmpx", "/var/run/utmp")
+ end
+end
%pre
%groupadd -g 22 utmp
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/libutempter.git/commitdiff/c5f94ed1ac558af4c22a7ea6a355d6655f1220e5
More information about the pld-cvs-commit
mailing list