1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-19 12:28:08 +01:00

Removed bin/sbin out of config options.

Let's do this in pythonic way, optionally leave the decision to package
maintainers, where to put binaries.
This commit is contained in:
2020-08-31 21:07:30 +02:00
parent 367a9ab74d
commit 0ef443f97c
10 changed files with 42 additions and 65 deletions

View File

@@ -5,7 +5,7 @@
. /etc/rc.conf
. /etc/rc.d/functions
WICD_BIN="/usr/sbin/wicd"
WICD_BIN="/usr/bin/wicd"
if [ -f /var/run/wicd/wicd.pid ]; then
PID="$(cat /var/run/wicd/wicd.pid)"

View File

@@ -19,7 +19,7 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="Network connection manager"
NAME=wicd
RUNDIR=/var/run/$NAME
DAEMON=/usr/sbin/$NAME
DAEMON=/usr/bin/$NAME
DAEMON_ARGS=""
PIDFILE=$RUNDIR/wicd.pid
SCRIPTNAME=/etc/init.d/wicd

View File

@@ -2,7 +2,7 @@
# Copyright 1999-2020 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
WICD_DAEMON=/usr/sbin/wicd
WICD_DAEMON=/usr/bin/wicd
WICD_PIDFILE=/run/wicd/wicd.pid
depend() {

View File

@@ -19,7 +19,7 @@
# Get service config - may override defaults
# [ -f /etc/sysconfig/wicd ] && . /etc/sysconfig/wicd
WICD_BIN=/usr/sbin/wicd
WICD_BIN=/usr/bin/wicd
start() {
# Check if the service is already running?

View File

@@ -9,7 +9,7 @@
. /etc/rc.d/init.d/functions
WICD_BIN=/usr/sbin/wicd
WICD_BIN=/usr/bin/wicd
pidfile=/var/run/wicd/wicd.pid
servicename=wicd

View File

@@ -5,7 +5,7 @@
# This is defined in /usr/lib/python2.6/site-packages/wicd/wpath.py
PIDFILE="/var/run/wicd/wicd.pid"
DAEMON="/usr/sbin/wicd"
DAEMON="/usr/bin/wicd"
# Define start and stop functions

View File

@@ -9,7 +9,7 @@
# Description: wicd, a wired and wireless connection manager.
### END INIT INFO
WICD_BIN=/usr/sbin/wicd
WICD_BIN=/usr/bin/wicd
test -x $WICD_BIN || exit 5
. /etc/rc.status

View File

@@ -28,9 +28,7 @@ import subprocess
from distutils import log
from distutils.command import build as _build
import pkg_resources
import setuptools
from setuptools.command import install_scripts as _install_scripts
from setuptools.command import install as _install
import wicd
@@ -71,29 +69,29 @@ empty_file = 'other/.empty_on_purpose'
# change to the directory setup.py is contained in
os.chdir(os.path.abspath(os.path.split(__file__)[0]))
BUILD_OPTS = {'bin': '/usr/bin/',
'dbus': '/etc/dbus-1/system.d/',
BUILD_OPTS = {'dbus': '/etc/dbus-1/system.d/',
'dbus_service': '/usr/share/dbus-1/system-services/',
'distro': None,
'docdir': '/usr/share/doc/wicd/',
'logrotate': '/etc/logrotate.d/',
'mandir': '/usr/share/man/',
'scripts': '/etc/wicd/scripts/',
'systemd': '/lib/systemd/system/',
'resume': '/etc/acpi/resume.d/',
'suspend': '/etc/acpi/suspend.d/',
'pmutils': '/usr/lib/pm-utils/sleep.d/',
'no_install_init': False,
'no_install_man': False,
'no_install_i18n': False,
'no_install_i18n_man': False,
'no_install_acpi': False,
'no_install_pmutils': False,
'no_install_docs': False,
'distro_detect_failed': False,
'docdir': '/usr/share/doc/wicd/',
'init': '',
'initfile': '',
'initfilename': ''}
'initfilename': '',
'logrotate': '/etc/logrotate.d/',
'mandir': '/usr/share/man/',
'no_install_acpi': False,
'no_install_docs': False,
'no_install_i18n': False,
'no_install_i18n_man': False,
'no_install_init': False,
'no_install_man': False,
'no_install_pmutils': False,
'pmutils': '/usr/lib/pm-utils/sleep.d/',
'resume': '/etc/acpi/resume.d/',
'scripts': '/etc/wicd/scripts/',
'suspend': '/etc/acpi/suspend.d/',
'systemd': '/lib/systemd/system/',
'translations': '/usr/share/locale'}
class build(_build.build):
@@ -110,8 +108,6 @@ class configure(setuptools.Command):
user_options = [
('encryption=', None, 'set the encryption template directory'),
('bin=', None, 'set the bin directory'),
('sbin=', None, 'set the sbin directory'),
('networks=', None, 'set the encryption configuration directory'),
('log=', None, 'set the log directory'),
('resume=', None, 'set the directory the resume from suspend script '
@@ -319,28 +315,6 @@ class configure(setuptools.Command):
pass
class install_scripts(_install_scripts.install_scripts):
def write_script(self, script_name, contents, mode="t", *ignored):
"""Write an executable file to the scripts directory"""
from setuptools.command.easy_install import chmod, current_umask
log.info("Installing %s script to %s", script_name, self.install_dir)
install_dir = self.install_dir
if script_name == 'wicd':
install_dir = os.path.join(
self.install_dir[:self.install_dir.rfind('bin')], 'sbin')
target = os.path.join(install_dir, script_name)
self.outfiles.append(target)
mask = current_umask()
if not self.dry_run:
pkg_resources.ensure_directory(target)
f = open(target, "w" + mode)
f.write(contents)
f.close()
chmod(target, 0o777 - mask)
class clear_generated(setuptools.Command):
description = 'clears out files generated by configure'
@@ -386,6 +360,9 @@ class install(_install.install):
(wpath.preconnectscripts, [empty_file]),
(wpath.postconnectscripts, [empty_file])])
if os.path.exists('data/etc/wicd.conf'):
data.append((wpath.etc, ['data/etc/wicd.conf']))
if not wpath.no_install_docs:
data.append((wpath.docdir, ['AUTHORS', 'CHANGES', 'INSTALL',
'LICENSE', 'README.cli',
@@ -427,15 +404,16 @@ class install(_install.install):
log.info('Using pid path %s', os.path.basename(wpath.pidfile))
if not wpath.no_install_i18n:
for language in sorted(glob('translations/*')):
language = language.replace('translations/', '')
for language in sorted(os.listdir('translations')):
log.info('Language support for %s', language)
data.append((os.path.join(wpath.translations, language,
'/LC_MESSAGES/'),
[os.path.join('translations/', language,
'LC_MESSAGES'),
[os.path.join('translations', language,
'LC_MESSAGES', 'wicd.mo')]))
for dir_ in (os.listdir('data')):
if dir_ == 'init':
continue
path = os.path.join('data', dir_)
for fname in os.listdir(path):
data.append((wpath[dir_], [os.path.join(path, fname)]))
@@ -584,7 +562,6 @@ class uninstall(setuptools.Command):
setuptools.setup(cmdclass={'build': build,
'configure': configure,
'install': install,
'install_scripts': install_scripts,
'test': test,
'clear_generated': clear_generated,
'update_message_catalog': update_message_catalog,

View File

@@ -2,24 +2,24 @@ import configparser
import os
DEFAULTS = {'daemon': '/usr/share/wicd/daemon',
DEFAULTS = {'bin': '/usr/bin',
'daemon': '/usr/share/wicd/daemon',
'encryption': '/etc/wicd/encryption-templates',
'etc': '/etc/wicd',
'log': '/var/log/wicd',
'loggroup': '',
'logperms': '0600',
'networks': '/var/lib/wicd/configurations',
'pidfile': '/var/run/wicd.pid',
'postconnectscripts': '/etc/wicd/scripts/postconnect',
'postdisconnectscripts': '/etc/wicd/scripts/postdisconnect',
'preconnectscripts': '/etc/wicd/scripts/preconnect',
'predisconnectscripts': '/etc/wicd/scripts/predisconnect',
'sbin': '/usr/sbin',
'python': 'python',
'revision': '',
'translations': '/usr/share/locale',
'varlib': '/var/lib/wicd',
'log': '/var/log/wicd/',
'loggroup': '',
'logperms': '0600',
'revision': '',
'wicdgroup': 'users',
'python': 'python'}
'wicdgroup': 'users'}
SECTION = 'wicd'
CFG_FILE = 'wicd.conf'

View File

@@ -212,7 +212,7 @@ def IsValidIPv6(ip):
def PromptToStartDaemon():
"""Prompt the user to start the daemon"""
daemonloc = os.path.join(CFG.sbin, 'wicd')
daemonloc = os.path.join(CFG.bin, 'wicd')
sudo_prog = choose_sudo_prog()
if not sudo_prog:
return False