fixes on xwalk install procedure submit/tizen_common/20140529.194900
authorStephane Desneux <stephane.desneux@open.eurogiciel.org>
Thu, 29 May 2014 19:39:28 +0000 (21:39 +0200)
committerStephane Desneux <stephane.desneux@open.eurogiciel.org>
Thu, 29 May 2014 19:39:28 +0000 (21:39 +0200)
Change-Id: I286b7f6c5c40dc6c8bda0444061cd469e835508d
Signed-off-by: Stephane Desneux <stephane.desneux@open.eurogiciel.org>
31 files changed:
BluetoothChat.wgt [deleted file]
annex.desktop [deleted file]
annex.png [deleted file]
annex.wgt [deleted file]
apps/BluetoothChat.wgt [new file with mode: 0644]
apps/annex.desktop [new file with mode: 0644]
apps/annex.png [new file with mode: 0644]
apps/annex.wgt [new file with mode: 0644]
apps/bubblewrap.desktop [new file with mode: 0644]
apps/bubblewrap.png [new file with mode: 0644]
apps/bubblewrap.wgt [new file with mode: 0644]
apps/go.desktop [new file with mode: 0644]
apps/go.png [new file with mode: 0644]
apps/go.wgt [new file with mode: 0644]
apps/mancala.desktop [new file with mode: 0644]
apps/mancala.png [new file with mode: 0644]
apps/mancala.wgt [new file with mode: 0644]
bubblewrap.desktop [deleted file]
bubblewrap.png [deleted file]
bubblewrap.wgt [deleted file]
go.desktop [deleted file]
go.png [deleted file]
go.wgt [deleted file]
install_widgets.sh
mancala.desktop [deleted file]
mancala.png [deleted file]
mancala.wgt [deleted file]
packaging/wrt-widgets.manifest [new file with mode: 0644]
packaging/wrt-widgets.spec
prepare_widgets.sh
xwalk_widgets_preinstall.service [new file with mode: 0644]

diff --git a/BluetoothChat.wgt b/BluetoothChat.wgt
deleted file mode 100644 (file)
index 195ab60..0000000
Binary files a/BluetoothChat.wgt and /dev/null differ
diff --git a/annex.desktop b/annex.desktop
deleted file mode 100644 (file)
index f794694..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-[Desktop Entry]
-Name=Annex
-Type=Application
-Exec=/usr/bin/xwalk-launcher hnabpnbionlaokfnobomjleblmmiefig
-Icon=/opt/share/widget_demo/annex.png
-
diff --git a/annex.png b/annex.png
deleted file mode 100644 (file)
index d664a74..0000000
Binary files a/annex.png and /dev/null differ
diff --git a/annex.wgt b/annex.wgt
deleted file mode 100644 (file)
index e10d451..0000000
Binary files a/annex.wgt and /dev/null differ
diff --git a/apps/BluetoothChat.wgt b/apps/BluetoothChat.wgt
new file mode 100644 (file)
index 0000000..195ab60
Binary files /dev/null and b/apps/BluetoothChat.wgt differ
diff --git a/apps/annex.desktop b/apps/annex.desktop
new file mode 100644 (file)
index 0000000..f794694
--- /dev/null
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Name=Annex
+Type=Application
+Exec=/usr/bin/xwalk-launcher hnabpnbionlaokfnobomjleblmmiefig
+Icon=/opt/share/widget_demo/annex.png
+
diff --git a/apps/annex.png b/apps/annex.png
new file mode 100644 (file)
index 0000000..d664a74
Binary files /dev/null and b/apps/annex.png differ
diff --git a/apps/annex.wgt b/apps/annex.wgt
new file mode 100644 (file)
index 0000000..e10d451
Binary files /dev/null and b/apps/annex.wgt differ
diff --git a/apps/bubblewrap.desktop b/apps/bubblewrap.desktop
new file mode 100644 (file)
index 0000000..24df394
--- /dev/null
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Name=Bubblewrap
+Type=Application
+Exec=/usr/bin/xwalk-launcher kmnbdhfbkjkeilhpbooaecgpllbollfn
+Icon=/opt/share/widget_demo/bubblewrap.png
+
diff --git a/apps/bubblewrap.png b/apps/bubblewrap.png
new file mode 100644 (file)
index 0000000..4301515
Binary files /dev/null and b/apps/bubblewrap.png differ
diff --git a/apps/bubblewrap.wgt b/apps/bubblewrap.wgt
new file mode 100644 (file)
index 0000000..2619403
Binary files /dev/null and b/apps/bubblewrap.wgt differ
diff --git a/apps/go.desktop b/apps/go.desktop
new file mode 100644 (file)
index 0000000..bf38f9f
--- /dev/null
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Name=Go
+Type=Application
+Exec=/usr/bin/xwalk-launcher clnlcbphcafhecdadfkjddinnigipace
+Icon=/opt/share/widget_demo/go.png
+
diff --git a/apps/go.png b/apps/go.png
new file mode 100644 (file)
index 0000000..5701af9
Binary files /dev/null and b/apps/go.png differ
diff --git a/apps/go.wgt b/apps/go.wgt
new file mode 100644 (file)
index 0000000..10fe171
Binary files /dev/null and b/apps/go.wgt differ
diff --git a/apps/mancala.desktop b/apps/mancala.desktop
new file mode 100644 (file)
index 0000000..41a31e9
--- /dev/null
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Name=Mancala
+Type=Application
+Exec=/usr/bin/xwalk-launcher fidoaebfkacalgdedfodionhmopneipb
+Icon=/opt/share/widget_demo/mancala.png
+
diff --git a/apps/mancala.png b/apps/mancala.png
new file mode 100644 (file)
index 0000000..89f5ca3
Binary files /dev/null and b/apps/mancala.png differ
diff --git a/apps/mancala.wgt b/apps/mancala.wgt
new file mode 100644 (file)
index 0000000..7ca4a07
Binary files /dev/null and b/apps/mancala.wgt differ
diff --git a/bubblewrap.desktop b/bubblewrap.desktop
deleted file mode 100644 (file)
index 24df394..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-[Desktop Entry]
-Name=Bubblewrap
-Type=Application
-Exec=/usr/bin/xwalk-launcher kmnbdhfbkjkeilhpbooaecgpllbollfn
-Icon=/opt/share/widget_demo/bubblewrap.png
-
diff --git a/bubblewrap.png b/bubblewrap.png
deleted file mode 100644 (file)
index 4301515..0000000
Binary files a/bubblewrap.png and /dev/null differ
diff --git a/bubblewrap.wgt b/bubblewrap.wgt
deleted file mode 100644 (file)
index 2619403..0000000
Binary files a/bubblewrap.wgt and /dev/null differ
diff --git a/go.desktop b/go.desktop
deleted file mode 100644 (file)
index bf38f9f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-[Desktop Entry]
-Name=Go
-Type=Application
-Exec=/usr/bin/xwalk-launcher clnlcbphcafhecdadfkjddinnigipace
-Icon=/opt/share/widget_demo/go.png
-
diff --git a/go.png b/go.png
deleted file mode 100644 (file)
index 5701af9..0000000
Binary files a/go.png and /dev/null differ
diff --git a/go.wgt b/go.wgt
deleted file mode 100644 (file)
index 10fe171..0000000
Binary files a/go.wgt and /dev/null differ
index 1d574fdc03b2f0bf6a0f688b412851769a524636..ee28e6f154ee2bd8f3169d6fff2e10bec3436028 100755 (executable)
@@ -1,62 +1,48 @@
 #!/bin/sh
 
+. /etc/tizen-platform.conf
+
+function info() {
+       local ts=$(date +%Y%m%d.%H%M%S)
+       echo $ts "$@" >&2
+}
+
+function do_install() {
+       info "------------- wrt_widgets install start --------------"
+
+       local wgtdir=${TZ_SYS_SHARE}/widget_demo
+       if [ -n "$(ls $wgtdir/*.wgt 2> /dev/null)" ]; then
+               local nbinstall=0
+               for wgt in $(grep "^$USER" $wgtdir/install.conf | cut -f2 -d':'); do
+                       info "installing $wgt" 
+                       local try=1
+                       local ok=0
+                       while [ $try -le 3 ]; do
+                               xwalkctl -i $wgtdir/$wgt && { ok=1; break; }
+                               try=$((try+1))
+                               sleep 3
+                       done
+                       [ $ok -eq 1 ] && {
+                               info "$wgt installed successfully" 
+                               nbinstall=$((nbinstall+1))
+                       } || info "failed to install $wgt" 
+               done
+
+               # signal tz-launcher that new apps were installed
+               info "$nbinstall applications installed" 
+               if [ $nbinstall -gt 0 ]; then
+                       info "sending restart signal to tz-launcher"
+                       pkill -U $UID -USR1 tz-launcher
+               fi
+       else
+          info "$wgtdir doesn't contains any widgets (.wgt)" 
+       fi
 
-#echo "Widget Installation"
-#if [ "$(id -u)" != "0" ]; then
-#   echo "This script must be run as root" >&2
-#   exit 1
-#fi
-
-source /etc/tizen-platform.conf
+       info "------------- wrt_widgets install end --------------"
+}
 
-wgtdir=${TZ_SYS_SHARE}/widget_demo
-if [ -z "$(ls $wgtdir/*.wgt 2> /dev/null)" ]; then
-   echo "$wgtdir doesn't contains any widgets (.wgt)" 1>&2
-   exit 1
-fi
+do_install >>~/.applications/install.log 2>&1 </dev/null &
 
-for wgt in $(grep "^$USER" $wgtdir/install.conf | cut -f2 -d':'); do
-    echo "installing $wgt"
-       if [ -x /usr/bin/wrt-installer ]; then
-               wrt-installer -i $wgtdir/$wgt
-       else
-               xwalkctl -i $wgtdir/$wgt
-       fi
-done
-
-[[ "$(id -u)" == "0" ]] && chmod -R a+rw ${TZ_SYS_DB}/
-
-if [ -x /usr/bin/wrt-launcher ]; then
-       repo=${TZ_USER_APP}/
-
-       wrt-launcher --list |
-       awk 'NR>2{print $2, $5, $6}' |
-       while read name packid appid
-       do
-               bin=$repo/$packid/bin/$appid
-               for x in $repo/$packid/res/wgt/*[iI][cC][oO][nN]*; do
-               if [[ -f $x ]]; then
-                       res=$(file -b $x|cut -d , -f 2|tr -d ' '|egrep '[0-9]+x[0-9]+')
-                       if [[ -n "$res" ]]; then
-                       diric=${TZ_SYS_SHARE}/icons/hicolor/$res/apps
-                       [[ -d $diric ]] || mkdir -p $diric
-                       cp $x $diric/$name.png
-                       fi
-               fi
-          done
-               desk=${TZ_SYS_RO_DESKTOP_APP}/$name.desktop
-               cat << EOC > $desk
-       [Desktop Entry]
-       Type=Application
-       Name=$name
-       Exec=$bin
-       Icon=$name
-       Terminal=false
-       Categories=WRT;Game
-EOC
-       done
-fi
-
-#update-desktop-database
-#xdg-icon-resource forceupdate
+# never fail
+exit 0
 
diff --git a/mancala.desktop b/mancala.desktop
deleted file mode 100644 (file)
index 41a31e9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-[Desktop Entry]
-Name=Mancala
-Type=Application
-Exec=/usr/bin/xwalk-launcher fidoaebfkacalgdedfodionhmopneipb
-Icon=/opt/share/widget_demo/mancala.png
-
diff --git a/mancala.png b/mancala.png
deleted file mode 100644 (file)
index 89f5ca3..0000000
Binary files a/mancala.png and /dev/null differ
diff --git a/mancala.wgt b/mancala.wgt
deleted file mode 100644 (file)
index 7ca4a07..0000000
Binary files a/mancala.wgt and /dev/null differ
diff --git a/packaging/wrt-widgets.manifest b/packaging/wrt-widgets.manifest
new file mode 100644 (file)
index 0000000..017d22d
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+    <domain name="_"/>
+ </request>
+</manifest>
index 2d973db7c9447f11380df8aa3ce14ca93ad337d3..addeb2f726f3cfa5a7dc0b528220a62e78a154eb 100644 (file)
@@ -6,16 +6,18 @@ Group:      Web Framework/Web Run Time
 License:    Apache-2.0
 BuildArch:  noarch
 Source0:    %{name}-%{version}.tar.gz
+Source1001: wrt-widgets.manifest
 BuildRequires: pkgconfig(libtzplatform-config)
 Requires:   libtzplatform-config
 Requires:   desktop-skin
 
 %description
 Wrt-widgets prepare a suitable pc oriented environment to install Web apps
-After installing wrt-widgets, launch install_widgets.sh script as root to install them.
+After installing wrt-widgets, widgets will be installed at first boot.
 
 %prep
 %setup -q
+cp %{SOURCE1001} .
 
 %build
 
@@ -26,14 +28,28 @@ cp install_widgets.sh %{buildroot}/%{_bindir}
 cp prepare_widgets.sh %{buildroot}/%{_bindir}
 
 mkdir -p  %{buildroot}/%{TZ_SYS_SHARE}/widget_demo
-cp -r *.wgt %{buildroot}/%{TZ_SYS_SHARE}/widget_demo/
-cp -r *.png %{buildroot}/%{TZ_SYS_SHARE}/widget_demo/
-cp -r *.desktop %{buildroot}/%{TZ_SYS_SHARE}/widget_demo/
+cp -r apps/*.wgt %{buildroot}/%{TZ_SYS_SHARE}/widget_demo/
+#cp -r apps/*.png %{buildroot}/%{TZ_SYS_SHARE}/widget_demo/
+#cp -r apps/*.desktop %{buildroot}/%{TZ_SYS_SHARE}/widget_demo/
 cp install.conf %{buildroot}/%{TZ_SYS_SHARE}/widget_demo/
 
+# install xwalk preinstall service in user session
+mkdir -p %{buildroot}%{_unitdir_user}
+install -m 644 xwalk_widgets_preinstall.service %{buildroot}%{_unitdir_user}/
+
 %post
+# setup xwalk preinstall service (inside user session)
+mkdir -p %{_unitdir_user}/default.target.wants/
+ln -sf ../xwalk_widgets_preinstall.service %{_unitdir_user}/default.target.wants/
+
+%postun
+rm -f %{_unitdir_user}/default.target.wants/xwalk_widgets_preinstall.service
 
 %files
+%manifest %{name}.manifest
+%defattr(-,root,root)
 %{TZ_SYS_SHARE}/widget_demo/*
 %attr(755,root,root) %{_bindir}/install_widgets.sh
 %attr(755,root,root) %{_bindir}/prepare_widgets.sh
+%{_unitdir_user}/xwalk_widgets_preinstall.service
+
index 4b6972a2af522a5d0e6c158076f87f3a3c9e1277..7dec9718a8ea9f5eae53df5e830abed40cfcd542 100755 (executable)
@@ -15,14 +15,9 @@ vconftool set -t string db/setting/accessibility/font_name "HelveticaNeue"
 ########################################################################
 #  PC Specific Environment settings
 
-
 mkdir -p ${TZ_SYS_RW_PACKAGES}
 rm -f ${TZ_SYS_DB}/.wrt*
 
-if [ -x /usr/bin/wrt-client ]; then
-       wrt_commons_create_clean_db.sh
-       wrt_reset_db.sh
-fi
 pkg_initdb
 ail_initdb
 
diff --git a/xwalk_widgets_preinstall.service b/xwalk_widgets_preinstall.service
new file mode 100644 (file)
index 0000000..0af7a40
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=Installation of pre-installed widgets
+After=dbus.service
+ConditionPathExists=!%h/.config/xwalk-service/applications.db
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/install_widgets.sh
+
+[Install]
+WantedBy=default.target
+EOF
+