add systemd unit files
authorWilliam Douglas <william.douglas@intel.com>
Fri, 22 Jun 2012 05:05:43 +0000 (22:05 -0700)
committerWilliam Douglas <william.douglas@intel.com>
Fri, 22 Jun 2012 21:01:16 +0000 (14:01 -0700)
Signed-off-by: William Douglas <william.douglas@intel.com>
packaging/99-android-logger.rules [new file with mode: 0644]
packaging/dlog-main.service [new file with mode: 0644]
packaging/dlog-radio.service [new file with mode: 0644]
packaging/dlog-system.service [new file with mode: 0644]
packaging/dlog.changes [new file with mode: 0644]
packaging/dlog.spec

diff --git a/packaging/99-android-logger.rules b/packaging/99-android-logger.rules
new file mode 100644 (file)
index 0000000..ef944c3
--- /dev/null
@@ -0,0 +1,3 @@
+# set proper permissions on the android logger device nodes in
+# /dev - make them writable by everyone, but not readable
+KERNEL=="log_events|log_main|log_radio|log_system", GROUP="log", MODE="0642"
\ No newline at end of file
diff --git a/packaging/dlog-main.service b/packaging/dlog-main.service
new file mode 100644 (file)
index 0000000..6233f2d
--- /dev/null
@@ -0,0 +1,11 @@
+
+[Unit]
+Description=Start the dlog service
+DefaultDependencies=no
+
+[Service]
+ExecStart=/usr/bin/dlogutil -v time *:W
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/packaging/dlog-radio.service b/packaging/dlog-radio.service
new file mode 100644 (file)
index 0000000..584760d
--- /dev/null
@@ -0,0 +1,11 @@
+
+[Unit]
+Description=Start the dlog service
+DefaultDependencies=no
+
+[Service]
+ExecStart=/usr/bin/dlogutil -b radio -v time *:W
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/packaging/dlog-system.service b/packaging/dlog-system.service
new file mode 100644 (file)
index 0000000..6f63e42
--- /dev/null
@@ -0,0 +1,11 @@
+
+[Unit]
+Description=Start the dlog service
+DefaultDependencies=no
+
+[Service]
+ExecStart=/usr/bin/dlogutil -b system -v time *:W
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/packaging/dlog.changes b/packaging/dlog.changes
new file mode 100644 (file)
index 0000000..18fe4ed
--- /dev/null
@@ -0,0 +1,2 @@
+* Fri Jun 22 2012 William Douglas <william.douglas@intel.com> - 0.4.1
+- Add system unit files
index 6609e38..8f3ca6a 100644 (file)
@@ -5,10 +5,18 @@ Release:    5.1
 Group:      System/Main
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
+Source1:    packaging/99-android-logger.rules
+Source101:  packaging/dlog-main.service
+Source102:  packaging/dlog-radio.service
+Source103:  packaging/dlog-system.service
 Source1001: packaging/dlog.manifest 
+
 Requires(post): /sbin/ldconfig
+Requires(post): /usr/bin/systemctl
+Requires(post): /usr/bin/vconftool
 Requires(postun): /sbin/ldconfig
-
+Requires(postun): /usr/bin/systemctl
+Requires(preun): /usr/bin/systemctl
 
 %description
 dlog API library
@@ -43,7 +51,6 @@ utilities for print log data
 %prep
 %setup -q 
 
-
 %build
 cp %{SOURCE1001} .
 %autogen
@@ -61,8 +68,36 @@ rm -f %{buildroot}/%{_sysconfdir}/etc/rc.d/rc5.d/S05dlog
 ln -s ../etc/rc.d/init.d/dlog.sh %{buildroot}/%{_sysconfdir}/rc.d/rc3.d/S05dlog
 ln -s ../etc/rc.d/init.d/dlog.sh %{buildroot}/%{_sysconfdir}/rc.d/rc5.d/S05dlog
 
+mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
+mkdir -p %{buildroot}%{_libdir}/udev/rules.d
+
+install -m 0644 %SOURCE101 %{buildroot}%{_libdir}/systemd/system/
+install -m 0644 %SOURCE102 %{buildroot}%{_libdir}/systemd/system/
+install -m 0644 %SOURCE103 %{buildroot}%{_libdir}/systemd/system/
+install -m 0644 %SOURCE1 %{buildroot}%{_libdir}/udev/rules.d/
+
+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 ../dlog-system.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/dlog-system.service
+
+
+%preun -n dlogutil
+if [ $1 == 0 ]; then
+    systemctl stop dlog-main.service
+    systemctl stop dlog-radio.service
+    systemctl stop dlog-system.service
+fi
 
 %post -n dlogutil
+systemctl daemon-reload
+if [ $1 == 1 ]; then
+    systemctl restart dlog-main.service
+    systemctl restart dlog-radio.service
+    systemctl restart dlog-system.service
+fi
+
+%postun -n dlogutil
+systemctl daemon-reload
 
 %post -n libdlog -p /sbin/ldconfig
 
@@ -75,6 +110,13 @@ ln -s ../etc/rc.d/init.d/dlog.sh %{buildroot}/%{_sysconfdir}/rc.d/rc5.d/S05dlog
 %{_sysconfdir}/rc.d/init.d/dlog.sh
 %{_sysconfdir}/rc.d/rc3.d/S05dlog
 %{_sysconfdir}/rc.d/rc5.d/S05dlog
+%{_libdir}/systemd/system/dlog-main.service
+%{_libdir}/systemd/system/dlog-radio.service
+%{_libdir}/systemd/system/dlog-system.service
+%{_libdir}/systemd/system/multi-user.target.wants/dlog-main.service
+%{_libdir}/systemd/system/multi-user.target.wants/dlog-radio.service
+%{_libdir}/systemd/system/multi-user.target.wants/dlog-system.service
+%{_libdir}/udev/rules.d/99-android-logger.rules
 
 %files  -n libdlog
 %manifest dlog.manifest