From c4bcbadb936730fed1587b0e1d54902a7e4dfa8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Bollo?= Date: Tue, 10 Feb 2015 15:17:29 +0100 Subject: Refactoring installation of demos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The demos were installed by creating files in user directories. This is now changed to install files in the directory /opt/share/qt-demos. Then during user startup, a service is run by systemd (preinstall-qt-demos) that checks wether demos are installed or not. It installs the demo if needed. This patch improves a little the packaging of the demos but work remains to be done: removing hard coded path to /opt/share and replace it with build variables; improve the configuration of the settings. Change-Id: Ice5d11e8d50aaccaa94995b2680cdfc273d27664 Signed-off-by: José Bollo --- packaging/qt-tizen.spec | 17 ++++++++++--- preinstall-qt-demos.service | 11 ++++++++ preinstall-qt-demos.sh | 28 +++++++++++++++++++++ qt-tizen.manifest | 6 +++++ .../home/bob/.applications/desktop/maroon.desktop | 6 ----- .../carol/.applications/desktop/samegame.desktop | 6 ----- rootfs/home/guest/video.qml | 18 ------------- rootfs/opt/share/widget_demo/maroon.png | Bin 4745 -> 0 bytes rootfs/opt/share/widget_demo/samegame.png | Bin 2822 -> 0 bytes rootfs/usr/bin/launch_video_qt.sh | 2 +- rootfs/usr/share/qt-tizen-demo/maroon.desktop | 6 +++++ rootfs/usr/share/qt-tizen-demo/maroon.png | Bin 0 -> 4745 bytes rootfs/usr/share/qt-tizen-demo/samegame.desktop | 6 +++++ rootfs/usr/share/qt-tizen-demo/samegame.png | Bin 0 -> 2822 bytes rootfs/usr/share/qt-tizen-demo/video.qml | 18 +++++++++++++ 15 files changed, 89 insertions(+), 35 deletions(-) create mode 100644 preinstall-qt-demos.service create mode 100755 preinstall-qt-demos.sh create mode 100644 qt-tizen.manifest delete mode 100644 rootfs/home/bob/.applications/desktop/maroon.desktop delete mode 100644 rootfs/home/carol/.applications/desktop/samegame.desktop delete mode 100644 rootfs/home/guest/video.qml delete mode 100644 rootfs/opt/share/widget_demo/maroon.png delete mode 100644 rootfs/opt/share/widget_demo/samegame.png create mode 100644 rootfs/usr/share/qt-tizen-demo/maroon.desktop create mode 100644 rootfs/usr/share/qt-tizen-demo/maroon.png create mode 100644 rootfs/usr/share/qt-tizen-demo/samegame.desktop create mode 100644 rootfs/usr/share/qt-tizen-demo/samegame.png create mode 100644 rootfs/usr/share/qt-tizen-demo/video.qml diff --git a/packaging/qt-tizen.spec b/packaging/qt-tizen.spec index f03a118..7b92d5b 100644 --- a/packaging/qt-tizen.spec +++ b/packaging/qt-tizen.spec @@ -76,6 +76,9 @@ Add some links to launcher %install %make_install +mkdir -p %{buildroot}/%{_bindir} %{buildroot}/%{_unitdir_user} +install preinstall-qt-demos.sh %{buildroot}/%{_bindir} +install preinstall-qt-demos.service %{buildroot}/%{_unitdir_user} #%fdupes %{buildroot} @@ -83,14 +86,20 @@ Add some links to launcher %postun -p /sbin/ldconfig +%post demo +mkdir -p %{_unitdir_user}/default.target.wants/ +ln -sf ../preinstall-qt-demos.service %{_unitdir_user}/default.target.wants/ + %files %files full %files demo +%manifest %{name}.manifest %defattr(-,root,root) -/home/*/.applications/desktop/* -/home/*/*.qml -/opt/share/widget_demo/* -%{_bindir}/*.sh +%attr(755,root,root) %{_bindir}/preinstall-qt-demos.sh +%attr(644,root,root) %{_unitdir_user}/preinstall-qt-demos.service +%attr(644,root,root) /usr/share/qt-tizen-demo/* +%attr(755,root,root) %{_bindir}/launch_video_qt.sh + diff --git a/preinstall-qt-demos.service b/preinstall-qt-demos.service new file mode 100644 index 0000000..e6157bc --- /dev/null +++ b/preinstall-qt-demos.service @@ -0,0 +1,11 @@ +[Unit] +Description=Installation of pre-installed qt-demos +ConditionPathExists=!%h/.applications/.qt-demos-installed + +[Service] +Type=idle +ExecStart=/usr/bin/preinstall-qt-demos.sh + +[Install] +WantedBy=default.target + diff --git a/preinstall-qt-demos.sh b/preinstall-qt-demos.sh new file mode 100755 index 0000000..c524809 --- /dev/null +++ b/preinstall-qt-demos.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +test -e ~/.applications/.qt-demos-installed && exit + +. /etc/tizen-platform.conf + +mkdir -p ~/.applications/desktop 2> /dev/null + +changed=false + +cat << EOC | +carol samegame +bob maroon +EOC +awk -v "user=${USER}" '$1==user{print $2}' | +while read demo +do + if test -f "${TZ_SYS_SHARE}/qt-tizen-demo/${demo}.desktop" + then + cp "${TZ_SYS_SHARE}/qt-tizen-demo/${demo}.desktop" ~/.applications/desktop + changed=true + fi +done + +$changed && pkill -U "${UID}" -USR1 tz-launcher +touch ~/.applications/.qt-demos-installed + + diff --git a/qt-tizen.manifest b/qt-tizen.manifest new file mode 100644 index 0000000..9b5140d --- /dev/null +++ b/qt-tizen.manifest @@ -0,0 +1,6 @@ + + + + + + diff --git a/rootfs/home/bob/.applications/desktop/maroon.desktop b/rootfs/home/bob/.applications/desktop/maroon.desktop deleted file mode 100644 index 6b70256..0000000 --- a/rootfs/home/bob/.applications/desktop/maroon.desktop +++ /dev/null @@ -1,6 +0,0 @@ -[Desktop Entry] -Name=Maroon -Type=Application -Exec=qmlscene /usr/share/qt5/qt5-qtdeclarative/examples/quick/demos/maroon/maroon.qml -Icon=/opt/share/widget_demo/maroon.png - diff --git a/rootfs/home/carol/.applications/desktop/samegame.desktop b/rootfs/home/carol/.applications/desktop/samegame.desktop deleted file mode 100644 index 71b4f4d..0000000 --- a/rootfs/home/carol/.applications/desktop/samegame.desktop +++ /dev/null @@ -1,6 +0,0 @@ -[Desktop Entry] -Name=Samegame -Type=Application -Exec=qmlscene /usr/share/qt5/qt5-qtdeclarative/examples/quick/demos/samegame/samegame.qml -Icon=/opt/share/widget_demo/samegame.png - diff --git a/rootfs/home/guest/video.qml b/rootfs/home/guest/video.qml deleted file mode 100644 index 6612b66..0000000 --- a/rootfs/home/guest/video.qml +++ /dev/null @@ -1,18 +0,0 @@ -import QtQuick 2.0 -import QtMultimedia 5.0 - -Rectangle { - width: 480 - height: 270 - - MediaPlayer { - id: player - source: "/usr/share/media/videos/AmazingNature_480p.mp4" // Point this to a suitable video file - autoPlay: true - } - - VideoOutput { - source: player - anchors.fill: parent - } -} diff --git a/rootfs/opt/share/widget_demo/maroon.png b/rootfs/opt/share/widget_demo/maroon.png deleted file mode 100644 index 0f50443..0000000 Binary files a/rootfs/opt/share/widget_demo/maroon.png and /dev/null differ diff --git a/rootfs/opt/share/widget_demo/samegame.png b/rootfs/opt/share/widget_demo/samegame.png deleted file mode 100644 index 8a79156..0000000 Binary files a/rootfs/opt/share/widget_demo/samegame.png and /dev/null differ diff --git a/rootfs/usr/bin/launch_video_qt.sh b/rootfs/usr/bin/launch_video_qt.sh index 2af1472..0488d60 100755 --- a/rootfs/usr/bin/launch_video_qt.sh +++ b/rootfs/usr/bin/launch_video_qt.sh @@ -1,2 +1,2 @@ #!/bin/sh -qmlscene /home/guest/video.qml +qmlscene /usr/share/qt-tizen-demo/video.qml diff --git a/rootfs/usr/share/qt-tizen-demo/maroon.desktop b/rootfs/usr/share/qt-tizen-demo/maroon.desktop new file mode 100644 index 0000000..495e7e9 --- /dev/null +++ b/rootfs/usr/share/qt-tizen-demo/maroon.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=Maroon +Type=Application +Exec=qmlscene /usr/share/qt5/qt5-qtdeclarative/examples/quick/demos/maroon/maroon.qml +Icon=/usr/share/qt-tizen-demo/maroon.png + diff --git a/rootfs/usr/share/qt-tizen-demo/maroon.png b/rootfs/usr/share/qt-tizen-demo/maroon.png new file mode 100644 index 0000000..0f50443 Binary files /dev/null and b/rootfs/usr/share/qt-tizen-demo/maroon.png differ diff --git a/rootfs/usr/share/qt-tizen-demo/samegame.desktop b/rootfs/usr/share/qt-tizen-demo/samegame.desktop new file mode 100644 index 0000000..7f2007b --- /dev/null +++ b/rootfs/usr/share/qt-tizen-demo/samegame.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=Samegame +Type=Application +Exec=qmlscene /usr/share/qt5/qt5-qtdeclarative/examples/quick/demos/samegame/samegame.qml +Icon=/usr/share/qt-tizen-demo/samegame.png + diff --git a/rootfs/usr/share/qt-tizen-demo/samegame.png b/rootfs/usr/share/qt-tizen-demo/samegame.png new file mode 100644 index 0000000..8a79156 Binary files /dev/null and b/rootfs/usr/share/qt-tizen-demo/samegame.png differ diff --git a/rootfs/usr/share/qt-tizen-demo/video.qml b/rootfs/usr/share/qt-tizen-demo/video.qml new file mode 100644 index 0000000..6612b66 --- /dev/null +++ b/rootfs/usr/share/qt-tizen-demo/video.qml @@ -0,0 +1,18 @@ +import QtQuick 2.0 +import QtMultimedia 5.0 + +Rectangle { + width: 480 + height: 270 + + MediaPlayer { + id: player + source: "/usr/share/media/videos/AmazingNature_480p.mp4" // Point this to a suitable video file + autoPlay: true + } + + VideoOutput { + source: player + anchors.fill: parent + } +} -- cgit v1.2.3