From: Jiho Chu Date: Mon, 9 May 2022 03:08:45 +0000 (+0900) Subject: [Build/Workaround] Add dtv feature to backup/restore files X-Git-Tag: submit/tizen/20220919.014846~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c990fea7ad02f9852b3fb03d59ac58edf37e710;p=platform%2Fadaptation%2Fnpu%2Ftrix-engine.git [Build/Workaround] Add dtv feature to backup/restore files Backup/Restore scripts are provided to solve conflict with soc-npu-user-libs. When it installs, it will backup files which will be installed to /root directory. And rpm shows information both packages are installed. After developing npu-enigne, it will restore previously backup files while it removes package. To enable this feature, build with 'dtv' definition. $ vbs build -A armv7l --include-all --define 'dtv 1' Signed-off-by: Jiho Chu --- diff --git a/packaging/npu-engine.spec b/packaging/npu-engine.spec index 943a438..2aba823 100644 --- a/packaging/npu-engine.spec +++ b/packaging/npu-engine.spec @@ -93,6 +93,25 @@ chsmack -a "User::App::Shared" /tmp/npu-engine-pid.txt chsmack -a "User::App::Shared" /tmp/npu-engine.log %endif +# Backup/Restore scripts are provided for workaround to solve the conflict with soc-npu-user-libs +%if 0%{?dtv} +%pre +# backup files only in install case +if [ $1 -eq 1 ]; then +mkdir -p /root/npu-engine +cp %{_libdir}/libnpu-engine*.so /root/npu-engine/ +cp %{_sysconfdir}/npu-engine.ini /root/npu-engine/ +fi + +%postun +# restore files only in uninstall case +if [ $1 -eq 0 ]; then +mv /root/npu-engine/libnpu-engine*.so %{_libdir}/ +mv /root/npu-engine/npu-engine.ini %{_sysconfdir}/ +rm -rf /root/npu-engine +fi +%endif + %files %manifest npu-engine.manifest %defattr(-,root,root,-)