Skip to content

Commit

Permalink
client: workaround for idiotic ArchLinux renaming of python to python2.
Browse files Browse the repository at this point in the history
First try running under python2, then python if that doesn't exist.
  • Loading branch information
apenwarr committed Feb 7, 2011
1 parent 4fde980 commit a62975e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(self, port, subnets_include, subnets_exclude, dnsport):
self.subnets_include = subnets_include
self.subnets_exclude = subnets_exclude
self.dnsport = dnsport
argvbase = ([sys.argv[0]] +
argvbase = ([sys.argv[1], sys.argv[0], sys.argv[1]] +
['-v'] * (helpers.verbose or 0) +
['--firewall', str(port), str(dnsport)])
if ssyslog._p:
Expand Down
3 changes: 1 addition & 2 deletions main.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
import sys, os, re
import helpers, options, client, server, firewall, hostwatch
import compat.ssubprocess as ssubprocess
Expand Down Expand Up @@ -71,7 +70,7 @@ def parse_ipport(s):
hostwatch (internal use only)
"""
o = options.Options(optspec)
(opt, flags, extra) = o.parse(sys.argv[1:])
(opt, flags, extra) = o.parse(sys.argv[2:])

if opt.daemon:
opt.syslog = 1
Expand Down
1 change: 0 additions & 1 deletion sshuttle

This file was deleted.

7 changes: 7 additions & 0 deletions sshuttle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
DIR=$(dirname "$0")
if python2 -V 2>/dev/null; then
exec python2 "$DIR/main.py" python2 "$@"
else
exec python "$DIR/main.py" python "$@"
fi
2 changes: 1 addition & 1 deletion stresstest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
import sys, os, socket, select, struct, time

listener = socket.socket()
Expand Down

0 comments on commit a62975e

Please sign in to comment.