Fix zypper conflict about directory -> symlink workaround (bsc#1244458)

This commit is contained in:
Takashi Iwai
2025-06-12 09:05:23 +02:00
parent 19967e19b2
commit 6f6d0c4323
3 changed files with 47 additions and 68 deletions

View File

@@ -169,41 +169,28 @@ scripts/install-licenses.sh nvidia %{buildroot}%{_licensedir}/%{name}
install -c -D -m 0644 WHENCE %{buildroot}%{_licensedir}/%{name}/WHENCE
install -c -D -m 0644 README.md %{buildroot}%{_docdir}/%{name}/README.md
%pre
# ugly workaround for changing nvidia/ad103 & co to symlinks (bsc#1243843)
for d in ad103 ad104 ad106 ad107; do
if [ ! -L %{_firmwaredir}/nvidia/$d ]; then
if [ -d %{_firmwaredir}/nvidia/$d ]; then
mv %{_firmwaredir}/nvidia/$d %{_firmwaredir}/nvidia/$d.xxxold
fi
fi
done
%post
# ugly workaround (bsc#1243843)
if [ -d %{_firmwaredir}/nvidia/ad103.xxxold ]; then
for d in ad103 ad104 ad106 ad107; do
mv %{_firmwaredir}/nvidia/$d %{_firmwaredir}/nvidia/$d.xxxnew
if [ -d %{_firmwaredir}/nvidia/$d.xxxold ]; then
mv %{_firmwaredir}/nvidia/$d.xxxold %{_firmwaredir}/nvidia/$d
fi
done
%pretrans -p <lua>
if not macros then
fwdir = "/lib/firmware"
else
%{?regenerate_initrd_post}
fi
%postun
%{?regenerate_initrd_post}
%posttrans
# ugly workaround (bsc#1243843)
for d in ad103 ad104 ad106 ad107; do
if [ -L %{_firmwaredir}/nvidia/$d.xxxnew ]; then
rm -rf %{_firmwaredir}/nvidia/$d
mv %{_firmwaredir}/nvidia/$d.xxxnew %{_firmwaredir}/nvidia/$d
fi
done
%{?regenerate_initrd_posttrans}
fwdir = macros._firmwaredir
end
paths = {"ad103", "ad104", "ad106", "ad107"}
for i = 1, 4 do
path = fwdir .. "/nvidia/" .. paths[i]
st = posix.stat(path)
if st and st.type == "directory" then
status = os.rename(path, path .. ".rpmmoved")
if not status then
suffix = 0
while not status do
suffix = suffix + 1
status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
end
os.rename(path, path .. ".rpmmoved")
end
end
end
%files
%doc %{_docdir}/%{name}