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