From a62975e0cebc41e4c4bb83571a83ebd0bf699763 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Mon, 7 Feb 2011 00:05:19 -0800 Subject: [PATCH] client: workaround for idiotic ArchLinux renaming of python to python2. First try running under python2, then python if that doesn't exist. --- client.py | 2 +- main.py | 3 +-- sshuttle | 8 +++++++- stresstest.py | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) mode change 100755 => 100644 main.py mode change 120000 => 100755 sshuttle diff --git a/client.py b/client.py index fa93c26..0ff5f2b 100644 --- a/client.py +++ b/client.py @@ -102,7 +102,7 @@ class FirewallClient: 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: diff --git a/main.py b/main.py old mode 100755 new mode 100644 index 3fe1e53..ef00361 --- a/main.py +++ b/main.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python import sys, os, re import helpers, options, client, server, firewall, hostwatch import compat.ssubprocess as ssubprocess @@ -71,7 +70,7 @@ firewall (internal use only) 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 diff --git a/sshuttle b/sshuttle deleted file mode 120000 index 11a5d8e..0000000 --- a/sshuttle +++ /dev/null @@ -1 +0,0 @@ -main.py \ No newline at end of file diff --git a/sshuttle b/sshuttle new file mode 100755 index 0000000..d832198 --- /dev/null +++ b/sshuttle @@ -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 diff --git a/stresstest.py b/stresstest.py index f42df09..dba95ea 100755 --- a/stresstest.py +++ b/stresstest.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import sys, os, socket, select, struct, time listener = socket.socket()