Modify upgrade script 15/87915/4
authorKichan Kwon <k_c.kwon@samsung.com>
Tue, 6 Sep 2016 10:22:24 +0000 (19:22 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Tue, 20 Sep 2016 06:35:27 +0000 (15:35 +0900)
- Use Tizen 3.0 RO exclude list and move RW exclude list
  (For readbility, modify macros about exclude list)
- Remove output of sluggish module
- Use macro provided by tizen-platform-config

Change-Id: I00915cd79a86ec95e3f4587227b535fb5f3e5371
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
packaging/resourced.spec
scripts/resourced_upgrade.sh
src/CMakeLists.txt
src/common/config.h.in
src/proc-stat/proc-main.c

index 5a4388d..05b3748 100644 (file)
@@ -44,15 +44,15 @@ Source2:    resourced-cpucgroup.service
 
 
 %define exclude_list_file_name resourced_proc_exclude.ini
-%define exclude_list_full_path %{TZ_SYS_ETC}/%{exclude_list_file_name}
-%define exclude_list_opt_full_path %{TZ_SYS_ETC}/%{exclude_list_file_name}
+%define exclude_list_ro_path /etc/%{exclude_list_file_name}
+%define exclude_list_rw_path %{TZ_SYS_ETC}/%{exclude_list_file_name}
 %define database_full_path %{TZ_SYS_GLOBALUSER_DB}/.resourced-datausage.db
 
 %define logging_storage_db_full_path %{TZ_SYS_GLOBALUSER_DB}/.resourced-heart-storage.db
 
 %define rd_config_path /etc/resourced
 
-%define upgrade_script_path /usr/share/upgrade/scripts
+%define upgrade_file_path %{TZ_SYS_RO_SHARE}/upgrade/
 
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(glib-2.0)
@@ -127,9 +127,9 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
         -DARCH=%{ARCH} \
         -DCMAKE_BUILD_TYPE=Release \
         -DEXCLUDE_LIST_FILE_NAME=%{exclude_list_file_name} \
-        -DEXCLUDE_LIST_FULL_PATH=%{exclude_list_full_path} \
+        -DEXCLUDE_LIST_RO_PATH=%{exclude_list_ro_path} \
+        -DEXCLUDE_LIST_RW_PATH=%{exclude_list_rw_path} \
         -DDATABASE_FULL_PATH=%{database_full_path} \
-        -DEXCLUDE_LIST_OPT_FULL_PATH=%{exclude_list_opt_full_path} \
         -DBLOCK_MODULE=%{block_module} \
         -DCPU_MODULE=%{cpu_module} \
         -DFREEZER_MODULE=%{freezer_module} \
@@ -155,8 +155,8 @@ make %{?jobs:-j%jobs}
 rm -rf %{buildroot}
 mkdir -p %{buildroot}/usr/share/license
 cp -f LICENSE %{buildroot}/usr/share/license/%{name}
-mkdir -p %{buildroot}%{upgrade_script_path}
-cp -f scripts/resourced_upgrade.sh %{buildroot}%{upgrade_script_path}
+install -D data/%{exclude_list_file_name} %{buildroot}%{upgrade_file_path}/data/%{exclude_list_file_name}
+install -D scripts/resourced_upgrade.sh %{buildroot}%{upgrade_file_path}/scripts/resourced_upgrade.sh
 
 %make_install
 %if %{?heart_module} == ON
@@ -186,7 +186,7 @@ ln -sf %{_unitdir}/resourced.service %{_sysconfdir}/systemd/default-extra-depend
 #install init.d script
 mkdir -p %{TZ_SYS_ETC}
 #make empty dynamic exclude list for first installation
-touch %{exclude_list_opt_full_path}
+touch %{exclude_list_rw_path}
 
 if [ "$1" = "2" ]; then # upgrade begins
        systemctl start resourced.service
@@ -225,7 +225,7 @@ fi
 %if %{?block_module} == ON
        %config %{rd_config_path}/block.conf
 %endif
-%{exclude_list_full_path}
+%{exclude_list_ro_path}
 %if %{?heart_module} == ON
        %config %{rd_config_path}/heart.conf
        %attr(700, root, root) %{TZ_SYS_ETC}/dump.d/module.d/dump_heart_data.sh
@@ -239,4 +239,6 @@ fi
 %{_unitdir}/mem-stress.service
 %{_unitdir}/graphical.target.wants/mem-stress.service
 %endif
-%{upgrade_script_path}/resourced_upgrade.sh
+#For upgrade
+%{upgrade_file_path}/scripts/resourced_upgrade.sh
+%{upgrade_file_path}/data/%{exclude_list_file_name}
index 70fb06a..c6f1f37 100644 (file)
@@ -1,12 +1,14 @@
 #!/bin/sh
 
-#------------------------------------------#
-# Resourced patch for upgrade (2.4 -> 3.0) #
-#------------------------------------------#
+#---------------------------------------#
+# Resourced upgrade script (2.4 -> 3.0) #
+#---------------------------------------#
 
 # Macro
+source /etc/tizen-platform.conf
+
 DB_DIR_24=/opt/usr/dbspace
-DB_DIR_30=/opt/usr/home/owner/.applications/dbspace
+DB_DIR_30=$TZ_SYS_HOME/owner/.applications/dbspace
 
 DB_APPOPT_24=$DB_DIR_24/.resourced-appopt.db
 DB_APPOPT_30=$DB_DIR_30/.resourced-heart-appopt.db
@@ -19,9 +21,9 @@ DB_DEFAULT_30_SYS=$DB_DIR_24/.resourced-heart-default.db
 DB_DEFAULT_30_USR=$DB_DIR_30/.resourced-heart-default.db
 
 DAT_DIR_24=/opt/usr/data/heart
-DAT_DIR_30=/opt/usr/home/owner/data/heart
+DAT_DIR_30=$TZ_SYS_HOME/owner/data/heart
 
-# Move DB
+# Move HEART DB
 mv $DB_APPOPT_24 $DB_APPOPT_30
 mv $DB_APPOPT_24-journal $DB_APPOPT_30-journal
 mv $DB_STORAGE_24 $DB_STORAGE_30
@@ -40,12 +42,12 @@ chsmack -a User::Home $DB_STORAGE_30
 chsmack -a User::Home $DB_STORAGE_30-shm
 chsmack -a User::Home $DB_STORAGE_30-wal
 
-# Rename DB
+# Rename HEART DB
 mv $DB_DEFAULT_24 $DB_DEFAULT_30_SYS
 mv $DB_DEFAULT_24-journal $DB_DEFAULT_30_SYS-journal
 mv $DB_DIR_24/.resourced-logging-leveldb $DB_DIR_24/.resourced-heart-leveldb
 
-# Divide DB
+# Divide HEART DB
 cp $DB_DEFAULT_30_SYS $DB_DEFAULT_30_USR
 cp $DB_DEFAULT_30_SYS-journal $DB_DEFAULT_30_USR-journal
 
@@ -60,6 +62,16 @@ DROP TABLE abnormal;
 DROP TABLE battery;
 EOS
 
-# Move dat file
+# Move HEART dat file
 mkdir -p $DAT_DIR_30
 mv $DAT_DIR_24/.cpu.dat $DAT_DIR_30
+
+# Alter RO exclude list
+rm /usr/etc/resourced_proc_exclude.ini
+cp /usr/share/upgrade/data/resourced_proc_exclude.ini /etc/
+
+# Move RW exclude list
+mv /opt/usr/etc/resourced_proc_exclude.ini $TZ_SYS_ETC
+
+# Remove Deprecated directory
+rm -r /opt/usr/share/sluggish
index f28b6a9..07ca279 100644 (file)
@@ -50,7 +50,7 @@ IF("${DEBUG_LOG}" STREQUAL "ON")
   ADD_DEFINITIONS("-DPROC_DEBUG")
 ENDIF()
 
-INSTALL(FILES ${DATA_DIR}/${EXCLUDE_LIST_FILE_NAME} DESTINATION ${RD_SYS_ETC})
+INSTALL(FILES ${DATA_DIR}/${EXCLUDE_LIST_FILE_NAME} DESTINATION /etc)
 
 #freezer module
 IF("${FREEZER_MODULE}" STREQUAL "ON")
index 07d31ee..c4a46a7 100644 (file)
@@ -1,8 +1,8 @@
 #ifndef _CONFIG_H_GENERATED
 #define _CONFIG_H_GENERATED
 
-#cmakedefine EXCLUDE_LIST_FULL_PATH "@EXCLUDE_LIST_FULL_PATH@"
-#cmakedefine EXCLUDE_LIST_OPT_FULL_PATH "@EXCLUDE_LIST_OPT_FULL_PATH@"
+#cmakedefine EXCLUDE_LIST_RO_PATH "@EXCLUDE_LIST_RO_PATH@"
+#cmakedefine EXCLUDE_LIST_RW_PATH "@EXCLUDE_LIST_RW_PATH@"
 /* It's command line arguments*/
 
 #cmakedefine DATABASE_FULL_PATH "@DATABASE_FULL_PATH@"
index aa5e727..a8e13a9 100644 (file)
@@ -576,14 +576,14 @@ static void fill_exclude_list_by_path(const char *exclude_file_name,
 
 static void _fill_exclude_list(GHashTable *list)
 {
-       fill_exclude_list_by_path(EXCLUDE_LIST_FULL_PATH, list);
-       fill_exclude_list_by_path(EXCLUDE_LIST_OPT_FULL_PATH, list);
+       fill_exclude_list_by_path(EXCLUDE_LIST_RO_PATH, list);
+       fill_exclude_list_by_path(EXCLUDE_LIST_RW_PATH, list);
 }
 
 static void _exclude_list_change_cb(void *data, Ecore_File_Monitor *em,
        Ecore_File_Event event, const char *path)
 {
-       _SD("file %s changed, path: %s, event: %d ", EXCLUDE_LIST_OPT_FULL_PATH,
+       _SD("file %s changed, path: %s, event: %d ", EXCLUDE_LIST_RW_PATH,
        path, event);
 
        g_hash_table_remove_all(proc_exclude_list);
@@ -597,7 +597,7 @@ static void _init_exclude_list_noti(void)
                _E("ecore_file_init() failed");
                return;
        }
-       exclude_list_monitor = ecore_file_monitor_add(EXCLUDE_LIST_OPT_FULL_PATH,
+       exclude_list_monitor = ecore_file_monitor_add(EXCLUDE_LIST_RW_PATH,
                _exclude_list_change_cb,
                NULL);
        if (exclude_list_monitor == NULL)