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:
parent
661cf8daff
commit
ca5bb87cb1
@ -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
|
Sat Oct 13 13:06:50 UTC 2012 - andreas.stieger@gmx.de
|
||||||
|
|
||||||
|
21
bwbar.service
Normal file
21
bwbar.service
Normal 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
|
||||||
|
|
57
bwbar.spec
57
bwbar.spec
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package bwbar
|
# 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
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -29,9 +29,17 @@ Source: %{name}-%{version}.tar.bz2
|
|||||||
Source1: COPYING
|
Source1: COPYING
|
||||||
Source2: bwbar_config
|
Source2: bwbar_config
|
||||||
Source3: bwbar_initscript
|
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
|
# 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
|
# PATCH-FIX-UPSTREAM bwbar-1.2.3-libpng15.patch andreas.stieger@gmx.de -- fixes build against libpng15
|
||||||
Patch0: bwbar-1.2.3-libpng15.patch
|
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
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -58,29 +66,52 @@ CFLAGS="-Wall $RPM_OPT_FLAGS"
|
|||||||
%__make %{?_smp_mflags}
|
%__make %{?_smp_mflags}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
install -d $RPM_BUILD_ROOT%{_bindir}
|
install -d %buildroot%{_bindir}
|
||||||
install -m 755 --strip bwbar $RPM_BUILD_ROOT%{_bindir}
|
install -m 755 bwbar %buildroot%{_bindir}
|
||||||
install -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
|
install -m 644 -D %{SOURCE2} %buildroot/var/adm/fillup-templates/sysconfig.%{name}
|
||||||
install -m 755 -D %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/%{name}
|
#
|
||||||
mkdir -p $RPM_BUILD_ROOT/%{_sbindir}
|
install -m 755 -D %{SOURCE3} %buildroot%{_sysconfdir}/init.d/%{name}
|
||||||
ln -svf ../../etc/init.d/%{name} $RPM_BUILD_ROOT/%{_sbindir}/rc%{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
|
%pre
|
||||||
rm -rf $RPM_BUILD_ROOT
|
%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
|
%postun
|
||||||
%insserv_cleanup
|
%insserv_cleanup
|
||||||
%restart_on_update
|
%restart_on_update
|
||||||
|
%if 0%{?has_systemd}
|
||||||
%preun
|
%service_del_postun bwbar.service
|
||||||
%stop_on_removal
|
%endif
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-, root, root)
|
%defattr(-, root, root)
|
||||||
%doc README COPYING
|
%doc README COPYING
|
||||||
%{_bindir}/*
|
%{_bindir}/*
|
||||||
%{_sbindir}/*
|
%{_sbindir}/*
|
||||||
%config %{_sysconfdir}/%{name}
|
/var/adm/fillup-templates/sysconfig.%{name}
|
||||||
%config %{_sysconfdir}/init.d/%{name}
|
%config %{_sysconfdir}/init.d/%{name}
|
||||||
|
%if 0%{?has_systemd}
|
||||||
|
%{_unitdir}/%{name}.service
|
||||||
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
@ -52,7 +52,7 @@ test -x $BWBAR_BIN || { echo "$BWBAR_BIN not installed";
|
|||||||
else exit 5; fi; }
|
else exit 5; fi; }
|
||||||
|
|
||||||
# Check for existence of needed config file and read it
|
# 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";
|
test -r $BWBAR_CONFIG || { echo "$BWBAR_CONFIG not existing";
|
||||||
if [ "$1" = "stop" ]; then exit 0;
|
if [ "$1" = "stop" ]; then exit 0;
|
||||||
else exit 6; fi; }
|
else exit 6; fi; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user