Disable sbin-merge changes

%bcond merged_sbin is added, with a default of 0.

With the default state, the spec file should behave identically to the version
before any changes related to the sbin merge we started. (In the pretrans
scriptlet, the order of mkdirs is different, but that shouldn't matter.)
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2024-07-17 09:21:49 +02:00
parent 9a7998077e
commit c874ad66ba

View File

@ -1,3 +1,5 @@
%bcond merged_sbin 0
Summary: The basic directory layout for a Linux system
Name: filesystem
Version: 3.18
@ -14,10 +16,12 @@ Requires(pre): setup
Provides: filesystem-afs = %{version}-%{release}
Obsoletes: filesystem-afs <= 3.14-2
%if %{with merged_sbin}
# A virtual provides that packages can use to make sure that the
# symlinks from /usr/sbin/foo to /usr/bin/foo will be automatically
# created (if /usr/sbin is not a symlink itself).
Provides: filesystem(unmerged-sbin-symlinks) = 1
%endif
# This is needed for rpm-4.20
%global debug_package %{nil}
@ -65,7 +69,6 @@ ln -snf ../var/tmp usr/tmp
ln -snf spool/mail var/mail
ln -snf usr/bin bin
ln -snf usr/sbin sbin
ln -snf bin usr/sbin
ln -snf usr/lib lib
ln -snf usr/%{_lib} %{_lib}
ln -snf ../run var/run
@ -75,7 +78,14 @@ ln -snf usr/lib usr/lib/debug/lib
ln -snf usr/%{_lib} usr/lib/debug/%{_lib}
ln -snf ../.dwz usr/lib/debug/usr/.dwz
ln -snf usr/sbin usr/lib/debug/sbin
%if %{with merged_sbin}
ln -snf bin usr/sbin
ln -snf bin usr/local/sbin
%else
mkdir -p usr/sbin
mkdir -p usr/local/sbin
%endif
sed -n -f %{buildroot}/iso_639.sed /usr/share/xml/iso-codes/iso_639.xml \
>%{buildroot}/iso_639.tab
@ -146,15 +156,12 @@ find %{buildroot} -mindepth 0 | sed -e 's|%{buildroot}|/|' -e 's|//|/|' \
--# later.
posix.mkdir("/usr")
posix.mkdir("/usr/bin")
posix.symlink("bin", "/usr/sbin")
posix.mkdir("/usr/lib")
posix.mkdir("/usr/lib/debug")
posix.mkdir("/usr/lib/debug/usr/")
posix.mkdir("/usr/lib/debug/usr/bin")
posix.symlink("bin", "/usr/lib/debug/usr/sbin")
posix.mkdir("/usr/lib/debug/usr/lib")
posix.mkdir("/usr/lib/debug/usr/%{_lib}")
posix.symlink("bin", "/usr/local/sbin")
posix.mkdir("/usr/%{_lib}")
posix.symlink("usr/bin", "/bin")
posix.symlink("usr/sbin", "/sbin")
@ -178,6 +185,16 @@ posix.mkdir("/var")
posix.symlink("../run", "/var/run")
posix.symlink("../run/lock", "/var/lock")
%if %{with merged_sbin}
posix.symlink("bin", "/usr/sbin")
posix.symlink("bin", "/usr/lib/debug/usr/sbin")
posix.symlink("bin", "/usr/local/sbin")
%else
posix.mkdir("/usr/sbin")
posix.mkdir("/usr/lib/debug/usr/sbin")
%endif
%if %{with merged_sbin}
%global sbin_filenames %{lua:
print('{\\n')
io.input(sources[4])
@ -324,6 +341,7 @@ for _,path in pairs({"/usr/sbin", "/usr/local/sbin"}) do
end
end
}
%endif
%posttrans -p <lua>
--# we need to restorecon on some dirs created in %pretrans or by other packages
@ -332,10 +350,12 @@ if posix.access ("/usr/sbin/restorecon", "x") then
rpm.execute("/usr/sbin/restorecon", "-r", "/usr/lib/debug")
end
%if %{with merged_sbin}
%merge_scriptlet
%transfiletriggerpostun -p <lua> -- /sbin /usr/sbin
%merge_scriptlet
%endif
%files content
%dir %{_datadir}/filesystem
@ -377,7 +397,11 @@ end
%attr(1777,root,root) /tmp
%dir /usr
%attr(555,root,root) /usr/bin
%if %{with merged_sbin}
%ghost /usr/sbin
%else
%attr(555,root,root) /usr/sbin
%endif
/usr/games
/usr/include
%dir %attr(555,root,root) /usr/lib
@ -411,7 +435,11 @@ end
%endif
/usr/libexec
%dir /usr/local
%if %{with merged_sbin}
%ghost /usr/local/sbin
%else
/usr/local/sbin
%endif
/usr/local/etc
/usr/local/bin
/usr/local/games