#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
%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)
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)
--- /dev/null
+#!/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*
+--
+-- 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,