diff options
author | Stephane Desneux <stephane.desneux@open.eurogiciel.org> | 2014-05-29 21:39:28 +0200 |
---|---|---|
committer | Stephane Desneux <stephane.desneux@open.eurogiciel.org> | 2014-05-29 21:39:28 +0200 |
commit | 2423755f875dce6a5d9855ff0ad01bf19a10afc1 (patch) | |
tree | eae734e3aca51879147f3e4a2cabfe769987a00b | |
parent | cf15e83e2f7579dcf184ff97e0ef4ec2bf96ab9b (diff) | |
download | wrt-widgets-2423755f875dce6a5d9855ff0ad01bf19a10afc1.tar.gz wrt-widgets-2423755f875dce6a5d9855ff0ad01bf19a10afc1.tar.bz2 wrt-widgets-2423755f875dce6a5d9855ff0ad01bf19a10afc1.zip |
fixes on xwalk install proceduresubmit/tizen_common/20140529.194900
Change-Id: I286b7f6c5c40dc6c8bda0444061cd469e835508d
Signed-off-by: Stephane Desneux <stephane.desneux@open.eurogiciel.org>
-rw-r--r-- | apps/BluetoothChat.wgt (renamed from BluetoothChat.wgt) | bin | 35236 -> 35236 bytes | |||
-rw-r--r-- | apps/annex.desktop (renamed from annex.desktop) | 0 | ||||
-rw-r--r-- | apps/annex.png (renamed from annex.png) | bin | 2141 -> 2141 bytes | |||
-rw-r--r-- | apps/annex.wgt (renamed from annex.wgt) | bin | 3644204 -> 3644204 bytes | |||
-rw-r--r-- | apps/bubblewrap.desktop (renamed from bubblewrap.desktop) | 0 | ||||
-rw-r--r-- | apps/bubblewrap.png (renamed from bubblewrap.png) | bin | 2239 -> 2239 bytes | |||
-rw-r--r-- | apps/bubblewrap.wgt (renamed from bubblewrap.wgt) | bin | 4439022 -> 4439022 bytes | |||
-rw-r--r-- | apps/go.desktop (renamed from go.desktop) | 0 | ||||
-rw-r--r-- | apps/go.png (renamed from go.png) | bin | 2006 -> 2006 bytes | |||
-rw-r--r-- | apps/go.wgt (renamed from go.wgt) | bin | 5039277 -> 5039277 bytes | |||
-rw-r--r-- | apps/mancala.desktop (renamed from mancala.desktop) | 0 | ||||
-rw-r--r-- | apps/mancala.png (renamed from mancala.png) | bin | 2590 -> 2590 bytes | |||
-rw-r--r-- | apps/mancala.wgt (renamed from mancala.wgt) | bin | 1504139 -> 1504139 bytes | |||
-rwxr-xr-x | install_widgets.sh | 98 | ||||
-rw-r--r-- | packaging/wrt-widgets.manifest | 5 | ||||
-rw-r--r-- | packaging/wrt-widgets.spec | 24 | ||||
-rwxr-xr-x | prepare_widgets.sh | 5 | ||||
-rw-r--r-- | xwalk_widgets_preinstall.service | 13 |
18 files changed, 80 insertions, 65 deletions
diff --git a/BluetoothChat.wgt b/apps/BluetoothChat.wgt Binary files differindex 195ab60..195ab60 100644 --- a/BluetoothChat.wgt +++ b/apps/BluetoothChat.wgt diff --git a/annex.desktop b/apps/annex.desktop index f794694..f794694 100644 --- a/annex.desktop +++ b/apps/annex.desktop diff --git a/annex.png b/apps/annex.png Binary files differindex d664a74..d664a74 100644 --- a/annex.png +++ b/apps/annex.png diff --git a/annex.wgt b/apps/annex.wgt Binary files differindex e10d451..e10d451 100644 --- a/annex.wgt +++ b/apps/annex.wgt diff --git a/bubblewrap.desktop b/apps/bubblewrap.desktop index 24df394..24df394 100644 --- a/bubblewrap.desktop +++ b/apps/bubblewrap.desktop diff --git a/bubblewrap.png b/apps/bubblewrap.png Binary files differindex 4301515..4301515 100644 --- a/bubblewrap.png +++ b/apps/bubblewrap.png diff --git a/bubblewrap.wgt b/apps/bubblewrap.wgt Binary files differindex 2619403..2619403 100644 --- a/bubblewrap.wgt +++ b/apps/bubblewrap.wgt diff --git a/go.desktop b/apps/go.desktop Binary files differBinary files differindex bf38f9f..bf38f9f 100644 --- a/go.desktop +++ b/apps/go.desktop diff --git a/mancala.desktop b/apps/mancala.desktop index 41a31e9..41a31e9 100644 --- a/mancala.desktop +++ b/apps/mancala.desktop diff --git a/mancala.png b/apps/mancala.png Binary files differindex 89f5ca3..89f5ca3 100644 --- a/mancala.png +++ b/apps/mancala.png diff --git a/mancala.wgt b/apps/mancala.wgt Binary files differindex 7ca4a07..7ca4a07 100644 --- a/mancala.wgt +++ b/apps/mancala.wgt diff --git a/install_widgets.sh b/install_widgets.sh index 1d574fd..ee28e6f 100755 --- a/install_widgets.sh +++ b/install_widgets.sh @@ -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/packaging/wrt-widgets.manifest b/packaging/wrt-widgets.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/packaging/wrt-widgets.manifest @@ -0,0 +1,5 @@ +<manifest> + <request> + <domain name="_"/> + </request> +</manifest> diff --git a/packaging/wrt-widgets.spec b/packaging/wrt-widgets.spec index 2d973db..addeb2f 100644 --- a/packaging/wrt-widgets.spec +++ b/packaging/wrt-widgets.spec @@ -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 + diff --git a/prepare_widgets.sh b/prepare_widgets.sh index 4b6972a..7dec971 100755 --- a/prepare_widgets.sh +++ b/prepare_widgets.sh @@ -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 index 0000000..0af7a40 --- /dev/null +++ b/xwalk_widgets_preinstall.service @@ -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 + |