Apply Tizen directory path guide 04/61504/3
authorKichan Kwon <k_c.kwon@samsung.com>
Tue, 8 Mar 2016 09:14:14 +0000 (18:14 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Thu, 24 Mar 2016 06:43:31 +0000 (15:43 +0900)
* Changed path

- /opt/usr/etc, /etc/opt -> TZ_SYS_ETC (/opt/etc)
- /opt/storage -> TZ_SYS_STORAGE (/opt/media)
- /opt/usr/data -> TZ_SYS_DATA (/opt/data)
- /opt/usr/dbspace -> TZ_SYS_DB (/opt/dbspace)
- /opt/usr/share -> TZ_SYS_SHARE (/opt/share)

Change-Id: Ibaa6ac20d768e5e6fe52b5f971713f1f77e57cb2
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
14 files changed:
packaging/resourced.spec
src/CMakeLists.txt
src/common/storage-helper.c
src/heart/dump_heart_data.sh [deleted file]
src/heart/dump_heart_data.sh.in [new file with mode: 0755]
src/heart/heart-appopt.c
src/heart/heart-storage.c
src/heart/include/heart.h
src/heart/include/logging.h
src/network/500.resourced-datausage.patch.sh.in [moved from src/network/500.resourced-datausage.patch.sh with 96% similarity]
src/proc-stat/proc-main.c
src/proc-stat/proc-monitor.c
src/sluggish/sluggish.c
src/vip-agent/vip-release-agent.c

index 344335a..457b520 100644 (file)
@@ -63,11 +63,11 @@ Source2:    resourced-cpucgroup.service
 
 %define exclude_list_file_name resourced_proc_exclude.ini
 %define exclude_list_full_path /usr/etc/%{exclude_list_file_name}
-%define exclude_list_opt_full_path /opt/usr/etc/%{exclude_list_file_name}
-%define database_full_path /opt/usr/dbspace/.resourced-datausage.db
+%define exclude_list_opt_full_path %{TZ_SYS_ETC}/%{exclude_list_file_name}
+%define database_full_path %{TZ_SYS_DB}/.resourced-datausage.db
 
-%define logging_db_full_path /opt/usr/dbspace/.resourced-logging.db
-%define logging_storage_db_full_path /opt/usr/dbspace/.resourced-logging-storage.db
+%define logging_db_full_path %{TZ_SYS_DB}/.resourced-logging.db
+%define logging_storage_db_full_path %{TZ_SYS_DB}/.resourced-logging-storage.db
 
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(glib-2.0)
@@ -84,6 +84,7 @@ BuildRequires:  pkgconfig(openssl)
 BuildRequires:  pkgconfig(leveldb)
 BuildRequires:  pkgconfig(eventsystem)
 BuildRequires:  pkgconfig(capi-system-info)
+BuildRequires:  pkgconfig(libtzplatform-config)
 
 #only for data types
 BuildRequires:  pkgconfig(tapi)
@@ -173,7 +174,14 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
         -DBLOCK_MODULE=%{block_module} \
         -DTESTS_MODULE=%{tests_module} \
         -DMEM_STRESS=%{mem_stress} \
-        -DDEBUG_LOG=%{debug_log}
+        -DDEBUG_LOG=%{debug_log} \
+        -DRD_SYS_ETC=%{TZ_SYS_ETC} \
+        -DRD_SYS_STORAGE=%{TZ_SYS_STORAGE} \
+        -DRD_SYS_DATA=%{TZ_SYS_DATA} \
+        -DRD_SYS_DB=%{TZ_SYS_DB} \
+        -DRD_SYS_SHARE=%{TZ_SYS_SHARE} \
+        -DRD_SYS_VAR=%{TZ_SYS_VAR} \
+        -DRD_USER_CONTENT=%{TZ_USER_CONTENT}
 
 make %{?jobs:-j%jobs}
 
@@ -185,8 +193,8 @@ cp -f LICENSE %{buildroot}/usr/share/license/libresourced
 
 %make_install
 %if %{?heart_module} == ON
-       mkdir -p %{buildroot}/opt/usr/data/heart
-       mkdir -p %{buildroot}/opt/usr/dbspace
+       mkdir -p %{buildroot}%{TZ_SYS_DATA}/heart
+       mkdir -p %{buildroot}/%{TZ_SYS_DB}
        sqlite3 %{buildroot}%{logging_db_full_path}
        sqlite3 --line %{buildroot}%{logging_storage_db_full_path} 'PRAGMA journal_mode = WAL'
        touch %{buildroot}%{logging_storage_db_full_path}-shm
@@ -194,7 +202,7 @@ cp -f LICENSE %{buildroot}/usr/share/license/libresourced
 %endif
 
 %if %{?network_state} == ON
-       mkdir -p %{buildroot}/opt/usr/dbspace
+       mkdir -p %{buildroot}/%{TZ_SYS_DB}
        sqlite3 %{buildroot}%{database_full_path} < %{buildroot}/usr/share/traffic_db.sql
        rm %{buildroot}/usr/share/traffic_db.sql
        sqlite3 %{buildroot}%{database_full_path} < %{buildroot}/usr/share/exception_db.sql
@@ -219,7 +227,7 @@ mkdir -p %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
 ln -sf %{_unitdir}/resourced.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
 
 #install init.d script
-mkdir -p /opt/usr/etc
+mkdir -p %{TZ_SYS_ETC}
 #make empty dynamic exclude list for first installation
 touch %{exclude_list_opt_full_path}
 
@@ -238,8 +246,8 @@ fi
        %config(noreplace) %attr(660,root,app) %{database_full_path}-journal
        /usr/bin/datausagetool
        %config /etc/resourced/network.conf
-       /etc/opt/upgrade/500.resourced-datausage.patch.sh
-       %attr(700,root,root) /etc/opt/upgrade/500.resourced-datausage.patch.sh
+       %{TZ_SYS_ETC}/upgrade/500.resourced-datausage.patch.sh
+       %attr(700,root,root) %{TZ_SYS_ETC}/upgrade/500.resourced-datausage.patch.sh
        %{_bindir}/net-cls-release
 %endif
 %config %{_sysconfdir}/dbus-1/system.d/resourced.conf
@@ -276,7 +284,7 @@ fi
 %{exclude_list_full_path}
 %if %{?heart_module} == ON
        %config /etc/resourced/heart.conf
-       %attr(700, root, root) /opt/etc/dump.d/module.d/dump_heart_data.sh
+       %attr(700, root, root) %{TZ_SYS_ETC}/dump.d/module.d/dump_heart_data.sh
        %attr(700, app, app) %{logging_storage_db_full_path}
        %attr(700, app, app) %{logging_storage_db_full_path}-shm
        %attr(700, app, app) %{logging_storage_db_full_path}-wal
index 46660ab..3df8bc0 100644 (file)
@@ -4,6 +4,13 @@ CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
 # libresourced uses it
 PROJECT(resource_d)
 
+ADD_DEFINITIONS("-DRD_SYS_ETC=\"${RD_SYS_ETC}\"")
+ADD_DEFINITIONS("-DRD_SYS_STORAGE=\"${RD_SYS_STORAGE}\"")
+ADD_DEFINITIONS("-DRD_SYS_DATA=\"${RD_SYS_DATA}\"")
+ADD_DEFINITIONS("-DRD_SYS_DB=\"${RD_SYS_DB}\"")
+ADD_DEFINITIONS("-DRD_SYS_SHARE=\"${RD_SYS_SHARE}\"")
+ADD_DEFINITIONS("-DRD_SYS_VAR=\"${RD_SYS_VAR}\"")
+
 INCLUDE(${CMAKE_SOURCE_DIR}/cmake/InstallSymlink.cmake)
 INCLUDE(${CMAKE_SOURCE_DIR}/cmake/ProcessGPERF.cmake)
 
@@ -94,10 +101,14 @@ IF("${NETWORK_MODULE}" STREQUAL "ON")
     ${NETWORK_SOURCE_DIR}/db-guard.c
     )
 
+  CONFIGURE_FILE(${NETWORK_SOURCE_DIR}/500.resourced-datausage.patch.sh.in
+         ${NETWORK_SOURCE_DIR}/500.resourced-datausage.patch.sh
+         @ONLY)
+
   INSTALL(FILES ${NETWORK_SOURCE_DIR}/network.conf
     DESTINATION /etc/resourced)
   INSTALL(FILES ${NETWORK_SOURCE_DIR}/500.resourced-datausage.patch.sh
-    DESTINATION /etc/opt/upgrade)
+         DESTINATION ${RD_SYS_ETC}/upgrade)
 
   SET(REQUIRES_LIST ${REQUIRES_LIST}
     openssl
@@ -299,8 +310,11 @@ ENDIF()
 IF("${HEART_MODULE}" STREQUAL "ON")
   INSTALL(FILES ${HEART_SOURCE_DIR}/heart.conf
     DESTINATION /etc/resourced RENAME heart.conf)
+  CONFIGURE_FILE(${HEART_SOURCE_DIR}/dump_heart_data.sh.in
+         ${HEART_SOURCE_DIR}/dump_heart_data.sh
+         @ONLY)
   INSTALL(FILES ${HEART_SOURCE_DIR}/dump_heart_data.sh
-    DESTINATION /opt/etc/dump.d/module.d)
+       DESTINATION ${RD_SYS_ETC}/dump.d/module.d)
 ENDIF()
 
 IF("${CPU_MODULE}" STREQUAL "ON")
@@ -325,8 +339,8 @@ IF("${VIP_AGENT}" STREQUAL "ON")
 ENDIF()
 
 IF("${BLOCK_MODULE}" STREQUAL "ON")
-  INSTALL(FILES ${BLOCK_SOURCE_DIR}/block.conf
-    DESTINATION /etc/resourced RENAME block.conf)
+       INSTALL(FILES ${BLOCK_SOURCE_DIR}/block.conf
+               DESTINATION /etc/resourced RENAME block.conf)
 ENDIF()
 
 IF("${FREEZER_MODULE}" STREQUAL "ON")
index 03dcde4..ba41c23 100644 (file)
@@ -32,7 +32,7 @@
 
 #define PATH_MAX       256
 #define INTERNAL_MEMORY_PATH    "/opt/usr"
-#define EXTERNAL_MEMORY_PATH    "/opt/storage/sdcard"
+#define EXTERNAL_MEMORY_PATH    RD_SYS_STORAGE"/sdcard"
 
 bool is_mounted(const char* path)
 {
diff --git a/src/heart/dump_heart_data.sh b/src/heart/dump_heart_data.sh
deleted file mode 100755 (executable)
index dafd857..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-HEART_DEBUG=$1/heart
-/bin/mkdir -p ${HEART_DEBUG}
-/bin/cp -rf /opt/usr/dbspace/.resourced-logging-leveldb/ ${HEART_DEBUG}
-/bin/cp -rf /opt/usr/dbspace/.resourced-logging.db ${HEART_DEBUG}
-/bin/cp -rf /opt/usr/data/heart/ ${HEART_DEBUG}
diff --git a/src/heart/dump_heart_data.sh.in b/src/heart/dump_heart_data.sh.in
new file mode 100755 (executable)
index 0000000..c842056
--- /dev/null
@@ -0,0 +1,5 @@
+HEART_DEBUG=$1/heart
+/bin/mkdir -p ${HEART_DEBUG}
+/bin/cp -rf @RD_SYS_DB@/.resourced-logging-leveldb/ ${HEART_DEBUG}
+/bin/cp -rf @RD_SYS_DB@/.resourced-logging.db ${HEART_DEBUG}
+/bin/cp -rf @RD_SYS_DATA@/heart/ ${HEART_DEBUG}
index d0d3603..5ce7ce1 100644 (file)
@@ -44,7 +44,7 @@
 #include "proc-common.h"
 #include "edbus-handler.h"
 
-#define APPOPT_DB_FILE_NAME    "/opt/usr/dbspace/.resourced-appopt.db"
+#define APPOPT_DB_FILE_NAME    RD_SYS_DB"/.resourced-appopt.db"
 #define APP_NAMES_TABLE                "appnames"
 #define APP_OPTS_TABLE         "appopts"
 #define QUERY_CREATE_APPNAMES  "CREATE TABLE IF NOT EXISTS "APP_NAMES_TABLE" (appkey INTEGER PRIMARY KEY AUTOINCREMENT, appname TEXT NOT NULL UNIQUE);"
index ca3cab9..dd2c1a5 100644 (file)
@@ -45,7 +45,7 @@
 
 #include <sqlite3.h>
 
-#define HEART_STORAGE_DB                       "/opt/usr/dbspace/.resourced-logging-storage.db"
+#define HEART_STORAGE_DB       RD_SYS_DB"/.resourced-logging-storage.db"
 #define STORAGE_NAME           "storage"
 
 static bool heart_storage_initailized = false;
index ead7647..24456dc 100644 (file)
@@ -29,7 +29,7 @@
 #include <time.h>
 
 #define HEART_CONF_FILE_PATH                   "/etc/resourced/heart.conf"
-#define HEART_FILE_PATH                                "/opt/usr/data/heart"
+#define HEART_FILE_PATH                                RD_SYS_DATA"/heart"
 #define HEART_CONF_SECTION                     "HEART"
 
 struct heart_module_ops {
index 7e48c1b..f94c736 100644 (file)
@@ -36,8 +36,8 @@
 #define STRINGFY(x) #x
 #define KEY_TO_STRING(x) STRINGFY(x)
 
-#define LOGGING_DB_FILE_NAME                   "/opt/usr/dbspace/.resourced-logging.db"
-#define LOGGING_LEVEL_DB_FILE_NAME             "/opt/usr/dbspace/.resourced-logging-leveldb"
+#define LOGGING_DB_FILE_NAME                   RD_SYS_DB"/.resourced-logging.db"
+#define LOGGING_LEVEL_DB_FILE_NAME             RD_SYS_DB"/.resourced-logging-leveldb"
 #define HOUR_TO_SEC(x)                         (x*3600)
 #define DAY_TO_SEC(x)                          (x*HOUR_TO_SEC(24))
 #define MONTH_TO_SEC(x)                                (x*DAY_TO_SEC(30))
@@ -1,4 +1,4 @@
-network_db_version="`sqlite3 /opt/usr/dbspace/.resourced-datausage.db "PRAGMA user_version;"`"
+network_db_version="`sqlite3 "@RD_SYS_DB@"/.resourced-datausage.db "PRAGMA user_version;"`"
 
 if [ 0"$network_db_version" -eq 1 ]
 then
@@ -6,7 +6,7 @@ then
     exit 1
 fi
 
-sqlite3 /opt/usr/dbspace/.resourced-datausage.db "
+sqlite3 @RD_SYS_DB@/.resourced-datausage.db "
 PRAGMA journal_mode=PERSIST;
 DROP TABLE IF EXISTS fota;
 ALTER TABLE statistics RENAME to fota;
@@ -29,7 +29,7 @@ hw_net_protocol_type, ifname, reserved, imsi) SELECT binpath, received, sent, ti
 hw_net_protocol_type, ifname, reserved, imsi from fota;
 DROP TABLE IF EXISTS fota;
 "
-sqlite3 /opt/usr/dbspace/.resourced-datausage.db "
+sqlite3 @RD_SYS_DB@/.resourced-datausage.db "
 PRAGMA journal_mode=PERSIST;
 DROP TABLE IF EXISTS fota;
 ALTER TABLE quotas RENAME to fota;
@@ -54,7 +54,7 @@ start_time, iftype, roaming, reserved, imsi from fota;
 DROP TABLE IF EXISTS fota;
 "
 
-sqlite3 /opt/usr/dbspace/.resourced-datausage.db "
+sqlite3 @RD_SYS_DB@/.resourced-datausage.db "
 PRAGMA journal_mode=PERSIST;
 DROP TABLE IF EXISTS fota;
 ALTER TABLE restrictions RENAME to fota;
index af61ff0..219bb7e 100644 (file)
@@ -51,7 +51,6 @@ static const unsigned int exclude_list_limit = 1024;
 static const struct module_ops *freezer;
 static GSList *proc_module;  /* proc sub-module list */
 
-#define BASE_UGPATH_PREFIX "/usr/ug/bin"
 #define LOG_PREFIX "resourced"
 #define TIZEN_SYSTEM_APPID "org.tizen.system"
 
index f1d7f0c..103c96d 100644 (file)
@@ -49,7 +49,7 @@
 #define WATCHDOG_KEY2                  "_APP_NAME_"
 #define WATCHDOG_VALUE_1                       "watchdog"
 
-#define TIZEN_DEBUG_MODE_FILE          "/opt/etc/.debugmode"
+#define TIZEN_DEBUG_MODE_FILE  RD_SYS_ETC"/.debugmode"
 
 #define INIT_PID       1
 #define INIT_PROC_VAL  -1
index c0d3db1..f584add 100755 (executable)
@@ -39,9 +39,9 @@
 #include "file-helper.h"
 #include "util.h"
 
-#define SLUGGISH_PATH  "/opt/usr/share/sluggish"       /* Path to dump system snapshot */
-#define PATH_DLOG      "/opt/var/log/dlog_main"        /* Platform log file */
-#define PATH_DLOG1     "/opt/var/log/dlog_main.1"      /* Platform log file */
+#define SLUGGISH_PATH  RD_SYS_SHARE"/sluggish" /* Path to dump system snapshot */
+#define PATH_DLOG      RD_SYS_VAR"/log/dlog_main"      /* Platform log file */
+#define PATH_DLOG1     RD_SYS_VAR"/log/dlog_main.1"    /* Platform log file */
 #define MAX_TIMESTAMP_LEN      30
 #define MAX_FILENAME_LEN       256
 #define MAX_BUF_LEN    1024
index 39a02b5..02f53e9 100644 (file)
@@ -12,7 +12,7 @@
 #include "trace.h"
 #include "vip-process.h"
 
-#define TIZEN_DEBUG_MODE_FILE   "/opt/etc/.debugmode"
+#define TIZEN_DEBUG_MODE_FILE   RD_SYS_ETC"/.debugmode"
 #define DUMP_PATH "/usr/bin/all_log_dump.sh"
 #define REBOOT_PATH "/usr/sbin/reboot"
 #define WAIT_TIMEOUT 10