SHA256
1
0
forked from pool/bwbar

Accepting request 186662 from home:AndreasStieger:branches:network:utilities

- add systemd support
- move settings from /etc/bwbar to /etc/sysconfig/bwbar
  and use sysconfig template fillup

OBS-URL: https://build.opensuse.org/request/show/186662
OBS-URL: https://build.opensuse.org/package/show/network:utilities/bwbar?expand=0&rev=4
This commit is contained in:
Andreas Stieger 2013-08-11 13:21:39 +00:00 committed by Git OBS Bridge
parent 661cf8daff
commit ca5bb87cb1
4 changed files with 73 additions and 14 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Sun Aug 11 13:13:29 UTC 2013 - andreas.stieger@gmx.de
- add systemd support
- move settings from /etc/bwbar to /etc/sysconfig/bwbar
and use sysconfig template fillup
-------------------------------------------------------------------
Sat Oct 13 13:06:50 UTC 2012 - andreas.stieger@gmx.de

21
bwbar.service Normal file
View File

@ -0,0 +1,21 @@
[Unit]
Description=Bandwith Usage Monitor
After=network.target
[Service]
EnvironmentFile=/etc/sysconfig/bwbar
ExecStart=/usr/bin/bwbar \
--${BWBAR_MEASURE} \
--text-file $BWBAR_TEXTFILE \
--png-file $BWBAR_PNGFILE \
--interval $BWBAR_INTERVAL \
--width $BWBAR_WIDTH \
--height $BWBAR_HEIGHT \
--border $BWBAR_BORDER \
--${BWBAR_UNIT} \
$BWBAR_DEVICE \
$BWBAR_MAXMBPS
[Install]
WantedBy=multi-user.target

View File

@ -1,7 +1,7 @@
#
# spec file for package bwbar
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -29,9 +29,17 @@ Source: %{name}-%{version}.tar.bz2
Source1: COPYING
Source2: bwbar_config
Source3: bwbar_initscript
Source4: bwbar.service
# http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-analyzer/bwbar/files/bwbar-1.2.3-libpng15.patch?revision=1.1&pathrev=HEAD
# PATCH-FIX-UPSTREAM bwbar-1.2.3-libpng15.patch andreas.stieger@gmx.de -- fixes build against libpng15
Patch0: bwbar-1.2.3-libpng15.patch
#
%if 0%{?suse_version} >= 1210
BuildRequires: pkgconfig(systemd)
%{?systemd_requires}
%define has_systemd 1
%endif
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -58,29 +66,52 @@ CFLAGS="-Wall $RPM_OPT_FLAGS"
%__make %{?_smp_mflags}
%install
install -d $RPM_BUILD_ROOT%{_bindir}
install -m 755 --strip bwbar $RPM_BUILD_ROOT%{_bindir}
install -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
install -m 755 -D %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/%{name}
mkdir -p $RPM_BUILD_ROOT/%{_sbindir}
ln -svf ../../etc/init.d/%{name} $RPM_BUILD_ROOT/%{_sbindir}/rc%{name}
install -d %buildroot%{_bindir}
install -m 755 bwbar %buildroot%{_bindir}
install -m 644 -D %{SOURCE2} %buildroot/var/adm/fillup-templates/sysconfig.%{name}
#
install -m 755 -D %{SOURCE3} %buildroot%{_sysconfdir}/init.d/%{name}
mkdir -p %buildroot%{_sbindir}
ln -svf ../../etc/init.d/%{name} %buildroot/%{_sbindir}/rc%{name}
#
%if 0%{?has_systemd}
install -m 644 -D %{SOURCE4} %buildroot/%{_unitdir}/%name.service
%endif
#
%clean
rm -rf $RPM_BUILD_ROOT
%pre
%if 0%{?has_systemd}
%service_add_pre bwbar.service
%endif
%post
%{fillup_and_insserv}
%if 0%{?has_systemd}
%service_add_post bwbar.service
%endif
%preun
%stop_on_removal
%if 0%{?has_systemd}
%service_del_preun bwbar.service
%endif
%postun
%insserv_cleanup
%restart_on_update
%preun
%stop_on_removal
%if 0%{?has_systemd}
%service_del_postun bwbar.service
%endif
%files
%defattr(-, root, root)
%doc README COPYING
%{_bindir}/*
%{_sbindir}/*
%config %{_sysconfdir}/%{name}
/var/adm/fillup-templates/sysconfig.%{name}
%config %{_sysconfdir}/init.d/%{name}
%if 0%{?has_systemd}
%{_unitdir}/%{name}.service
%endif
%changelog

View File

@ -52,7 +52,7 @@ test -x $BWBAR_BIN || { echo "$BWBAR_BIN not installed";
else exit 5; fi; }
# Check for existence of needed config file and read it
BWBAR_CONFIG=/etc/bwbar
BWBAR_CONFIG=/etc/sysconfig/bwbar
test -r $BWBAR_CONFIG || { echo "$BWBAR_CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }