1#!/bin/sh 2"""": # -*-python-*- 3# https://sourceware.org/bugzilla/show_bug.cgi?id=26034 4export "BUP_ARGV_0"="$0" 5arg_i=1 6for arg in "$@"; do 7 export "BUP_ARGV_${arg_i}"="$arg" 8 shift 9 arg_i=$((arg_i + 1)) 10done 11# Here to end of preamble replaced during install 12bup_python="$(dirname "$0")/../../config/bin/python" || exit $? 13exec "$bup_python" "$0" 14""" 15# end of bup preamble 16 17from __future__ import absolute_import 18import os.path, sys 19 20sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/..'] 21 22from bup import compat, git, options, client 23from bup.helpers import log, saved_errors 24from bup.compat import argv_bytes 25 26 27optspec = """ 28[BUP_DIR=...] bup init [-r host:path] 29-- 30r,remote= remote repository path 31""" 32o = options.Options(optspec) 33opt, flags, extra = o.parse(compat.argv[1:]) 34 35if extra: 36 o.fatal("no arguments expected") 37 38 39try: 40 git.init_repo() # local repo 41except git.GitError as e: 42 log("bup: error: could not init repository: %s" % e) 43 sys.exit(1) 44 45if opt.remote: 46 git.check_repo_or_die() 47 cli = client.Client(argv_bytes(opt.remote), create=True) 48 cli.close() 49