[wicd] - Replace existing init script with systemd unit file (#661226)
David Cantrell
dcantrel at fedoraproject.org
Sun Jan 16 01:34:57 UTC 2011
commit f86ff3692cceaa7f188b3ac5f7c9ceceb8d389ed
Author: David Cantrell <dcantrell at redhat.com>
Date: Sat Jan 15 15:32:54 2011 -1000
- Replace existing init script with systemd unit file (#661226)
wicd-1.7.0-initscript.patch | 12 ----
wicd.service | 11 ++++
wicd.spec | 137 ++++++++++++++++++++++++------------------
3 files changed, 89 insertions(+), 71 deletions(-)
---
diff --git a/wicd.service b/wicd.service
new file mode 100644
index 0000000..f30fc3a
--- /dev/null
+++ b/wicd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Wicd a wireless and wired network manager for Linux
+After=syslog.target
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/wicd
+ExecStop=/usr/sbin/wicd -k
+
+[Install]
+WantedBy=multi-user.target
diff --git a/wicd.spec b/wicd.spec
index fb33648..82f2cd5 100644
--- a/wicd.spec
+++ b/wicd.spec
@@ -3,28 +3,32 @@
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif
-%define debug_package %{nil}
-
-Name: wicd
-Version: 1.7.0
-Release: 4%{?dist}
-Summary: Wireless and wired network connection manager
+%{!?_systemd_unitdir: %global _systemd_unitdir %(pkg-config systemd --variable=systemdsystemunitdir)}
-Group: System Environment/Base
-License: GPLv2+
-URL: http://wicd.sourceforge.net/
-Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
-Source1: wicd.logrotate
-Patch0: wicd-1.7.0-remove-WHEREAREMYFILES.patch
-Patch1: wicd-1.7.0-initscript.patch
-Patch2: wicd-1.7.0-deepcopy.patch
-
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
-BuildRequires: python2-devel
-BuildRequires: desktop-file-utils
+%define debug_package %{nil}
-Requires: pm-utils >= 1.2.4
-Requires: %{name}-common = %{version}-%{release}
+Name: wicd
+Version: 1.7.0
+Release: 5%{?dist}
+Summary: Wireless and wired network connection manager
+
+Group: System Environment/Base
+License: GPLv2+
+URL: http://wicd.sourceforge.net/
+Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
+Source1: wicd.logrotate
+Source2: wicd.service
+Patch0: wicd-1.7.0-remove-WHEREAREMYFILES.patch
+Patch1: wicd-1.7.0-deepcopy.patch
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
+BuildRequires: python2-devel
+BuildRequires: desktop-file-utils
+BuildRequires: pkgconfig
+BuildRequires: systemd-units
+
+Requires: pm-utils >= 1.2.4
+Requires: %{name}-common = %{version}-%{release}
%description
Wicd is designed to give the user as much control over behavior of network
@@ -36,42 +40,43 @@ it should try, with a preference first to a wired network, then to wireless.
This package provides the architecture-dependent components of wicd.
%package common
-Summary: Wicd common files
-Group: System Environment/Base
-BuildArch: noarch
-Requires: dbus
-Requires: dbus-python
-Requires: dhclient
-Requires: ethtool
-Requires: iproute
-Requires: logrotate
-Requires: net-tools
-Requires: wireless-tools
-Requires: wpa_supplicant
-Requires(post): chkconfig
-Requires(preun): chkconfig
-Requires(preun): initscripts
-Requires(postun): initscripts
+Summary: Wicd common files
+Group: System Environment/Base
+BuildArch: noarch
+Requires: dbus
+Requires: dbus-python
+Requires: dhclient
+Requires: ethtool
+Requires: iproute
+Requires: logrotate
+Requires: net-tools
+Requires: wireless-tools
+Requires: wpa_supplicant
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+Requires(triggerun): systemd-units
+
%description common
This package provides the main wicd daemon and the wicd-cli front-end.
%package curses
-Summary: Curses client for wicd
-Group: Applications/System
-BuildArch: noarch
-Requires: %{name}-common = %{version}-%{release}
-Requires: python-urwid >= 0.9.8.3
+Summary: Curses client for wicd
+Group: Applications/System
+BuildArch: noarch
+Requires: %{name}-common = %{version}-%{release}
+Requires: python-urwid >= 0.9.8.3
%description curses
Client program for wicd that uses a curses interface.
%package gtk
-Summary: GTK+ client for wicd
-Group: Applications/Internet
-BuildArch: noarch
-Requires: %{name}-common = %{version}-%{release}
-Requires: pygtk2-libglade >= 2.10
+Summary: GTK+ client for wicd
+Group: Applications/Internet
+BuildArch: noarch
+Requires: %{name}-common = %{version}-%{release}
+Requires: pygtk2-libglade >= 2.10
%description gtk
Client program for wicd that uses a GTK+ interface.
@@ -84,12 +89,8 @@ Client program for wicd that uses a GTK+ interface.
# which we do in this package.
%patch0 -p1
-# Init scripts should use $RETVAL, not $retval
-# Reported upstream: https://bugs.launchpad.net/wicd/+bug/587690
-%patch1 -p1
-
# Use cPickle instead of deepcopy in configmanager.py
-%patch2 -p1
+%patch1 -p1
%build
# NOTE: --etc is where dhclient.conf.template goes
@@ -100,7 +101,8 @@ Client program for wicd that uses a GTK+ interface.
--etc %{_sysconfdir}/dhcp \
--bin %{_bindir} \
--pmutils %{_libdir}/pm-utils/sleep.d \
- --log %{_localstatedir}/log
+ --log %{_localstatedir}/log \
+ --no-install-init
%{__python} setup.py build
%install
@@ -133,6 +135,9 @@ sed -i -e '/^#!\//, 1d' %{buildroot}%{python_sitelib}/wicd/logfile.py
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/wicd
+mkdir -p %{buildroot}%{_systemd_unit_dir}
+install -m 0644 %{SOURCE2} %{buildroot}%{_systemd_unit_dir}/wicd.service
+
desktop-file-install \
--remove-category="Application" \
--delete-original \
@@ -149,17 +154,28 @@ desktop-file-install \
rm -rf %{buildroot}
%post common
-/sbin/chkconfig --add wicd
+if [ $1 -eq 1 ]; then
+ # Package install, not upgrade
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
%preun common
-if [ $1 -eq 0 ]; then
- /sbin/service wicd stop >/dev/null 2>&1
- /sbin/chkconfig --del wicd
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl disable wicd.service > /dev/null 2>&1 || :
+ /bin/systemctl stop wicd.service > /dev/null 2>&1 || :
fi
%postun common
-if [ $1 -ge 1 ]; then
- /sbin/service wicd condrestart >/dev/null 2>&1 || :
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ /bin/systemctl try-restart wicd.service >/dev/null 2>&1 || :
+fi
+
+%triggerun -- wicd-common < 1.7.0-5
+if /sbin/chkconfig wicd ; then
+ /bin/systemctl enable wicd.service >/dev/null 2>&1 || :
fi
%post gtk
@@ -207,7 +223,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%config(noreplace) %{_sysconfdir}/wicd/encryption/templates/wep-shared
%config(noreplace) %{_sysconfdir}/wicd/encryption/templates/wpa
%config(noreplace) %{_sysconfdir}/wicd/encryption/templates/wpa-psk
-%{_initddir}/wicd
+%{_systemd_unit_dir}/wicd.service
%{python_sitelib}/wicd/*
%{python_sitelib}/Wicd-%{version}*.egg-info
%{_bindir}/wicd-cli
@@ -256,6 +272,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_datadir}/icons/hicolor/scalable/apps/wicd-gtk.svg
%changelog
+* Sat Jan 15 2011 David Cantrell <dcantrell at redhat.com> - 1.7.0-5
+- Replace existing init script with systemd unit file (#661226)
+
* Fri Oct 22 2010 David Cantrell <dcantrell at redhat.com> - 1.7.0-4
- Use cPickle instead of deepcopy in configmanager.py (#645251)
More information about the scm-commits
mailing list