[systemd] Fix oma-dm-agent service fail to start
[framework/system/oma-dm-agent.git] / packaging / oma-dm-agent.spec
old mode 100755 (executable)
new mode 100644 (file)
index 66602c8..60034b3
@@ -1,10 +1,11 @@
 Name:       oma-dm-agent
 Summary:    oma-dm-agent daemon for FOTA,DM,CP,FMM Service
-Version:    0.1.4
+Version:    0.1.71
 Release:    1
 Group:      TO_BE/FILLED_IN
 License:    Apache License, Version 2.0 
 Source0:    oma-dm-agent-%{version}.tar.gz
+Source1:    oma-dm-agent.service
 
 #Requires(post): /sbin/ldconfig
 BuildRequires:  pkgconfig(glib-2.0)
@@ -66,89 +67,102 @@ make %{?jobs:-j%jobs}
 
 %install
 rm -rf %{buildroot}
-%make_install
-
-
-%clean
-rm -rf %{buildroot}
-
 
-%post
-if [ ! -d /opt/dbspace ]
-then
-       mkdir /opt/dbspace
-fi
-if [ ! -d /etc/rc.d/rc3.d ]
-then
-       mkdir /etc/rc.d/rc3.d
-fi
-if [ ! -d /etc/rc.d/rc5.d ]
+if [ ! -d %{buildroot}/opt/usr/dbspace ]
 then
-       mkdir /etc/rc.d/rc5.d
+       mkdir -p %{buildroot}/opt/usr/dbspace
 fi
 
-ln -s /etc/init.d/oma-dm /etc/rc.d/rc3.d/S91oma-dm-agent
-ln -s /etc/init.d/oma-dm /etc/rc.d/rc5.d/S91oma-dm-agent
+sqlite3 %{buildroot}/opt/usr/dbspace/.dm_service.db "PRAGMA journal_mode = PERSIST; create table a(a); drop table a;" > /dev/null
+sqlite3 %{buildroot}/opt/usr/dbspace/.omadmagent.db "PRAGMA journal_mode = PERSIST; create table a(a); drop table a;" > /dev/null
+sqlite3 %{buildroot}/opt/usr/dbspace/.momanager.db "PRAGMA journal_mode = PERSIST; create table a(a); drop table a;" > /dev/null
 
-sqlite3 /opt/dbspace/.dm_service.db "PRAGMA journal_mode = PERSIST; create table a(a); drop table a;" > /dev/null
-sqlite3 /opt/dbspace/.omadmagent.db "PRAGMA journal_mode = PERSIST; create table a(a); drop table a;" > /dev/null
-sqlite3 /opt/dbspace/.momanager.db "PRAGMA journal_mode = PERSIST; create table a(a); drop table a;" > /dev/null
+%make_install
 
-chmod 600 /opt/dbspace/.dm_service.db
-chmod 600 /opt/dbspace/.dm_service.db-journal
-chmod 600 /opt/dbspace/.omadmagent.db
-chmod 600 /opt/dbspace/.omadmagent.db-journal
-chmod 600 /opt/dbspace/.momanager.db
-chmod 600 /opt/dbspace/.momanager.db-journal
+mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
+install -m 0644 %SOURCE1 %{buildroot}%{_libdir}/systemd/system/oma-dm-agent.service
+ln -s ../oma-dm-agent.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/oma-dm-agent.service
 
-if [ -f /usr/lib/rpm-plugins/msm.so ]
-then
-       chsmack -a oma-dm-agent::db /opt/dbspace/.dm_service.db
-       chsmack -a oma-dm-agent::db /opt/dbspace/.dm_service.db-journal
-       chsmack -a oma-dm-agent::db /opt/dbspace/.omadmagent.db
-       chsmack -a oma-dm-agent::db /opt/dbspace/.omadmagent.db-journal
-       chsmack -a oma-dm-agent::db /opt/dbspace/.momanager.db
-       chsmack -a oma-dm-agent::db /opt/dbspace/.momanager.db-journal
-fi
 
-#/etc/init.d/oma-dm start
+%clean
+rm -rf %{buildroot}
+
 
 
-%preun
-/etc/init.d/oma-dm stop
+%post
 
+###############################################################################################################
+##  Vconf setting... start
+###############################################################################################################
+/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/ConfVersion "0.1" -s oma-dm-agent::vconf_internal
+/usr/bin/vconftool set -t int -f db/SyncML/oma-dm-service/DevManagement/NbDevManagement 3 -s oma-dm-agent::vconf_internal
+## mformation test server  ( http://mfiop25.mformation.com/iop )
+## Input the Phone number -> Input the IMEI number -> Manufacturer : Samsung -> Model : SGHT989 -> Not check Factory Bootstrapped -> Add button click
+## --> Modify device -> Server Auth Preference : syncml:auth-basic -> Client Auth Preference : syncml:auth-basic -> Modify button clieck
+#/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/AccName "gcf" -s oma-dm-agent::vconf_internal
+#/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/ServID "mform" -s oma-dm-agent::vconf_internal
+#/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/ServAddr "https://bobafett.mformation.com:461/oma/iop" -s oma-dm-agent::vconf_internal
+#/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/ServPwd "serverpwd" -s oma-dm-agent::vconf_internal
+#/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/ServNonce "MTIzNDU=" -s oma-dm-agent::vconf_internal
+#/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/ClientNonce "MTIzNDU=" -s oma-dm-agent::vconf_internal
+## 0 : BASIC , 1 : DIGEST MD5 , 2 : HMAC , Default : DIGEST
+#/usr/bin/vconftool set -t int         -f db/SyncML/oma-dm-service/DevManagement/1/AuthType 0 -s oma-dm-agent::vconf_internal
+#/usr/bin/vconftool set -t int         -f db/SyncML/oma-dm-service/DevManagement/1/Port 461 -s oma-dm-agent::vconf_internal
+#/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/UserName "clientid" -s oma-dm-agent::vconf_internal
+#/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/ClientPwd "clientpwd" -s oma-dm-agent::vconf_internal
+##gcf test server
+/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/AccName "gcf" -s oma-dm-agent::vconf_internal
+/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/ServID "RSate" -s oma-dm-agent::vconf_internal
+/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/ServAddr "http://192.168.168.169/dm" -s oma-dm-agent::vconf_internal
+/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/ServPwd "RSatepass" -s oma-dm-agent::vconf_internal
+/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/ServNonce "" -s oma-dm-agent::vconf_internal
+/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/ClientNonce "" -s oma-dm-agent::vconf_internal
+/usr/bin/vconftool set -t int  -f db/SyncML/oma-dm-service/DevManagement/1/AuthType 1 -s oma-dm-agent::vconf_internal
+/usr/bin/vconftool set -t int  -f db/SyncML/oma-dm-service/DevManagement/1/Port 80 -s oma-dm-agent::vconf_internal
+/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/UserName "RSuser" -s oma-dm-agent::vconf_internal
+/usr/bin/vconftool set -t string -f db/SyncML/oma-dm-service/DevManagement/1/ClientPwd "RSpass" -s oma-dm-agent::vconf_internal
+###############################################################################################################
+##  Vconf setting... end
+###############################################################################################################
 
 %postun
 
 rm -f /tmp/agent_fw_event_omadm*
 rm -f /tmp/agent_fw_noti_reply_omadm*
 
-rm -f /etc/rc.d/rc3.d/S91oma-dm-agent
-rm -f /etc/rc.d/rc5.d/S91oma-dm-agent
-
-rm -f /opt/dbspace/.dm_service.db /opt/dbspace/.dm_service.db-journal
-rm -f /opt/dbspace/.omadmagent.db /opt/dbspace/.omadmagent.db-journal
-rm -f /opt/dbspace/.momanager.db /opt/dbspace/.momanager.db-journal
+rm -f /opt/usr/dbspace/.dm_service.db /opt/usr/dbspace/.dm_service.db-journal
+rm -f /opt/usr/dbspace/.omadmagent.db /opt/usr/dbspace/.omadmagent.db-journal
+rm -f /opt/usr/dbspace/.momanager.db /opt/usr/dbspace/.momanager.db-journal
 
 rm -rf /usr/share/oma-dm-cfg
 
 
 %files
+%attr(600,root,root) /opt/usr/dbspace/.dm_service.db
+%attr(600,root,root) /opt/usr/dbspace/.dm_service.db-journal
+%attr(600,root,root) /opt/usr/dbspace/.omadmagent.db
+%attr(600,root,root) /opt/usr/dbspace/.omadmagent.db-journal
+%attr(600,root,root) /opt/usr/dbspace/.momanager.db
+%attr(600,root,root) /opt/usr/dbspace/.momanager.db-journal
+/etc/smack/accesses2.d/oma-dm-agent.rule
+
 %manifest oma-dm-agent.manifest
 %defattr(-,root,root,-)
 /usr/share/dbus-1/services/*
 /usr/bin/oma-dm-agent
 
-/usr/share/oma-dm-cfg/*
 /usr/share/oma-dm-cfg/ddf/*
-/usr/share/oma-dm-cfg/ddf/slp/*
+/usr/share/oma-dm-cfg/delta_size/*
+/usr/share/oma-dm-cfg/fw-init/*
 /usr/share/oma-dm-cfg/ipc/*
 
+
 %defattr(700,root,root)
 /usr/share/oma-dm-cfg/csc-setting/change_csc_value.sh
 /usr/share/oma-dm-cfg/imei-setting/change_imei_callnum.sh
 
-/etc/init.d/oma-dm
+%{_libdir}/systemd/system/oma-dm-agent.service
+%{_libdir}/systemd/system/multi-user.target.wants/oma-dm-agent.service
 
 %files -n dm-private-plugins
 %manifest dm-private-plugins.manifest