add pretrans lua code to replce a dir with symlink on update [release 2024.03-2mamba;Thu Apr 11 2024]

This commit is contained in:
Silvan Calarco 2024-04-15 13:19:46 +02:00
parent 6a738640ca
commit 1f822f506f

View File

@ -1,7 +1,7 @@
#%global sof_commit 72a04d57d04c2df6e9dbf4eba0a98f40c252ee0b
Name: alsa-sof-firmware
Version: 2023.12.1
Release: 1mamba
Version: 2024.03
Release: 2mamba
Summary: Firmware and topology files for Sound Open Firmware project
Group: System/Kernel and Hardware
Vendor: openmamba
@ -46,7 +46,7 @@ cp -ar sof* %{buildroot}/usr/lib/firmware/intel/
FILEDIR=$(pwd)
pushd %{buildroot}/usr/lib/firmware
find -P . -name "*.ri" | sed -e '/^.$/d' > $FILEDIR/alsa-sof-firmware.files
#find -P . -name "*.tplg" | sed -e '/^.$/d' >> $FILEDIR/alsa-sof-firmware.files
find -P . -name "*.tplg" | sed -e '/^.$/d' >> $FILEDIR/alsa-sof-firmware.files
find -P . -name "*.ldc" | sed -e '/^.$/d' > $FILEDIR/alsa-sof-firmware.debug-files
find -P . -type d | sed -e '/^.$/d' > $FILEDIR/alsa-sof-firmware.dirs
popd
@ -56,25 +56,45 @@ sed -i -e 's!^!/usr/lib/firmware/!' alsa-sof-firmware.{files,debug-files,dirs}
sed -e 's/^/%%dir /' alsa-sof-firmware.dirs >> alsa-sof-firmware.files
cat alsa-sof-firmware.files
#install -d -m0755 %{buildroot}%{_bindir}
#cp -a tools/* %{buildroot}%{_bindir}/
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%pretrans -p <lua>
-- allow replacing link with dir
path = "/lib/firmware/intel/sof-tplg"
st = posix.stat(path)
if st and st.type == "link" then
os.remove(path)
end
-- allow replacing dir with symlink
path = "/lib/firmware/intel/sof-ace-tplg"
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
%posttrans
# Cleanup after pretrans script above
if [ -e /usr/lib/firmware/intel/sof-ace-tplg.rpmmoved ]; then
rm -rf /usr/lib/firmware/intel/sof-ace-tplg.rpmmoved
fi
:
%files -f alsa-sof-firmware.files
%defattr(-,root,root)
%dir /usr/lib/firmware/intel/sof
/usr/lib/firmware/intel/sof-ace-tplg
%dir /usr/lib/firmware/intel/sof-ipc4
%dir /usr/lib/firmware/intel/sof-ipc4-tplg
%dir /usr/lib/firmware/intel/sof-tplg
/usr/lib/firmware/intel/sof-tplg/*
%dir /usr/lib/firmware/intel/sof-ace-tplg
/usr/lib/firmware/intel/sof-ace-tplg/*
%doc LICENCE.*
#%files tools
@ -86,6 +106,12 @@ end
%defattr(-,root,root)
%changelog
* Thu Apr 11 2024 Silvan Calarco <silvan.calarco@mambasoft.it> 2024.03-2mamba
- add pretrans lua code to replce a dir with symlink on update
* Thu Apr 11 2024 Automatic Build System <autodist@openmamba.org> 2024.03-1mamba
- automatic version update by autodist
* Thu Mar 07 2024 Automatic Build System <autodist@openmamba.org> 2023.12.1-1mamba
- automatic version update by autodist