1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-18 20:10:20 +01:00

Added entry points for autoconnect and suspend.

Moved scripts to data directory.
This commit is contained in:
2020-08-31 21:53:43 +02:00
parent e6afb9232d
commit 780ded6802
7 changed files with 20 additions and 10 deletions

View File

@@ -1,3 +1,3 @@
#!/bin/sh
# Put wifi interface down
%DAEMON%suspend.py
wicd-suspend

View File

@@ -1,4 +1,4 @@
#!/bin/sh
# Bring wifi network interface back up.
%DAEMON%autoconnect.py
wicd-autoconnect.py

View File

@@ -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=$?
}

View File

@@ -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

View File

@@ -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):

View File

@@ -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()

View File

@@ -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()