Add upgrade script for version 30005 12/207512/2
authorJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 5 Jun 2019 11:37:54 +0000 (20:37 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 5 Jun 2019 11:40:28 +0000 (11:40 +0000)
Related changes:
[pkgmgr-info] : https://review.tizen.org/gerrit/c/platform/core/appfw/pkgmgr-info/+/207513/

Change-Id: Ib36223113944f895b5eafc0455ba0a897378162a
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
CMakeLists.txt
data/updates/upgrade_to_30005.sh.in [new file with mode: 0644]
packaging/pkgmgr-tool.spec

index f688adc..a9ab2a8 100644 (file)
@@ -92,3 +92,5 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/data/updates/upgrade_to_30003.sh.in u
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/upgrade_to_30003.sh DESTINATION /etc/package-manager/updates/)
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/data/updates/upgrade_to_30004.sh.in upgrade_to_30004.sh $ONLY)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/upgrade_to_30004.sh DESTINATION /etc/package-manager/updates/)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/data/updates/upgrade_to_30005.sh.in upgrade_to_30005.sh $ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/upgrade_to_30005.sh DESTINATION /etc/package-manager/updates/)
diff --git a/data/updates/upgrade_to_30005.sh.in b/data/updates/upgrade_to_30005.sh.in
new file mode 100644 (file)
index 0000000..9814028
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+source /etc/tizen-platform.conf
+
+PARSER_DB_NAME=.pkgmgr_parser.db
+CERT_DB_NAME=.pkgmgr_cert.db
+PARSER_DB_PATH=$TZ_SYS_DB/$PARSER_DB_NAME
+CERT_DB_PATH=$TZ_SYS_DB/$CERT_DB_NAME
+
+function migrate_db() {
+       local dbpath=$1
+       echo -e "PRAGMA journal_mode=WAL;" | sqlite3 $dbpath
+       echo "PRAGMA user_version=30005;" | sqlite3 $dbpath
+
+       touch "$dbpath-shm"
+       chown app_fw:app_fw "$dbpath-shm"
+       chsmack -a User::Home "$dbpath-shm"
+       touch "$dbpath-wal"
+       chown app_fw:app_fw "$dbpath-wal"
+       chsmack -a User::Home "$dbpath-wal"
+}
+
+function migrate_user_db() {
+       #get each user db path and call migrate_parser_db for each of it
+
+       find $TZ_SYS_DB/user -name $PARSER_DB_NAME | while read DBPATH
+       do
+               migrate_db $DBPATH
+       done
+}
+
+migrate_db $PARSER_DB_PATH
+migrate_user_db
+migrate_db $CERT_DB_PATH
\ No newline at end of file
index f51bfc1..d0e7c5d 100644 (file)
@@ -76,6 +76,7 @@ update-mime-database %{_datadir}/mime
 %attr(0700,root,root) /etc/package-manager/updates/upgrade_to_30002.sh
 %attr(0700,root,root) /etc/package-manager/updates/upgrade_to_30003.sh
 %attr(0700,root,root) /etc/package-manager/updates/upgrade_to_30004.sh
+%attr(0700,root,root) /etc/package-manager/updates/upgrade_to_30005.sh
 %attr(0700,root,root) /usr/share/upgrade/scripts/701.app2sd.patch.sh
 %attr(0700,root,root) %{_sysconfdir}/opt/upgrade/pkgmgr.patch.sh
 %attr(0700,root,root) /usr/share/fixed_multiuser/scripts/pkgmgr-clear-skel.sh