From 34f45524dd307ed1c97e4f6dd245d949afe34e93 Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Wed, 24 Oct 2012 14:28:00 +0900 Subject: [PATCH] Add/install a systemd service file --- packaging/system-server.service | 8 ++++++++ packaging/system-server.spec | 25 ++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 packaging/system-server.service diff --git a/packaging/system-server.service b/packaging/system-server.service new file mode 100644 index 0000000..232b67d --- /dev/null +++ b/packaging/system-server.service @@ -0,0 +1,8 @@ +[Unit] +Description=Start the system server service + +[Service] +ExecStart=/usr/bin/system_server + +[Install] +WantedBy=multi-user.target diff --git a/packaging/system-server.spec b/packaging/system-server.spec index 36f0f0e..bc21980 100755 --- a/packaging/system-server.spec +++ b/packaging/system-server.spec @@ -6,7 +6,7 @@ Release: 1 Group: TO_BE/FILLED_IN License: Flora Software License Source0: system-server-%{version}.tar.gz -Requires(post): /usr/bin/vconftool +Source1: system-server.service BuildRequires: cmake BuildRequires: libattr-devel BuildRequires: pkgconfig(ecore) @@ -25,6 +25,10 @@ BuildRequires: pkgconfig(svi) BuildRequires: pkgconfig(notification) BuildRequires: pkgconfig(usbutils) BuildRequires: gettext +Requires(preun): /usr/bin/systemctl +Requires(post): /usr/bin/systemctl +Requires(post): /usr/bin/vconftool +Requires(postun): /usr/bin/systemctl %description Description: System server @@ -46,6 +50,9 @@ ln -s %{_sysconfdir}/init.d/system_server.sh %{buildroot}%{_sysconfdir}/rc.d/rc3 mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc5.d/ ln -s %{_sysconfdir}/init.d/system_server.sh %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S00system-server +mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants +install -m 0644 %{SOURCE1} %{buildroot}%{_libdir}/systemd/system/system-server.service +ln -s ../system-server.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/system-server.service %post vconftool set -t int memory/sysman/usbhost_status -1 -i @@ -91,6 +98,20 @@ if ! [ -L /etc/udev/rules.d/91-system-server.rules ]; then ln -s %{_datadir}/system-server/udev-rules/91-system-server.rules /etc/udev/rules.d/91-system-server.rules fi +systemctl daemon-reload +if [ $1 == 1 ]; then + systemctl restart system-server.service +fi + + +%preun +if [ $1 == 0 ]; then + systemctl stop system-server.service +fi + +%postun +systemctl daemon-reload + %files %{_bindir}/system_server @@ -99,6 +120,8 @@ fi %{_bindir}/sys_event %{_bindir}/sys_device_noti %{_datadir}/system-server/sys_device_noti/batt_full_icon.png +%{_libdir}/systemd/system/multi-user.target.wants/system-server.service +%{_libdir}/systemd/system/system-server.service %{_datadir}/system-server/udev-rules/91-system-server.rules %{_datadir}/system-server/sys_device_noti/res/locale/*/LC_MESSAGES/*.mo %{_sysconfdir}/rc.d/init.d/system_server.sh -- 2.7.4