1
0
mirror of https://github.com/gryf/wicd.git synced 2026-01-07 22:34:18 +01:00

Fix up paths, take adventage of data path

This commit is contained in:
2020-08-27 20:33:05 +02:00
parent 8ddc4ac945
commit 367a9ab74d
33 changed files with 42 additions and 254 deletions

View File

@@ -18,7 +18,7 @@
</policy> </policy>
<!-- This Unix group will have permission to use Wicd's gui --> <!-- This Unix group will have permission to use Wicd's gui -->
<policy group="%WICDGROUP%"> <policy group="users">
<allow send_destination="org.wicd.daemon"/> <allow send_destination="org.wicd.daemon"/>
<allow send_interface="org.wicd.daemon"/> <allow send_interface="org.wicd.daemon"/>
<allow send_interface="org.freedesktop.DBus.Introspectable"/> <allow send_interface="org.freedesktop.DBus.Introspectable"/>
@@ -29,7 +29,7 @@
<!-- Comment the block below if you do not want all users logged in <!-- Comment the block below if you do not want all users logged in
locally to have permission to use wicd-client. This ignores the locally to have permission to use wicd-client. This ignores the
group based permission model defined above for the "%WICDGROUP%" group based permission model defined above for the "users"
group. Note that this only applies if you are using ConsoleKit - group. Note that this only applies if you are using ConsoleKit -
if you do not have ConsoleKit installed and in use, then this if you do not have ConsoleKit installed and in use, then this
block makes no difference either way. --> block makes no difference either way. -->

View File

@@ -0,0 +1,6 @@
/var/log/wicd/wicd.log {
missingok
notifempty
size 30k
create 0600 root
}

View File

@@ -1,6 +0,0 @@
%LOG%wicd.log {
missingok
notifempty
size 30k
create %LOGPERMS% root %LOGGROUP%
}

View File

@@ -1,2 +0,0 @@
#!/bin/bash
exec %PYTHON% -O %SHARE%cli/wicd-cli.py $@

View File

@@ -1,45 +0,0 @@
#!/bin/sh
# check_firstrun()
if [ ! -d "$HOME/.wicd" ]; then
mkdir -p "$HOME/.wicd"
fi
# Make sure the user knows WHEREAREMYFILES ;-)
if [ -e "%VARLIB%WHEREAREMYFILES" ] && [ ! -L "$HOME/.wicd/WHEREAREMYFILES" ]; then
ln -s "%VARLIB%WHEREAREMYFILES" "$HOME/.wicd/WHEREAREMYFILES"
fi
if [ "$DISPLAY" = "" ]; then
BOLD=$(tput bold)
BLUE=$(tput setaf 4)
NC=$(tput sgr0)
if [ -x "%BIN%wicd-curses" ]; then
if [ ! -f "$HOME/.wicd/CLIENT_CURSES_WARNING" ]; then
printf "NOTICE: You do not have an X server active on this console, \n"
printf "so ${BOLD}${BLUE}wicd-curses${NC} will be started instead. \n"
printf "Please see the wicd-client and/or wicd-curses manual pages \n"
printf "for more information about this error and resulting message. \n"
printf "\n"
printf "This message will not be displayed again. \n"
printf "Press enter to continue... \n"
read _junk
cat >> "$HOME/.wicd/CLIENT_CURSES_WARNING" << EOF
The wicd-client script checks for the existence of this file to determine
whether it should warn the user before launching wicd-curses instead, in
the event of the gui client being launched outside of the X Window environment.
If you delete this file, then wicd-client will print the warning if it is
launched outside of X (and then recreate this file again).
EOF
fi
exec %BIN%wicd-curses $@
else
printf "NOTICE: You do not have an X server active on this console, \n"
printf "but you do not appear to have ${BOLD}${BLUE}wicd-curses${NC}\n"
printf "installed on this system. We'd normally be running it here.\n"
printf "Please see the wicd-client manual page for more information.\n"
fi
else
exec %BIN%wicd-gtk $@
fi

View File

@@ -1,9 +0,0 @@
#!/bin/sh
if [ ! -d "$HOME/.wicd" ]; then
mkdir -p "$HOME/.wicd"
fi
if [ -e "%VARLIB%WHEREAREMYFILES" ] && [ ! -L "$HOME/.wicd/WHEREAREMYFILES" ]; then
ln -s "%VARLIB%WHEREAREMYFILES" "$HOME/.wicd/WHEREAREMYFILES"
fi
exec %PYTHON% -O %SHARE%curses/wicd-curses.py $@

View File

@@ -1,12 +0,0 @@
#!/bin/sh
# check_firstrun()
if [ ! -d "$HOME/.wicd" ]; then
mkdir -p "$HOME/.wicd"
fi
# Make sure the user knows WHEREAREMYFILES ;-)
if [ -e "/var/lib/wicd/WHEREAREMYFILES" ] && [ ! -L "$HOME/.wicd/WHEREAREMYFILES" ]; then
ln -s "/var/lib/wicd/WHEREAREMYFILES" "$HOME/.wicd/WHEREAREMYFILES"
fi
exec %PYTHON% -O %SHARE%gtk/wicd-client.py $@

View File

@@ -1,3 +0,0 @@
#!/bin/sh
exec %PYTHON% -O %SHARE%daemon/wicd-daemon.py $@

View File

@@ -1,101 +0,0 @@
"""Path configuration and functions for the wicd daemon and gui clients.
chdir() -- Change directory to the location of the current file.
"""
import os
# The path containing the wpath.py file.
current = os.path.dirname(os.path.realpath(__file__)) + '/'
# These paths can easily be modified to handle system wide installs, or
# they can be left as is if all files remain with the source directory
# layout.
# These paths are replaced when setup.py configure is run
# All directory paths *MUST* end in a /
version = '%VERSION%'
revision = '%REVNO%'
curses_revision = '%CURSES_REVNO%'
# DIRECTORIES
lib = '%LIB%'
share = '%SHARE%'
etc = '%ETC%'
scripts = '%SCRIPTS%'
predisconnectscripts = '%SCRIPTS%predisconnect'
postdisconnectscripts = '%SCRIPTS%postdisconnect'
preconnectscripts = '%SCRIPTS%preconnect'
postconnectscripts = '%SCRIPTS%postconnect'
images = '%IMAGES%'
encryption = '%ENCRYPTION%'
bin = '%BIN%'
varlib = '%VARLIB%'
networks = '%NETWORKS%'
log = '%LOG%'
resume = '%RESUME%'
suspend = '%SUSPEND%'
sbin = '%SBIN%'
pmutils = '%PMUTILS%'
dbus = '%DBUS%'
dbus_service = '%DBUS_SERVICE%'
systemd = '%SYSTEMD%'
logrotate = '%LOGROTATE%'
desktop = '%DESKTOP%'
backends = '%BACKENDS%'
daemon = '%DAEMON%'
curses = '%CURSES%'
gtk = '%GTK%'
cli = '%CLI%'
gnome_shell_extensions = '%GNOME_SHELL_EXTENSIONS%'
translations = '%TRANSLATIONS%'
icons = '%ICONS%'
pixmaps = '%PIXMAPS%'
autostart = '%AUTOSTART%'
init = '%INIT%'
docdir = '%DOCDIR%'
mandir = '%MANDIR%'
kdedir = '%KDEDIR%'
# FILES
# python begins the file section
python = '%PYTHON%'
pidfile = '%PIDFILE%'
# stores something like other/wicd
# really only used in the install
initfile = '%INITFILE%'
# stores only the file name, i.e. wicd
initfilename = '%INITFILENAME%'
wicd_group = '%WICDGROUP%'
log_group = '%LOGGROUP%'
log_perms = '%LOGPERMS%'
# BOOLEANS
no_install_pmutils = %NO_INSTALL_PMUTILS%
no_install_init = %NO_INSTALL_INIT%
no_install_man = %NO_INSTALL_MAN%
no_install_i18n = %NO_INSTALL_I18N%
no_install_i18n_man = %NO_INSTALL_I18N_MAN%
no_install_kde = %NO_INSTALL_KDE%
no_install_acpi = %NO_INSTALL_ACPI%
no_install_docs = %NO_INSTALL_DOCS%
no_install_gtk = %NO_INSTALL_GTK%
no_install_ncurses = %NO_INSTALL_NCURSES%
no_install_cli = %NO_INSTALL_CLI%
no_install_gnome_shell_extensions = %NO_INSTALL_GNOME_SHELL_EXTENSIONS%
no_use_notifications = %NO_USE_NOTIFICATIONS%
def chdir(f):
"""Change directory to the location of the specified file.
Keyword arguments:
f -- the file to switch to (usually __file__)
"""
os.chdir(os.path.dirname(os.path.realpath(f)))

View File

@@ -1 +0,0 @@
wicd=wpath.py.in

107
setup.py
View File

@@ -192,13 +192,6 @@ class configure(setuptools.Command):
except (OSError, ValueError, FileNotFoundError): except (OSError, ValueError, FileNotFoundError):
pass # use our default pass # use our default
self.python = '/usr/bin/python3'
self.pidfile = '/var/run/wicd/wicd.pid'
self.initfilename = os.path.basename(self.initfile)
self.wicdgroup = 'users'
self.loggroup = ''
self.logperms = '0600'
def distro_check(self): def distro_check(self):
log.info("Distro is: %s", self.distro) log.info("Distro is: %s", self.distro)
@@ -385,60 +378,22 @@ class install(_install.install):
with open('wpath.json') as fobj: with open('wpath.json') as fobj:
wpath = config.Config(json.load(fobj)) wpath = config.Config(json.load(fobj))
data.extend([(wpath.log, [empty_file]),
(wpath.networks, [empty_file]),
(wpath.scripts, [empty_file]),
(wpath.predisconnectscripts, [empty_file]),
(wpath.postdisconnectscripts, [empty_file]),
(wpath.preconnectscripts, [empty_file]),
(wpath.postconnectscripts, [empty_file])])
data.extend([
(wpath.dbus, ['other/wicd.conf']),
(wpath.dbus_service, ['other/org.wicd.daemon.service']),
(wpath.systemd, ['other/wicd.service']),
(wpath.logrotate, ['other/wicd.logrotate']),
(wpath.log, [empty_file]),
(wpath.etc, ['other/dhclient.conf.template.default']),
(wpath.encryption, [('encryption/templates/' + b) for b in
os.listdir('encryption/templates')
if not b.startswith('.')]),
(wpath.networks, [empty_file]),
(wpath.sbin, ['scripts/wicd']),
(wpath.daemon, ['wicd/monitor.py', 'wicd/wicd-daemon.py',
'wicd/suspend.py', 'wicd/autoconnect.py']),
(wpath.backends, ['wicd/backends/be-external.py',
'wicd/backends/be-ioctl.py']),
(wpath.scripts, [empty_file]),
(wpath.predisconnectscripts, [empty_file]),
(wpath.postdisconnectscripts, [empty_file]),
(wpath.preconnectscripts, [empty_file]),
(wpath.postconnectscripts, [empty_file])
])
if not wpath.no_install_ncurses:
data.append((wpath.curses, ['curses/curses_misc.py']))
data.append((wpath.curses, ['curses/prefs_curses.py']))
data.append((wpath.curses, ['curses/wicd-curses.py']))
data.append((wpath.curses, ['curses/netentry_curses.py']))
data.append((wpath.curses, ['curses/configscript_curses.py']))
data.append((wpath.bin, ['scripts/wicd-curses']))
if not wpath.no_install_man:
data.append((wpath.mandir + 'man8/', ['man/wicd-curses.8']))
if not wpath.no_install_man and not wpath.no_install_i18n_man:
data.append((wpath.mandir + 'nl/man8/',
['man/nl/wicd-curses.8']))
if not wpath.no_install_docs:
data.append((wpath.docdir, ['curses/README.curses']))
if not wpath.no_install_cli:
data.append((wpath.cli, ['cli/wicd-cli.py']))
data.append((wpath.bin, ['scripts/wicd-cli']))
if not wpath.no_install_man:
data.append((wpath.mandir + 'man8/', ['man/wicd-cli.8']))
if not wpath.no_install_docs:
data.append((wpath.docdir, ['cli/README.cli']))
piddir = os.path.dirname(wpath.pidfile)
if not piddir.endswith('/'):
piddir += '/'
if not wpath.no_install_docs: if not wpath.no_install_docs:
data.append((wpath.docdir, ['INSTALL', 'LICENSE', 'AUTHORS', data.append((wpath.docdir, ['AUTHORS', 'CHANGES', 'INSTALL',
'README', 'CHANGES', ])) 'LICENSE', 'README.cli',
data.append((wpath.varlib, ['other/WHEREAREMYFILES'])) 'README.curses', 'README.old',
'README.rst']))
if not wpath.no_install_init: if not wpath.no_install_init:
data.append((wpath.init, [wpath.initfile])) data.append((wpath.init, [wpath.initfile]))
if not wpath.no_install_man: if not wpath.no_install_man:
data.append((wpath.mandir + 'man8/', ['man/wicd.8'])) data.append((wpath.mandir + 'man8/', ['man/wicd.8']))
data.append((wpath.mandir + 'man5/', data.append((wpath.mandir + 'man5/',
@@ -447,32 +402,38 @@ class install(_install.install):
['man/wicd-wired-settings.conf.5'])) ['man/wicd-wired-settings.conf.5']))
data.append((wpath.mandir + 'man5/', data.append((wpath.mandir + 'man5/',
['man/wicd-wireless-settings.conf.5'])) ['man/wicd-wireless-settings.conf.5']))
data.append((wpath.mandir + 'man1/', ['man/wicd-client.1'])) data.append((wpath.mandir + 'man8/', ['man/wicd-curses.8']))
if not wpath.no_install_man and not wpath.no_install_i18n_man: data.append((wpath.mandir + 'man8/', ['man/wicd-cli.8']))
# Dutch translations of the man
data.append((wpath.mandir + 'nl/man8/', ['man/nl/wicd.8'])) if not wpath['no_install_i18n_man']:
data.append((wpath.mandir + 'nl/man5/', # Dutch translations of the man
['man/nl/wicd-manager-settings.conf.5'])) data.append((wpath.mandir + 'nl/man8/', ['man/nl/wicd.8']))
data.append((wpath.mandir + 'nl/man5/', data.append((wpath.mandir + 'nl/man5/',
['man/nl/wicd-wired-settings.conf.5'])) ['man/nl/wicd-manager-settings.conf.5']))
data.append((wpath.mandir + 'nl/man5/', data.append((wpath.mandir + 'nl/man5/',
['man/nl/wicd-wireless-settings.conf.5'])) ['man/nl/wicd-wired-settings.conf.5']))
data.append((wpath.mandir + 'nl/man1/', data.append((wpath.mandir + 'nl/man5/',
['man/nl/wicd-client.1'])) ['man/nl/wicd-wireless-settings.conf.5']))
data.append((wpath.mandir + 'nl/man8/',
['man/nl/wicd-curses.8']))
# TODO(gryf): sort out paths for pmutils/acpi
if not wpath.no_install_acpi: if not wpath.no_install_acpi:
data.append((wpath.resume, ['other/80-wicd-connect.sh'])) data.append((wpath.resume, ['other/80-wicd-connect.sh']))
data.append((wpath.suspend, ['other/50-wicd-suspend.sh'])) data.append((wpath.suspend, ['other/50-wicd-suspend.sh']))
if not wpath.no_install_pmutils: if not wpath.no_install_pmutils:
data.append((wpath.pmutils, ['other/55wicd'])) data.append((wpath.pmutils, ['other/55wicd']))
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:
print('Language support for', end=' ')
for language in sorted(glob('translations/*')): for language in sorted(glob('translations/*')):
language = language.replace('translations/', '') language = language.replace('translations/', '')
log.info('Language support for %s', language) log.info('Language support for %s', language)
data.append((wpath.translations + language + '/LC_MESSAGES/', data.append((os.path.join(wpath.translations, language,
['translations/' + language + '/LC_MESSAGES/'),
'/LC_MESSAGES/wicd.mo'])) [os.path.join('translations/', language,
'LC_MESSAGES', 'wicd.mo')]))
for dir_ in (os.listdir('data')): for dir_ in (os.listdir('data')):
path = os.path.join('data', dir_) path = os.path.join('data', dir_)