[bwbar] added systemd files
Adrian Reber
adrian at fedoraproject.org
Wed Jan 25 21:13:26 UTC 2012
commit 2adc811f9da0d1cdf5eae5e66dd2582d2c5cd134
Author: Adrian Reber <adrian at lisas.de>
Date: Wed Jan 25 22:13:21 2012 +0100
added systemd files
bwbar | 71 ---------------------------------------------------------
bwbar.spec | 46 +++++++++++++++++++++++++-----------
bwbar.systemd | 11 +++++++++
3 files changed, 43 insertions(+), 85 deletions(-)
---
diff --git a/bwbar.spec b/bwbar.spec
index f6735f7..7aa7d2d 100644
--- a/bwbar.spec
+++ b/bwbar.spec
@@ -1,11 +1,11 @@
Summary: Generate a readout of the current bandwidth use
Name: bwbar
Version: 1.2.3
-Release: 10%{?dist}
+Release: 11%{?dist}
License: GPLv2+
Group: System Environment/Base
Source0: http://www.kernel.org/pub/software/web/bwbar/bwbar-1.2.3.tar.bz2
-Source1: bwbar
+Source1: bwbar.systemd
Source2: bwbar.8
Patch0: bwbar.daemon.patch
Patch1: bwbar.debian-010_directory_option.patch
@@ -13,9 +13,10 @@ Patch2: bwbar.debian-020_proc_net_2.6.x_fix.patch
Patch3: bwbar.zlib.h.patch
URL: http://www.kernel.org/pub/software/web/bwbar/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: libpng-devel
-Requires(post): chkconfig
-Requires(preun): chkconfig /sbin/service
+BuildRequires: libpng-devel systemd-units
+Requires(post): systemd-units, systemd-sysv
+Requires(preun): systemd-units
+Requires(postun): systemd-units
%description
bwbar is a small program that generates a text and a graphical readout
@@ -39,25 +40,39 @@ of the current bandwidth use. It is currently for Linux only.
%{__mkdir_p} $RPM_BUILD_ROOT%{_initrddir}
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
%{__install} -m 755 %{name} $RPM_BUILD_ROOT%{_bindir}
-%{__install} -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}
+%{__install} -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}
%{__install} -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8
%{__cat} >> $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/bwbar << END
-#OPTIONS="-D eth0 100 -d /path/to/outdir"
-#BWBAR_USER="please_define_a_user"
+#OPTIONS="eth0 100 -d /path/to/outdir"
END
%post
-if [ "$1" -eq "1" ]; then
- /sbin/chkconfig --add %{name}
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%preun
-if [ "$1" -eq "0" ]; then
- /sbin/service %{name} stop > /dev/null 2>&1
- /sbin/chkconfig --del %{name}
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
+ /bin/systemctl stop %{name}.service > /dev/null 2>&1 || :
fi
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
+fi
+
+%triggerun -- %{name} < 1.2.3-11
+/usr/bin/systemd-sysv-convert --save %{name} >/dev/null 2>&1 ||:
+/bin/systemctl --no-reload enable %{name}.service >/dev/null 2>&1 ||:
+/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
+/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
+
%clean
%{__rm} -rf $RPM_BUILD_ROOT
@@ -67,10 +82,13 @@ fi
%doc README
%{_bindir}/%{name}
%{_mandir}/man8/*
-%{_initrddir}/%{name}
+%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%changelog
+* wed Jan 25 2012 Adrian Reber <adrian at lisas.de> - 1.2.3-11
+- added systemd files
+
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.2.3-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
diff --git a/bwbar.systemd b/bwbar.systemd
new file mode 100644
index 0000000..7139f2d
--- /dev/null
+++ b/bwbar.systemd
@@ -0,0 +1,11 @@
+[Unit]
+Description=Bandwith Usage Monitor
+After=network.target
+
+[Service]
+EnvironmentFile=-/etc/sysconfig/bwbar
+ExecStart=/usr/bin/bwbar $OPTIONS
+#User=BWBAR_USER
+
+[Install]
+WantedBy=multi-user.target
More information about the scm-commits
mailing list