add systemd unit files
authorWilliam Douglas <william.douglas@intel.com>
Tue, 26 Jun 2012 18:49:20 +0000 (11:49 -0700)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Wed, 10 Oct 2012 17:00:06 +0000 (19:00 +0200)
Signed-off-by: William Douglas <william.douglas@intel.com>
Merged-and-mangled-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Conflicts:

packaging/msg-service.spec

Change-Id: Ie9c7e785b51c6f192a283229cfb54a3281080ea0

packaging/msg-service.service [new file with mode: 0644]
packaging/msg-service.spec [changed mode: 0755->0644]

diff --git a/packaging/msg-service.service b/packaging/msg-service.service
new file mode 100644 (file)
index 0000000..cd27b1b
--- /dev/null
@@ -0,0 +1,10 @@
+
+[Unit]
+Description=Start the msg-server
+
+[Service]
+ExecStart=/usr/bin/msg-server
+
+[Install]
+WantedBy=tizen-middleware.target
+
old mode 100755 (executable)
new mode 100644 (file)
index b626d5a..84a291a
@@ -5,11 +5,14 @@ License:        Samsung
 Summary:        Messaging Framework Library
 Group:          System/Libraries
 Source0:        %{name}-%{version}.tar.gz
+Source101:      msg-service.service
 
 Requires(post): /usr/bin/sqlite3
 Requires(post): /usr/bin/vconftool
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
+Requires(post): systemd
+Requires(postun): systemd
 BuildRequires: cmake
 BuildRequires: pkgconfig(alarm-service)
 BuildRequires: pkgconfig(aul)
@@ -102,13 +105,15 @@ make %{?jobs:-j%jobs}
 rm -rf %{buildroot}
 %make_install
 
+mkdir -p %{buildroot}%{_libdir}/systemd/user/tizen-middleware.target.wants
+install -m 0644 %SOURCE101 %{buildroot}%{_libdir}/systemd/user/
+ln -s ../msg-service.service %{buildroot}%{_libdir}/systemd/user/tizen-middleware.target.wants/msg-service.service
+
 mkdir -p  %{buildroot}%{_sysconfdir}/rc.d/rc3.d
 ln -s %{_sysconfdir}/rc.d/init.d/msg-server  %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S70msg-server
 mkdir -p  %{buildroot}%{_sysconfdir}/rc.d/rc5.d
 ln -s %{_sysconfdir}/rc.d/init.d/msg-server  %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S70msg-server
 
-
-
 mkdir -p %{buildroot}/opt/data/msg-service
 
 %post tools -p /sbin/ldconfig
@@ -120,6 +125,7 @@ mkdir -p %{buildroot}/opt/data/msg-service
 
 if [ ! -f /opt/dbspace/.msg_service.db ]
 then
+    mkdir -p %{buildroot}/opt/dbspace/
     sqlite3 /opt/dbspace/.msg_service.db "PRAGMA journal_mode = PERSIST;
 
     CREATE TABLE MSG_CONVERSATION_TABLE ( CONV_ID INTEGER NOT NULL , UNREAD_CNT INTEGER DEFAULT 0 , SMS_CNT INTEGER DEFAULT 0 , MMS_CNT INTEGER DEFAULT 0 , MAIN_TYPE INTEGER NOT NULL , SUB_TYPE INTEGER NOT NULL , MSG_DIRECTION INTEGER NOT NULL , DISPLAY_TIME INTEGER , DISPLAY_NAME TEXT , MSG_TEXT TEXT );
@@ -151,11 +157,9 @@ fi
 chown :6011 /opt/dbspace/.msg_service.db
 chown :6011 /opt/dbspace/.msg_service.db-journal
 
-
 chmod 660 /opt/dbspace/.msg_service.db
 chmod 660 /opt/dbspace/.msg_service.db-journal
 
-
 ########## Setting Config Value (Internal keys) ##########
 # Message Server Status
 vconftool set -t bool memory/msg/ready 0 -i
@@ -282,6 +286,12 @@ vconftool set -t int memory/private/msg-service/sim_changed 0 -i
 vconftool set -t string memory/private/msg-service/sim_imsi "" -i
 vconftool set -t bool memory/private/msg-service/national_sim 0 -i
 
+/sbin/ldconfig
+/bin/systemctl daemon-reload
+if [ "$1" = "1" ]; then
+    systemctl stop msg-service.service
+fi
+
 %postun -p /sbin/ldconfig
 
 %postun tools -p /sbin/ldconfig
@@ -313,6 +323,8 @@ vconftool set -t bool memory/private/msg-service/national_sim 0 -i
 %{_bindir}/msg-server
 %{_datadir}/media/Sherbet.wav
 %attr(0644,root,root)/usr/share/msg-service/plugin.cfg
+%{_libdir}/systemd/user/msg-service.service
+%{_libdir}/systemd/user/tizen-middleware.target.wants/msg-service.service
 
 %files -n sms-plugin
 %defattr(-,root,root,-)