diff options
Diffstat (limited to 'install_widgets.sh')
-rwxr-xr-x | install_widgets.sh | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/install_widgets.sh b/install_widgets.sh index 2390873..b5a1acb 100755 --- a/install_widgets.sh +++ b/install_widgets.sh @@ -11,31 +11,31 @@ 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 - flock -w 30 -e /tmp/pkgcmd_lock pkgcmd -i -q -t wgt -p $wgtdir/$wgt && { ok=1; break; } - try=$((try+1)) - sleep 1 - done - [ $ok -eq 1 ] && { - info "$wgt installed successfully" - nbinstall=$((nbinstall+1)) - } || info "failed to install $wgt" + 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 + flock -w 30 -e /tmp/pkgcmd_lock pkgcmd -i -q -t wgt -p $wgtdir/$wgt && { ok=1; break; } + try=$((try+1)) + sleep 1 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 -USR1 -U $UID tz-launcher - fi + [ $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 -USR1 -U $UID tz-launcher else - info "$wgtdir doesn't contains any widgets (.wgt)" + info "$wgtdir hasn't installed widget (.wgt), init the bases..." + pkgcmd -l + info "init done" fi info "------------- wrt_widgets install end --------------" |