Fix upgrade script 74/144774/2
authorJunghyun Yeon <jungh.yeon@samsung.com>
Fri, 18 Aug 2017 01:28:42 +0000 (10:28 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 21 Aug 2017 07:14:54 +0000 (07:14 +0000)
- Remove unused function
- Add function to remove files at previous location(/opt/usr/apps)
  after coping it to new location

Change-Id: I7a48df2d6c9a78aa6c8d0f4f7e8dbfdcabb3e829
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
data/700.pkgmgr.patch.sh.in

index cd0f1f9..7bf1c09 100644 (file)
@@ -194,6 +194,18 @@ function move_user_wgt_files(){
 
 }
 
+function remove_previous_files(){
+       echo "#remove files from previous location"
+       echo "SELECT package FROM package_info WHERE package_readonly='false' COLLATE NOCASE;" |
+       sqlite3 $PARSER_BACKUP_DB_PATH > $DB_RESULT_FILE
+       
+       while read package
+       do
+               rm -rf $OPT_USR_APPS/$package
+       done < $DB_RESULT_FILE
+       rm -f $DB_RESULT_FILE
+}
+
 function initdb(){
        echo "#pkg_initdb"
        pkg_initdb --ro --partial-rw
@@ -206,20 +218,6 @@ function initdb(){
        pkg_initdb --uid 5001
 }
 
-function migrate_user_tpk(){
-       #run manifest direct install of user tpk pkgs
-       echo ".separator \" \"
-           SELECT package, LOWER(package_type) FROM package_info WHERE package_readonly='false' COLLATE NOCASE AND (package_type='tpk' COLLATE NOCASE OR package_type='wgt' COLLATE NOCASE);" |
-       sqlite3 $PARSER_BACKUP_DB_PATH > $DB_RESULT_FILE
-
-       while read package type
-       do
-               echo "processing $package..."
-               $type-backend -y $package
-       done < $DB_RESULT_FILE
-       rm -f $DB_RESULT_FILE
-}
-
 function remove_files_for_deleted_packages(){
        #delete userdata of packages which are removed in 3.0
        echo "#delete userdata of removed packages"
@@ -388,6 +386,7 @@ remove_unregistered_pkg
 
 move_user_tpk_files
 move_user_wgt_files
+remove_previous_files
 
 initdb
 init_user_tpk_packages