]> arthur.barton.de Git - bup.git/blobdiff - lib/cmd/daemon-cmd.py
README: reflect report that WSL works fine
[bup.git] / lib / cmd / daemon-cmd.py
index ba4b86a50f8917bf697e2a45864cfecb8ddb97ba..ffe79ddade9ea70801fe97a918083e15e7aa871e 100755 (executable)
@@ -1,13 +1,25 @@
 #!/bin/sh
 """": # -*-python-*-
-bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
+# https://sourceware.org/bugzilla/show_bug.cgi?id=26034
+export "BUP_ARGV_0"="$0"
+arg_i=1
+for arg in "$@"; do
+    export "BUP_ARGV_${arg_i}"="$arg"
+    shift
+    arg_i=$((arg_i + 1))
+done
+# Here to end of preamble replaced during install
+bup_python="$(dirname "$0")/../../config/bin/python" || exit $?
+exec "$bup_python" "$0"
 """
 # end of bup preamble
 
 from __future__ import absolute_import
-import sys, getopt, socket, subprocess, fcntl
-from bup import options, path
+import os, sys, getopt, socket, subprocess, fcntl
+
+sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/..']
+
+from bup import compat, options, path
 from bup.helpers import *
 
 optspec = """
@@ -17,7 +29,7 @@ l,listen  ip address to listen on, defaults to *
 p,port    port to listen on, defaults to 1982
 """
 o = options.Options(optspec, optfunc=getopt.getopt)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
 
 host = opt.listen
 port = opt.port and int(opt.port) or 1982