From 355a8bca1c0cf282ea7e0f7a57030b3850d11944 Mon Sep 17 00:00:00 2001 From: David Paleino Date: Sat, 13 Jun 2009 22:59:03 +0200 Subject: [PATCH 1/5] Support --loggroup and --logperms arguments to setup.py --- .bzrignore | 1 + wicd/wicd-daemon.py => in/wicd=wicd-daemon.py.in | 8 ++++++-- in/wicd=wpath.py.in | 2 ++ setup.py | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) rename wicd/wicd-daemon.py => in/wicd=wicd-daemon.py.in (99%) diff --git a/.bzrignore b/.bzrignore index 29a8142..0cfc4e1 100644 --- a/.bzrignore +++ b/.bzrignore @@ -22,5 +22,6 @@ scripts/wicd scripts/wicd-client scripts/wicd-curses translations/* +wicd/wicd-daemon.py wicd/wpath.py *tags diff --git a/wicd/wicd-daemon.py b/in/wicd=wicd-daemon.py.in similarity index 99% rename from wicd/wicd-daemon.py rename to in/wicd=wicd-daemon.py.in index 24289ed..32abcbe 100644 --- a/wicd/wicd-daemon.py +++ b/in/wicd=wicd-daemon.py.in @@ -1671,9 +1671,13 @@ def main(argv): output = ManagedStdio(logpath) if os.path.exists(logpath): try: - os.chmod(logpath, 0600) + os.chmod(logpath, %LOGPERMS%) + if "%LOGGROUP%": + import grp + group = grp.getgrnam("%LOGGROUP%") + os.chown(logpath, 0, group[2]) except: - print 'unable to chmod log file to 0600' + print 'unable to chmod log file to %LOGPERMS%' if redirect_stdout: sys.stdout = output if redirect_stderr: sys.stderr = output diff --git a/in/wicd=wpath.py.in b/in/wicd=wpath.py.in index d1fbbc1..b441ba5 100755 --- a/in/wicd=wpath.py.in +++ b/in/wicd=wpath.py.in @@ -62,6 +62,8 @@ 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% diff --git a/setup.py b/setup.py index c2f67cc..13508b8 100755 --- a/setup.py +++ b/setup.py @@ -242,6 +242,8 @@ class configure(Command): self.no_install_acpi = True elif self.distro in ['debian']: self.wicdgroup = "netdev" + self.loggroup = "adm" + self.logperms = "0640" self.init = '/etc/init.d/' self.initfile = 'init/debian/wicd' elif self.distro in ['arch']: From 0c1c6c107ceb859cc0e49ec96d1cdfaf6269cb9f Mon Sep 17 00:00:00 2001 From: Adam Blackburn Date: Tue, 16 Jun 2009 23:08:52 +0800 Subject: [PATCH 2/5] moved wicd-daemon.py back to wicd/ and changed wpath replacement values to use the wpath module --- in/wicd=wicd-daemon.py.in => wicd/wicd-daemon.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename in/wicd=wicd-daemon.py.in => wicd/wicd-daemon.py (99%) diff --git a/in/wicd=wicd-daemon.py.in b/wicd/wicd-daemon.py similarity index 99% rename from in/wicd=wicd-daemon.py.in rename to wicd/wicd-daemon.py index 32abcbe..8d7805b 100644 --- a/in/wicd=wicd-daemon.py.in +++ b/wicd/wicd-daemon.py @@ -1671,13 +1671,13 @@ def main(argv): output = ManagedStdio(logpath) if os.path.exists(logpath): try: - os.chmod(logpath, %LOGPERMS%) - if "%LOGGROUP%": + os.chmod(logpath, wpath.logperms) + if wpath.loggroup: import grp - group = grp.getgrnam("%LOGGROUP%") + group = grp.getgrnam(wpath.loggroup) os.chown(logpath, 0, group[2]) except: - print 'unable to chmod log file to %LOGPERMS%' + print 'unable to chmod log file to %s' % wpath.logperms if redirect_stdout: sys.stdout = output if redirect_stderr: sys.stderr = output From 6b7bfed11ffdbfe8a0c6d06bad94fcc827f7e211 Mon Sep 17 00:00:00 2001 From: Adam Blackburn Date: Tue, 16 Jun 2009 23:22:40 +0800 Subject: [PATCH 3/5] removed wicd-daemon.py from .bzrignore --- .bzrignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.bzrignore b/.bzrignore index 0cfc4e1..29a8142 100644 --- a/.bzrignore +++ b/.bzrignore @@ -22,6 +22,5 @@ scripts/wicd scripts/wicd-client scripts/wicd-curses translations/* -wicd/wicd-daemon.py wicd/wpath.py *tags From 1c761ca232e1710be1776b189c5cb43e6c18d338 Mon Sep 17 00:00:00 2001 From: Adam Blackburn Date: Tue, 16 Jun 2009 23:57:02 +0800 Subject: [PATCH 4/5] added forgotten underscores --- wicd/wicd-daemon.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wicd/wicd-daemon.py b/wicd/wicd-daemon.py index 8d7805b..3488483 100644 --- a/wicd/wicd-daemon.py +++ b/wicd/wicd-daemon.py @@ -1671,13 +1671,13 @@ def main(argv): output = ManagedStdio(logpath) if os.path.exists(logpath): try: - os.chmod(logpath, wpath.logperms) - if wpath.loggroup: + os.chmod(logpath, wpath.log_perms) + if wpath.log_group: import grp - group = grp.getgrnam(wpath.loggroup) + group = grp.getgrnam(wpath.log_group) os.chown(logpath, 0, group[2]) except: - print 'unable to chmod log file to %s' % wpath.logperms + print 'unable to chmod log file to %s' % wpath.log_perms if redirect_stdout: sys.stdout = output if redirect_stderr: sys.stderr = output From 1e97b34205164a320bce7d5783a9df0aa31f786a Mon Sep 17 00:00:00 2001 From: Adam Blackburn Date: Fri, 19 Jun 2009 22:08:32 -0500 Subject: [PATCH 5/5] seperated chmod and chown try/excepts --- wicd/wicd-daemon.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wicd/wicd-daemon.py b/wicd/wicd-daemon.py index 3488483..a04a3d4 100644 --- a/wicd/wicd-daemon.py +++ b/wicd/wicd-daemon.py @@ -1672,12 +1672,16 @@ def main(argv): if os.path.exists(logpath): try: os.chmod(logpath, wpath.log_perms) + except: + print 'unable to chmod log file to %s' % wpath.log_perms + + try: if wpath.log_group: import grp group = grp.getgrnam(wpath.log_group) os.chown(logpath, 0, group[2]) except: - print 'unable to chmod log file to %s' % wpath.log_perms + print 'unable to chown log file to %s' % group[2] if redirect_stdout: sys.stdout = output if redirect_stderr: sys.stderr = output