Fixing issues found by prevent2 (49866)
[framework/web/wrt-installer.git] / etc / wrt_preinstall_widgets.sh
index 9742d0d..996d6a3 100755 (executable)
 #    limitations under the License.
 #
 
-_working_dir="/opt/media/Downloads/.preinstallWidgets"
-_widget_temp="/opt/share/widget/*";
+_working_dir="/opt/usr/media/Downloads/.preinstallWidgets"
+_widget_temp="/opt/share/widget/*"
+
+#Reinstall widget during booting
+_temp_widget_path="/opt/share/widget/temp_info"
 
 install_widgets() {
        _wgt_list=`find $_working_dir -name '*.wgt'`
@@ -23,8 +26,8 @@ install_widgets() {
        for list in $_wgt_list
        do
                echo "Install $list"
-               return_string=`wrt-installer -il $list`
-        if [ "$return_string" != "${return_string/installed/}" ]; then
+               return_string=`wrt-installer -i $list 2>&1 | grep -v plugin`
+        if [ "$return_string" != "${return_string/successful/}" ]; then
             echo "$list widget installation success"
             rm -rf $list
         else
@@ -47,10 +50,6 @@ for file in $_widget_temp; do
     fi
 done
 
-
-#Reinstall widget during booting
-_temp_widget_path=/opt/share/widget/temp_info
-
 FILE_LIST=`ls $_temp_widget_path`
 
 if [ -n "$FILE_LIST" ]; then
@@ -60,19 +59,21 @@ if [ -n "$FILE_LIST" ]; then
         line=`cat $FILE_NAME`
         echo "----------------------------------------------------------------"
         echo "UnInstalling widget : $line ..."
-        wrt-installer -up $line
-        echo "Installing widget : $line ..."
-        wrt-installer -i $line
+               return_string=`wrt-installer -up $line 2>&1 | grep -v plugin`
+        echo "Result $return_string"
     done
 else
     echo "There is no reinstall widget."
 fi
 }
 
-if [ ! -d $_working_dir ]; then
-       echo "There is no preinstall widget directory - $_working_dir"
+#Plugin installation is temporary code for window SDK
+/usr/bin/wrt-installer -p
+
+RECOVER_WIDGETS=`ls $_temp_widget_path`
+if [ -n "$RECOVER_WIDGETS" ]; then
+    echo "Start Recover"
     restore_widget
-       exit 1
 fi
 
 install_widgets