From ea9b4c2ca9dc16b137b6abbaafb5065ea206bd137e600da5cb0fe2d2202aca02 Mon Sep 17 00:00:00 2001 From: Ludwig Nussel Date: Mon, 4 Oct 2021 12:43:27 +0000 Subject: [PATCH] Accepting request 918730 from home:lnussel:usrmove - don't perform UsrMerge if ZYPP_SINGLE_RPMTRANS is set. Rely on file trigger compat mode in that case and do it posttrans (boo#1189788). - generic %ghost handling instead of hardcoding OBS-URL: https://build.opensuse.org/request/show/918730 OBS-URL: https://build.opensuse.org/package/show/Base:System/filesystem?expand=0&rev=214 --- filesystem.changes | 8 ++++++++ filesystem.links | 2 +- filesystem.spec | 24 +++++++++++++++++++----- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/filesystem.changes b/filesystem.changes index f3db083..11ce9b5 100644 --- a/filesystem.changes +++ b/filesystem.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Aug 27 07:26:40 UTC 2021 - Ludwig Nussel + +- don't perform UsrMerge if ZYPP_SINGLE_RPMTRANS is set. Rely on + file trigger compat mode in that case and do it posttrans + (boo#1189788). +- generic %ghost handling instead of hardcoding + ------------------------------------------------------------------- Mon Aug 2 07:55:40 UTC 2021 - Ludwig Nussel diff --git a/filesystem.links b/filesystem.links index 4cf1248..fc09b0d 100644 --- a/filesystem.links +++ b/filesystem.links @@ -2,4 +2,4 @@ # Required for FHS 2.1 spool/mail /var/mail # systemd -../run /var/run +../run /var/run %ghost diff --git a/filesystem.spec b/filesystem.spec index 05d83c9..e10e7d3 100644 --- a/filesystem.spec +++ b/filesystem.spec @@ -122,7 +122,21 @@ for i in pairs(dirs) do end end if needmigrate then + if posix.getenv("ZYPP_SINGLE_RPMTRANS") == "1" then + print("Warning: UsrMerge executed in single transcation mode") + if not posix.stat("/usr/lib/rpm/lua/usrmerge.lua") then + error("ERROR: compat-usrmerge file triggers not installed.\n!!! This will go horribly wrong. You need a rescue system now !!!") + end + rpm.define("_filesystem_need_posttrans_convertfs 1") + else assert(os.execute("/usr/libexec/convertfs")) + end +end +EOF + +cat > posttrans.lua <<'EOF' +if rpm.expand("%%%%{?_filesystem_need_posttrans_convertfs}") == "1" then + assert(os.execute("/usr/libexec/convertfs")) end EOF @@ -176,9 +190,9 @@ while read MOD OWN GRP NAME ; do create_dir $MOD $OWN $GRP $NAME done < directory.list # ghost files next -cat ghost.list | while read MOD OWN GRP NAME ; do +while read MOD OWN GRP NAME ; do create_dir $MOD $OWN $GRP $NAME "%%ghost " -done +done < ghost.list # arch specific leftovers for march in \ %ifarch %ix86 @@ -216,7 +230,7 @@ done create_dir 0755 root root /emul/ia32-linux %endif # now do the links -while read SRC DEST ; do +while read SRC DEST ATTR ; do case $SRC in "") continue ;; \#*) echo "comment: $SRC $DEST" ;; @@ -229,8 +243,7 @@ case $SRC in esac ln -sf $SRC $RPM_BUILD_ROOT$DEST case $DEST in - /var/run|/var/lock) echo "%ghost $DEST" >> filesystem.list ;; - *) echo "$DEST" >> filesystem.list ;; + *) echo "$ATTR${ATTR:+ }$DEST" >> filesystem.list ;; esac # for tmpfiles.d case $DEST in @@ -305,6 +318,7 @@ install -m 0644 fs-var-tmp.conf $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/fs-var-tmp.c %pretrans -p -f pretrans.lua %pre -p -f pre.lua +%posttrans -p -f posttrans.lua %files -f filesystem.list /usr/lib/tmpfiles.d/fs-tmp.conf