From 6ecf338a363b7016af19b471c94cd45a89b47650 Mon Sep 17 00:00:00 2001 From: "saerome.kim" Date: Tue, 24 Sep 2019 12:50:05 +0900 Subject: [PATCH] Added script to create .ua-manager-data.db Added APACHE-2.0 license in ua_db.sql Change-Id: I6068784d0b2bd60d5a7478922ca12d20b188bd94 Signed-off-by: saerome.kim --- packaging/ua-manager.spec | 2 ++ ua-daemon/CMakeLists.txt | 1 + ua-daemon/data/create-ua-db.sh | 6 ++++++ ua-daemon/data/ua_db.sql | 17 ++++++++++++++++- 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 ua-daemon/data/create-ua-db.sh diff --git a/packaging/ua-manager.spec b/packaging/ua-manager.spec index 89cb12f..17e30c6 100644 --- a/packaging/ua-manager.spec +++ b/packaging/ua-manager.spec @@ -67,6 +67,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \ #database initialization mkdir -p %{buildroot}/opt/usr/dbspace sqlite3 %{buildroot}%{database_full_path} < %{buildroot}/usr/share/ua_db.sql +mkdir -p %{buildroot}/opt/usr/share/data/network/ua/share #rm %{buildroot}/usr/share/ua_db.sql mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d @@ -96,6 +97,7 @@ cp ua-manager.service %{buildroot}%{_unitdir}/ua-manager.service %config %attr(660, network_fw, network_fw) %{database_full_path} %config %attr(660, network_fw, network_fw) %{database_full_path}-journal %config %attr(660, network_fw, network_fw) /usr/share/ua_db.sql +%attr(770, network_fw, network_fw) /opt/usr/data/network/ua/share/create-ua-db.sh %files devel %defattr(-, root, root) diff --git a/ua-daemon/CMakeLists.txt b/ua-daemon/CMakeLists.txt index 3874944..7d3eec0 100644 --- a/ua-daemon/CMakeLists.txt +++ b/ua-daemon/CMakeLists.txt @@ -74,6 +74,7 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_MGR_LDFLAGS} -ldl) INSTALL(FILES ${DATA_DIR}/ua_db.sql DESTINATION /usr/share) +INSTALL(FILES ${DATA_DIR}/create-ua-db.sh DESTINATION /opt/usr/data/network/ua/share) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/net.uamd.service DESTINATION share/dbus-1/system-services) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) diff --git a/ua-daemon/data/create-ua-db.sh b/ua-daemon/data/create-ua-db.sh new file mode 100755 index 0000000..912793b --- /dev/null +++ b/ua-daemon/data/create-ua-db.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +sqlite3 /opt/usr/dbspace/.ua-manager-data.db < /usr/share/ua_db.sql +chown network_fw:network_fw /opt/usr/dbspace/.ua-manager-data.db* +chmod 660 /opt/usr/dbspace/.ua-manager-data.db* +chsmack -a "System" /opt/usr/dbspace/.ua-manager-data.db* diff --git a/ua-daemon/data/ua_db.sql b/ua-daemon/data/ua_db.sql index 515883a..28379c8 100644 --- a/ua-daemon/data/ua_db.sql +++ b/ua-daemon/data/ua_db.sql @@ -1,7 +1,22 @@ +-- +-- Copyright (c) 2019 Samsung Electronics Co., Ltd. All rights reserved. +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- PRAGMA journal_mode = PERSIST; PRAGMA foreign_keys = ON; -/*add IF NOT EXISTS before pushing code*/ +-- add IF NOT EXISTS before pushing code CREATE TABLE IF NOT EXISTS userdata ( name TEXT, -- 2.7.4