From 34996310706fd68ecd3d0fe0cfaa3299f70edac5 Mon Sep 17 00:00:00 2001 From: gryf Date: Tue, 25 Aug 2020 20:38:00 +0200 Subject: [PATCH] Moved from generated init files to static. Let the maintainers do their choices, instead of jump into ideas about how init files should looks like. Adjusted gitignore file. --- .gitignore | 26 ++++----- in/init=arch=wicd.in => data/init/arch/wicd | 2 +- .../init/debian/wicd | 4 +- .../init/gentoo/wicd | 4 +- in/init=lunar=wicd.in => data/init/lunar/wicd | 2 +- in/init=pld=wicd.in => data/init/pld/wicd | 4 +- .../init/redhat/wicd | 4 +- .../init/slackware/rc.wicd | 4 +- in/init=suse=wicd.in => data/init/suse/wicd | 2 +- in/init=default=wicd.in | 53 ------------------- setup.py | 32 ++++++----- 11 files changed, 37 insertions(+), 100 deletions(-) rename in/init=arch=wicd.in => data/init/arch/wicd (97%) rename in/init=debian=wicd.in => data/init/debian/wicd (98%) rename in/init=gentoo=wicd.in => data/init/gentoo/wicd (92%) rename in/init=lunar=wicd.in => data/init/lunar/wicd (84%) rename in/init=pld=wicd.in => data/init/pld/wicd (95%) rename in/init=redhat=wicd.in => data/init/redhat/wicd (96%) rename in/init=slackware=rc.wicd.in => data/init/slackware/rc.wicd (94%) rename in/init=suse=wicd.in => data/init/suse/wicd (98%) delete mode 100755 in/init=default=wicd.in diff --git a/.gitignore b/.gitignore index ac86dba..46dfda6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,15 @@ -.git -wicd.egg-info/ -*.bak -**/*.pyc +__pycache__/ +*.py[cod] + +build/ +dist/ +sdist/ +*.egg-info/ +MANIFEST + .venv/ -.vscode/ -.bzr/ -experimental.wpr install.log uninstall.log -.bzrignore -vcsinfo.py -build -build/* -init/*/* -wpath.py* man/wicd-curses.8 man/wicd-manager-settings.conf.5 man/wicd-wired-settings.conf.5 @@ -29,8 +25,4 @@ scripts/wicd scripts/wicd-client scripts/wicd-curses translations/* -wicd/wpath.py *tags -dist/ -MANIFEST -debian/ diff --git a/in/init=arch=wicd.in b/data/init/arch/wicd similarity index 97% rename from in/init=arch=wicd.in rename to data/init/arch/wicd index 952e52d..4500eb4 100755 --- a/in/init=arch=wicd.in +++ b/data/init/arch/wicd @@ -5,7 +5,7 @@ . /etc/rc.conf . /etc/rc.d/functions -WICD_BIN="%SBIN%wicd" +WICD_BIN="/usr/sbin/wicd" if [ -f /var/run/wicd/wicd.pid ]; then PID="$(cat /var/run/wicd/wicd.pid)" diff --git a/in/init=debian=wicd.in b/data/init/debian/wicd similarity index 98% rename from in/init=debian=wicd.in rename to data/init/debian/wicd index 879695b..783044b 100755 --- a/in/init=debian=wicd.in +++ b/data/init/debian/wicd @@ -19,10 +19,10 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin DESC="Network connection manager" NAME=wicd RUNDIR=/var/run/$NAME -DAEMON=%SBIN%$NAME +DAEMON=/usr/sbin/$NAME DAEMON_ARGS="" PIDFILE=$RUNDIR/wicd.pid -SCRIPTNAME=%INIT%%INITFILENAME% +SCRIPTNAME=/etc/init.d/wicd # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 diff --git a/in/init=gentoo=wicd.in b/data/init/gentoo/wicd similarity index 92% rename from in/init=gentoo=wicd.in rename to data/init/gentoo/wicd index 1c94a55..4f8dba1 100755 --- a/in/init=gentoo=wicd.in +++ b/data/init/gentoo/wicd @@ -2,8 +2,8 @@ # Copyright 1999-2020 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -WICD_DAEMON=%SBIN%wicd -WICD_PIDFILE=%PIDFILE% +WICD_DAEMON=/usr/sbin/wicd +WICD_PIDFILE=/run/wicd/wicd.pid depend() { need dbus diff --git a/in/init=lunar=wicd.in b/data/init/lunar/wicd similarity index 84% rename from in/init=lunar=wicd.in rename to data/init/lunar/wicd index b16ff30..c2fd136 100755 --- a/in/init=lunar=wicd.in +++ b/data/init/lunar/wicd @@ -7,7 +7,7 @@ # description: wicd wireless/wired internet connection daemon # # processname: wicd -# pidfile: %PIDFILE% +# pidfile: /var/run/wicd/wicd.pid # . /lib/lsb/init-functions $1 diff --git a/in/init=pld=wicd.in b/data/init/pld/wicd similarity index 95% rename from in/init=pld=wicd.in rename to data/init/pld/wicd index 75ce3e2..607580e 100755 --- a/in/init=pld=wicd.in +++ b/data/init/pld/wicd @@ -8,7 +8,7 @@ # # processname: wicd # config: -# pidfile: %PIDFILE% +# pidfile: /var/run/wicd/wicd.pid # # $Id: template.init 9689 2008-03-27 16:15:39Z patrys $ @@ -19,7 +19,7 @@ # Get service config - may override defaults # [ -f /etc/sysconfig/wicd ] && . /etc/sysconfig/wicd -WICD_BIN=%SBIN%wicd +WICD_BIN=/usr/sbin/wicd start() { # Check if the service is already running? diff --git a/in/init=redhat=wicd.in b/data/init/redhat/wicd similarity index 96% rename from in/init=redhat=wicd.in rename to data/init/redhat/wicd index 9daabec..11b10de 100755 --- a/in/init=redhat=wicd.in +++ b/data/init/redhat/wicd @@ -9,9 +9,9 @@ . /etc/rc.d/init.d/functions -WICD_BIN=%SBIN%wicd +WICD_BIN=/usr/sbin/wicd -pidfile=%PIDFILE% +pidfile=/var/run/wicd/wicd.pid servicename=wicd processname=wicd start() diff --git a/in/init=slackware=rc.wicd.in b/data/init/slackware/rc.wicd similarity index 94% rename from in/init=slackware=rc.wicd.in rename to data/init/slackware/rc.wicd index 3c6561a..6c92c2e 100755 --- a/in/init=slackware=rc.wicd.in +++ b/data/init/slackware/rc.wicd @@ -4,8 +4,8 @@ # Start/stop/restart the Wicd daemon # This is defined in /usr/lib/python2.6/site-packages/wicd/wpath.py -PIDFILE="%PIDFILE%" -DAEMON="%SBIN%wicd" +PIDFILE="/var/run/wicd/wicd.pid" +DAEMON="/usr/sbin/wicd" # Define start and stop functions diff --git a/in/init=suse=wicd.in b/data/init/suse/wicd similarity index 98% rename from in/init=suse=wicd.in rename to data/init/suse/wicd index 96e4934..8d12fe1 100755 --- a/in/init=suse=wicd.in +++ b/data/init/suse/wicd @@ -9,7 +9,7 @@ # Description: wicd, a wired and wireless connection manager. ### END INIT INFO -WICD_BIN=%SBIN%wicd +WICD_BIN=/usr/sbin/wicd test -x $WICD_BIN || exit 5 . /etc/rc.status diff --git a/in/init=default=wicd.in b/in/init=default=wicd.in deleted file mode 100755 index 260d41b..0000000 --- a/in/init=default=wicd.in +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -# /etc/init.d/wicd -# Start/stop/restart the Wicd daemon -# Modified the Slackware default init script for use -# where the distro is not detected. - -# This is defined in /usr/lib/python2.5/site-packages/wicd/wpath.py -PIDFILE="%PIDFILE%" - -# Define start and stop functions - -wicd_start() { - if [ -e $PIDFILE ]; then - echo "Wicd appears to already be running." - echo "If this is not the case, then remove " - echo "$PIDFILE and try again..." - exit 1 - else - echo "Starting wicd daemon..." - %SBIN%wicd 2>/dev/null 1>&2 - fi -} - -wicd_stop() { - echo "Stopping wicd daemon..." - if [ -e $PIDFILE ]; then - kill $(cat $PIDFILE) 2>/dev/null - rm -f $PIDFILE 2>/dev/null - else - killall wicd-client 2>/dev/null - fi -} - -# See how we were called and take appropriate action - -case $1 in - start) - wicd_start - ;; - stop) - wicd_stop - ;; - restart) - wicd_stop - wicd_start - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 - ;; -esac - diff --git a/setup.py b/setup.py index 2f89b97..0dce049 100755 --- a/setup.py +++ b/setup.py @@ -304,16 +304,20 @@ class configure(Command): def distro_check(self): print("Distro is: " + self.distro) + + if self.distro is None and self.detected_distro != 'FAIL': + self.distro = self.detected_distro + if self.distro in ['sles', 'suse']: self.init = '/etc/init.d/' - self.initfile = 'init/suse/wicd' + self.initfile = 'data/init/suse/wicd' elif self.distro in ['redhat', 'centos', 'fedora']: self.init = '/etc/rc.d/init.d/' - self.initfile = 'init/redhat/wicd' + self.initfile = 'data/init/redhat/wicd' self.pidfile = '/var/run/wicd.pid' elif self.distro in ['slackware', 'slamd64', 'bluewhite64']: self.init = '/etc/rc.d/' - self.initfile = 'init/slackware/rc.wicd' + self.initfile = 'data/init/slackware/rc.wicd' self.docdir = '/usr/doc/wicd-%s' % VERSION_NUM self.mandir = '/usr/man/' self.no_install_acpi = True @@ -323,31 +327,25 @@ class configure(Command): self.loggroup = "adm" self.logperms = "0640" self.init = '/etc/init.d/' - self.initfile = 'init/debian/wicd' + self.initfile = 'data/init/debian/wicd' elif self.distro in ['arch']: self.init = '/etc/rc.d/' - self.initfile = 'init/arch/wicd' + self.initfile = 'data/init/arch/wicd' elif self.distro in ['gentoo']: self.init = '/etc/init.d/' - self.initfile = 'init/gentoo/wicd' + self.initfile = 'data/init/gentoo/wicd' elif self.distro in ['pld']: self.init = '/etc/rc.d/init.d/' - self.initfile = 'init/pld/wicd' + self.initfile = 'data/init/pld/wicd' elif self.distro in ['crux']: self.init = '/etc/rc.d/' elif self.distro in ['lunar']: self.init = '/etc/init.d/' - self.initfile = 'init/lunar/wicd' + self.initfile = 'data/init/lunar/wicd' else: - if self.distro == 'auto': - print("NOTICE: Automatic distro detection found: %s, retrying " - "with that..." % self.ddistro) - self.distro = self.ddistro - self.distro_check() - else: - print("WARNING: Distro detection failed!") - self.no_install_init = True - self.distro_detect_failed = True + log.warn("WARNING: Distro detection failed!") + self.no_install_init = True + self.distro_detect_failed = True def finalize_options(self): self.distro_check()