mirror of
https://github.com/gryf/wicd.git
synced 2025-12-19 20:38:00 +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:
@@ -5,7 +5,7 @@
|
|||||||
. /etc/rc.conf
|
. /etc/rc.conf
|
||||||
. /etc/rc.d/functions
|
. /etc/rc.d/functions
|
||||||
|
|
||||||
WICD_BIN="/usr/sbin/wicd"
|
WICD_BIN="/usr/bin/wicd"
|
||||||
|
|
||||||
if [ -f /var/run/wicd/wicd.pid ]; then
|
if [ -f /var/run/wicd/wicd.pid ]; then
|
||||||
PID="$(cat /var/run/wicd/wicd.pid)"
|
PID="$(cat /var/run/wicd/wicd.pid)"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
|||||||
DESC="Network connection manager"
|
DESC="Network connection manager"
|
||||||
NAME=wicd
|
NAME=wicd
|
||||||
RUNDIR=/var/run/$NAME
|
RUNDIR=/var/run/$NAME
|
||||||
DAEMON=/usr/sbin/$NAME
|
DAEMON=/usr/bin/$NAME
|
||||||
DAEMON_ARGS=""
|
DAEMON_ARGS=""
|
||||||
PIDFILE=$RUNDIR/wicd.pid
|
PIDFILE=$RUNDIR/wicd.pid
|
||||||
SCRIPTNAME=/etc/init.d/wicd
|
SCRIPTNAME=/etc/init.d/wicd
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Copyright 1999-2020 Gentoo Foundation
|
# Copyright 1999-2020 Gentoo Foundation
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
# 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
|
WICD_PIDFILE=/run/wicd/wicd.pid
|
||||||
|
|
||||||
depend() {
|
depend() {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
# Get service config - may override defaults
|
# Get service config - may override defaults
|
||||||
# [ -f /etc/sysconfig/wicd ] && . /etc/sysconfig/wicd
|
# [ -f /etc/sysconfig/wicd ] && . /etc/sysconfig/wicd
|
||||||
|
|
||||||
WICD_BIN=/usr/sbin/wicd
|
WICD_BIN=/usr/bin/wicd
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
# Check if the service is already running?
|
# Check if the service is already running?
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
. /etc/rc.d/init.d/functions
|
. /etc/rc.d/init.d/functions
|
||||||
|
|
||||||
|
|
||||||
WICD_BIN=/usr/sbin/wicd
|
WICD_BIN=/usr/bin/wicd
|
||||||
|
|
||||||
pidfile=/var/run/wicd/wicd.pid
|
pidfile=/var/run/wicd/wicd.pid
|
||||||
servicename=wicd
|
servicename=wicd
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
# This is defined in /usr/lib/python2.6/site-packages/wicd/wpath.py
|
# This is defined in /usr/lib/python2.6/site-packages/wicd/wpath.py
|
||||||
PIDFILE="/var/run/wicd/wicd.pid"
|
PIDFILE="/var/run/wicd/wicd.pid"
|
||||||
DAEMON="/usr/sbin/wicd"
|
DAEMON="/usr/bin/wicd"
|
||||||
|
|
||||||
# Define start and stop functions
|
# Define start and stop functions
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
# Description: wicd, a wired and wireless connection manager.
|
# Description: wicd, a wired and wireless connection manager.
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
WICD_BIN=/usr/sbin/wicd
|
WICD_BIN=/usr/bin/wicd
|
||||||
test -x $WICD_BIN || exit 5
|
test -x $WICD_BIN || exit 5
|
||||||
|
|
||||||
. /etc/rc.status
|
. /etc/rc.status
|
||||||
|
|||||||
75
setup.py
75
setup.py
@@ -28,9 +28,7 @@ import subprocess
|
|||||||
from distutils import log
|
from distutils import log
|
||||||
from distutils.command import build as _build
|
from distutils.command import build as _build
|
||||||
|
|
||||||
import pkg_resources
|
|
||||||
import setuptools
|
import setuptools
|
||||||
from setuptools.command import install_scripts as _install_scripts
|
|
||||||
from setuptools.command import install as _install
|
from setuptools.command import install as _install
|
||||||
|
|
||||||
import wicd
|
import wicd
|
||||||
@@ -71,29 +69,29 @@ empty_file = 'other/.empty_on_purpose'
|
|||||||
# change to the directory setup.py is contained in
|
# change to the directory setup.py is contained in
|
||||||
os.chdir(os.path.abspath(os.path.split(__file__)[0]))
|
os.chdir(os.path.abspath(os.path.split(__file__)[0]))
|
||||||
|
|
||||||
BUILD_OPTS = {'bin': '/usr/bin/',
|
BUILD_OPTS = {'dbus': '/etc/dbus-1/system.d/',
|
||||||
'dbus': '/etc/dbus-1/system.d/',
|
|
||||||
'dbus_service': '/usr/share/dbus-1/system-services/',
|
'dbus_service': '/usr/share/dbus-1/system-services/',
|
||||||
'distro': None,
|
'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,
|
'distro_detect_failed': False,
|
||||||
|
'docdir': '/usr/share/doc/wicd/',
|
||||||
'init': '',
|
'init': '',
|
||||||
'initfile': '',
|
'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):
|
class build(_build.build):
|
||||||
@@ -110,8 +108,6 @@ class configure(setuptools.Command):
|
|||||||
|
|
||||||
user_options = [
|
user_options = [
|
||||||
('encryption=', None, 'set the encryption template directory'),
|
('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'),
|
('networks=', None, 'set the encryption configuration directory'),
|
||||||
('log=', None, 'set the log directory'),
|
('log=', None, 'set the log directory'),
|
||||||
('resume=', None, 'set the directory the resume from suspend script '
|
('resume=', None, 'set the directory the resume from suspend script '
|
||||||
@@ -319,28 +315,6 @@ class configure(setuptools.Command):
|
|||||||
pass
|
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):
|
class clear_generated(setuptools.Command):
|
||||||
description = 'clears out files generated by configure'
|
description = 'clears out files generated by configure'
|
||||||
|
|
||||||
@@ -386,6 +360,9 @@ class install(_install.install):
|
|||||||
(wpath.preconnectscripts, [empty_file]),
|
(wpath.preconnectscripts, [empty_file]),
|
||||||
(wpath.postconnectscripts, [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:
|
if not wpath.no_install_docs:
|
||||||
data.append((wpath.docdir, ['AUTHORS', 'CHANGES', 'INSTALL',
|
data.append((wpath.docdir, ['AUTHORS', 'CHANGES', 'INSTALL',
|
||||||
'LICENSE', 'README.cli',
|
'LICENSE', 'README.cli',
|
||||||
@@ -427,15 +404,16 @@ class install(_install.install):
|
|||||||
log.info('Using pid path %s', os.path.basename(wpath.pidfile))
|
log.info('Using pid path %s', os.path.basename(wpath.pidfile))
|
||||||
|
|
||||||
if not wpath.no_install_i18n:
|
if not wpath.no_install_i18n:
|
||||||
for language in sorted(glob('translations/*')):
|
for language in sorted(os.listdir('translations')):
|
||||||
language = language.replace('translations/', '')
|
|
||||||
log.info('Language support for %s', language)
|
log.info('Language support for %s', language)
|
||||||
data.append((os.path.join(wpath.translations, language,
|
data.append((os.path.join(wpath.translations, language,
|
||||||
'/LC_MESSAGES/'),
|
'LC_MESSAGES'),
|
||||||
[os.path.join('translations/', language,
|
[os.path.join('translations', language,
|
||||||
'LC_MESSAGES', 'wicd.mo')]))
|
'LC_MESSAGES', 'wicd.mo')]))
|
||||||
|
|
||||||
for dir_ in (os.listdir('data')):
|
for dir_ in (os.listdir('data')):
|
||||||
|
if dir_ == 'init':
|
||||||
|
continue
|
||||||
path = os.path.join('data', dir_)
|
path = os.path.join('data', dir_)
|
||||||
for fname in os.listdir(path):
|
for fname in os.listdir(path):
|
||||||
data.append((wpath[dir_], [os.path.join(path, fname)]))
|
data.append((wpath[dir_], [os.path.join(path, fname)]))
|
||||||
@@ -584,7 +562,6 @@ class uninstall(setuptools.Command):
|
|||||||
setuptools.setup(cmdclass={'build': build,
|
setuptools.setup(cmdclass={'build': build,
|
||||||
'configure': configure,
|
'configure': configure,
|
||||||
'install': install,
|
'install': install,
|
||||||
'install_scripts': install_scripts,
|
|
||||||
'test': test,
|
'test': test,
|
||||||
'clear_generated': clear_generated,
|
'clear_generated': clear_generated,
|
||||||
'update_message_catalog': update_message_catalog,
|
'update_message_catalog': update_message_catalog,
|
||||||
|
|||||||
@@ -2,24 +2,24 @@ import configparser
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
DEFAULTS = {'daemon': '/usr/share/wicd/daemon',
|
DEFAULTS = {'bin': '/usr/bin',
|
||||||
|
'daemon': '/usr/share/wicd/daemon',
|
||||||
'encryption': '/etc/wicd/encryption-templates',
|
'encryption': '/etc/wicd/encryption-templates',
|
||||||
'etc': '/etc/wicd',
|
'etc': '/etc/wicd',
|
||||||
|
'log': '/var/log/wicd',
|
||||||
|
'loggroup': '',
|
||||||
|
'logperms': '0600',
|
||||||
'networks': '/var/lib/wicd/configurations',
|
'networks': '/var/lib/wicd/configurations',
|
||||||
'pidfile': '/var/run/wicd.pid',
|
'pidfile': '/var/run/wicd.pid',
|
||||||
'postconnectscripts': '/etc/wicd/scripts/postconnect',
|
'postconnectscripts': '/etc/wicd/scripts/postconnect',
|
||||||
'postdisconnectscripts': '/etc/wicd/scripts/postdisconnect',
|
'postdisconnectscripts': '/etc/wicd/scripts/postdisconnect',
|
||||||
'preconnectscripts': '/etc/wicd/scripts/preconnect',
|
'preconnectscripts': '/etc/wicd/scripts/preconnect',
|
||||||
'predisconnectscripts': '/etc/wicd/scripts/predisconnect',
|
'predisconnectscripts': '/etc/wicd/scripts/predisconnect',
|
||||||
'sbin': '/usr/sbin',
|
'python': 'python',
|
||||||
|
'revision': '',
|
||||||
'translations': '/usr/share/locale',
|
'translations': '/usr/share/locale',
|
||||||
'varlib': '/var/lib/wicd',
|
'varlib': '/var/lib/wicd',
|
||||||
'log': '/var/log/wicd/',
|
'wicdgroup': 'users'}
|
||||||
'loggroup': '',
|
|
||||||
'logperms': '0600',
|
|
||||||
'revision': '',
|
|
||||||
'wicdgroup': 'users',
|
|
||||||
'python': 'python'}
|
|
||||||
SECTION = 'wicd'
|
SECTION = 'wicd'
|
||||||
CFG_FILE = 'wicd.conf'
|
CFG_FILE = 'wicd.conf'
|
||||||
|
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ def IsValidIPv6(ip):
|
|||||||
|
|
||||||
def PromptToStartDaemon():
|
def PromptToStartDaemon():
|
||||||
"""Prompt the user to start the daemon"""
|
"""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()
|
sudo_prog = choose_sudo_prog()
|
||||||
if not sudo_prog:
|
if not sudo_prog:
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user