Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

server: workaround for idiotic ArchLinux renaming of python to python2.

First try running under python2, then python if that doesn't exist.
  • Loading branch information...
commit 1ca8aa5b891d01181a5d6a814631f6cf2cd08603 1 parent a62975e
apenwarr apenwarr authored

Showing 2 changed files with 10 additions and 3 deletions. Show diff stats Hide diff stats

  1. +1 1  main.py
  2. +9 2 ssh.py
2  main.py
@@ -54,7 +54,7 @@ def parse_ipport(s):
54 54 H,auto-hosts scan for remote hostnames and update local /etc/hosts
55 55 N,auto-nets automatically determine subnets to route
56 56 dns capture local DNS requests and forward to the remote DNS server
57   -python= path to python interpreter on the remote server [python]
  57 +python= path to python interpreter on the remote server
58 58 r,remote= ssh hostname (and optional username) of remote sshuttle server
59 59 x,exclude= exclude this subnet (can be used more than once)
60 60 v,verbose increase debug message verbosity
11 ssh.py
@@ -73,16 +73,23 @@ def connect(ssh_cmd, rhostport, python, stderr, options):
73 73
74 74
75 75 if not rhost:
76   - argv = [python, '-c', pyscript]
  76 + # ignore the --python argument when running locally; we already know
  77 + # which python version works.
  78 + argv = [sys.argv[1], '-c', pyscript]
77 79 else:
78 80 if ssh_cmd:
79 81 sshl = ssh_cmd.split(' ')
80 82 else:
81 83 sshl = ['ssh']
  84 + if python:
  85 + pycmd = "'%s' -c '%s'" % (python, pyscript)
  86 + else:
  87 + pycmd = ("P=python2; $P -V 2>/dev/null || P=python; "
  88 + "\"$P\" -c '%s'") % pyscript
82 89 argv = (sshl +
83 90 portl +
84 91 ipv6flag +
85   - [rhost, '--', "'%s' -c '%s'" % (python, pyscript)])
  92 + [rhost, '--', pycmd])
86 93 (s1,s2) = socket.socketpair()
87 94 def setup():
88 95 # runs in the child process

0 comments on commit 1ca8aa5

Please sign in to comment.
Something went wrong with that request. Please try again.