modified for systemd journal support
[framework/system/dlog.git] / packaging / dlog.spec
old mode 100644 (file)
new mode 100755 (executable)
index 5bd15c0..db14771
@@ -1,14 +1,21 @@
 Name:       dlog
 Summary:    Logging service
-Version:       0.4.1
-Release:    5.1
-Group:      TO_BE/FILLED_IN
-License:    Apache-2.0
-Source0:    dlog-%{version}.tar.gz
-Patch0:                dev_error.patch
+Version:    0.4.1
+Release:    2
+Group:      System/Libraries
+License:    Apache License
+Source0:    %{name}-%{version}.tar.gz
+Source101:  packaging/dlog-main.service
+Source102:  packaging/dlog-radio.service
+Source103:  packaging/tizen-debug-level.service
+BuildRequires: pkgconfig(libsystemd-journal)
 Requires(post): /sbin/ldconfig
+Requires(post): /usr/bin/systemctl
+Requires(post): /usr/bin/vconftool
+Requires(post): coreutils
 Requires(postun): /sbin/ldconfig
-
+Requires(postun): /usr/bin/systemctl
+Requires(preun): /usr/bin/systemctl
 
 %description
 dlog API library
@@ -41,38 +48,90 @@ utilities for print log data
 
 
 %prep
-%setup -q 
-%patch0 -p1
+%setup -q
 
 
 %build
-%autogen
-%configure 
+%autogen --disable-static
+%configure --disable-static
 make %{?jobs:-j%jobs}
 
 %install
 rm -rf %{buildroot}
 %make_install
+mkdir -p %{buildroot}/opt/etc/
+cp %{_builddir}/%{name}-%{version}/.dloglevel %{buildroot}/opt/etc/.dloglevel
+mkdir -p %{buildroot}/etc/profile.d/
+cp %{_builddir}/%{name}-%{version}/tizen_platform_env.sh %{buildroot}/etc/profile.d/tizen_platform_env.sh
+mkdir -p %{buildroot}/usr/bin/
+cp %{_builddir}/%{name}-%{version}/dlogctrl %{buildroot}/usr/bin/dlogctrl
 
-%post -n dlogutil
-#Add boot sequence script
-mkdir -p /etc/rc.d/rc5.d
-rm -f /etc/rc.d/rc3.d/S05dlog /etc/rc.d/rc5.d/S05dlog
-ln -s /etc/rc.d/init.d/dlog.sh /etc/rc.d/rc3.d/S05dlog
-ln -s /etc/rc.d/init.d/dlog.sh /etc/rc.d/rc5.d/S05dlog
+mkdir -p %{buildroot}/%{_sysconfdir}/rc.d/rc3.d
+mkdir -p %{buildroot}/%{_sysconfdir}/rc.d/rc5.d
+rm -f %{buildroot}/%{_sysconfdir}/etc/rc.d/rc3.d/S05dlog
+rm -f %{buildroot}/%{_sysconfdir}/etc/rc.d/rc5.d/S05dlog
+ln -s ../init.d/dlog.sh %{buildroot}/%{_sysconfdir}/rc.d/rc3.d/S05dlog
+ln -s ../init.d/dlog.sh %{buildroot}/%{_sysconfdir}/rc.d/rc5.d/S05dlog
+
+mkdir -p %{buildroot}%{_libdir}/systemd/system/basic.target.wants
+mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
 
+install -m 0644 %SOURCE101 %{buildroot}%{_libdir}/systemd/system/
+install -m 0644 %SOURCE102 %{buildroot}%{_libdir}/systemd/system/
+install -m 0644 %SOURCE103 %{buildroot}%{_libdir}/systemd/system/
 
-%post -n libdlog -p /sbin/ldconfig
+ln -s ../dlog-main.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/dlog-main.service
+ln -s ../dlog-radio.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/dlog-radio.service
+ln -s ../tizen-debug-level.service %{buildroot}%{_libdir}/systemd/system/basic.target.wants/tizen-debug-level.service
 
-%postun -n libdlog -p /sbin/ldconfig
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
 
 
+%preun -n dlogutil
+if [ $1 == 0 ]; then
+    systemctl stop dlog-main.service
+    systemctl stop dlog-radio.service
+fi
+
+%post -n dlogutil
+mkdir -p /opt/etc/dlog
+chown 0:5000 /opt/etc/dlog
+chmod 775 /opt/etc/dlog
+chmod 755 /usr/bin/dlogctrl
+systemctl daemon-reload
+if [ $1 == 1 ]; then
+    systemctl restart dlog-main.service
+    systemctl restart dlog-radio.service
+fi
+
+%postun -n dlogutil
+systemctl daemon-reload
+
+%post -n libdlog
+/sbin/ldconfig
+%postun -n libdlog
+/sbin/ldconfig
+
 %files  -n dlogutil
+%manifest dlogutil.manifest
 %{_bindir}/dlogutil
+%{_bindir}/dlogctrl
 %{_sysconfdir}/rc.d/init.d/dlog.sh
+%{_sysconfdir}/rc.d/rc3.d/S05dlog
+%{_sysconfdir}/rc.d/rc5.d/S05dlog
+%{_libdir}/systemd/system/tizen-debug-level.service
+%{_libdir}/systemd/system/dlog-main.service
+%{_libdir}/systemd/system/dlog-radio.service
+%{_libdir}/systemd/system/basic.target.wants/tizen-debug-level.service
+%{_libdir}/systemd/system/multi-user.target.wants/dlog-main.service
+%{_libdir}/systemd/system/multi-user.target.wants/dlog-radio.service
 
 %files  -n libdlog
+/usr/share/license/%{name}
 %doc LICENSE
+/opt/etc/.dloglevel
+/etc/profile.d/tizen_platform_env.sh
 %{_libdir}/libdlog.so.0
 %{_libdir}/libdlog.so.0.0.0