diff --git a/in/other=50-wicd-suspend.sh.in b/data/acpi/50-wicd-suspend.sh similarity index 65% rename from in/other=50-wicd-suspend.sh.in rename to data/acpi/50-wicd-suspend.sh index e3fc438..d0fe5fc 100755 --- a/in/other=50-wicd-suspend.sh.in +++ b/data/acpi/50-wicd-suspend.sh @@ -1,3 +1,3 @@ #!/bin/sh # Put wifi interface down -%DAEMON%suspend.py +wicd-suspend diff --git a/in/other=80-wicd-connect.sh.in b/data/acpi/80-wicd-connect.sh similarity index 68% rename from in/other=80-wicd-connect.sh.in rename to data/acpi/80-wicd-connect.sh index 5726e78..a6ed7ee 100755 --- a/in/other=80-wicd-connect.sh.in +++ b/data/acpi/80-wicd-connect.sh @@ -1,4 +1,4 @@ #!/bin/sh # Bring wifi network interface back up. -%DAEMON%autoconnect.py +wicd-autoconnect.py diff --git a/in/other=55wicd.in b/data/pmutils/55wicd similarity index 93% rename from in/other=55wicd.in rename to data/pmutils/55wicd index fbed9ef..bccaeee 100755 --- a/in/other=55wicd.in +++ b/data/pmutils/55wicd @@ -16,14 +16,14 @@ RETVAL=0 # Set this to 0 initially wicd_suspend() { # Put wifi interface down - %DAEMON%suspend.py 1>/dev/null 2>/dev/null + wicd-suspend 1>/dev/null 2>/dev/null RETVAL=$? } wicd_resume() { # Bring wifi interface back up - %DAEMON%autoconnect.py 1>/dev/null 2>/dev/null + wicd-autoconnect 1>/dev/null 2>/dev/null RETVAL=$? } diff --git a/setup.cfg b/setup.cfg index 172c8ae..e91570d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -44,6 +44,8 @@ console_scripts = wicd=wicd.wicd_daemon:main wicd-cli=wicd.wicd_cli:main wicd-curses=wicd.curses.wicd_curses:main + wicd-autoconnect=wicd.autoconnect:main + wicd-suspend=wicd.suspend:main [install] record = install.log diff --git a/setup.py b/setup.py index 1f4b648..92add14 100755 --- a/setup.py +++ b/setup.py @@ -400,10 +400,10 @@ class install(_install.install): # TODO(gryf): sort out paths for pmutils/acpi if not wpath.no_install_acpi: - data.append((wpath.resume, ['other/80-wicd-connect.sh'])) - data.append((wpath.suspend, ['other/50-wicd-suspend.sh'])) + data.append((wpath.resume, ['data/acpi/80-wicd-connect.sh'])) + data.append((wpath.suspend, ['data/acpi/50-wicd-suspend.sh'])) if not wpath.no_install_pmutils: - data.append((wpath.pmutils, ['other/55wicd'])) + data.append((wpath.pmutils, ['data/pmutils/55wicd'])) log.info('Using pid path %s', os.path.basename(wpath.pidfile)) @@ -416,7 +416,7 @@ class install(_install.install): 'LC_MESSAGES', 'wicd.mo')])) for dir_ in (os.listdir('data')): - if dir_ == 'init': + if dir_ in ('init', 'acpi', 'pmutils'): continue path = os.path.join('data', dir_) for fname in os.listdir(path): diff --git a/wicd/autoconnect.py b/wicd/autoconnect.py index 22cc52a..4b8e5f8 100644 --- a/wicd/autoconnect.py +++ b/wicd/autoconnect.py @@ -51,7 +51,7 @@ def error_handler(*args): sys.exit(3) -if __name__ == '__main__': +def main(): try: time.sleep(2) daemon.SetSuspend(False) @@ -62,3 +62,7 @@ if __name__ == '__main__': print("Exception caught: %s" % str(e), file=sys.stderr) print('Error autoconnecting.', file=sys.stderr) sys.exit(2) + + +if __name__ == '__main__': + main() diff --git a/wicd/suspend.py b/wicd/suspend.py index b27c173..78375f7 100644 --- a/wicd/suspend.py +++ b/wicd/suspend.py @@ -38,7 +38,7 @@ except Exception as e: sys.exit(1) -if __name__ == '__main__': +def main(): try: daemon.Disconnect() daemon.SetForcedDisconnect(False) @@ -47,3 +47,7 @@ if __name__ == '__main__': print("Exception caught: %s" % str(e), file=sys.stderr) print('Error setting suspend.', file=sys.stderr) sys.exit(2) + + +if __name__ == '__main__': + main()