]> arthur.barton.de Git - bup.git/blob - cmd/init-cmd.py
Configure python, use it, and embed during install
[bup.git] / cmd / init-cmd.py
1 #!/bin/sh
2 """": # -*-python-*-
3 bup_python="$(dirname "$0")/bup-python" || exit $?
4 exec "$bup_python" "$0" ${1+"$@"}
5 """
6 # end of bup preamble
7 import sys
8
9 from bup import git, options, client
10 from bup.helpers import *
11
12
13 optspec = """
14 [BUP_DIR=...] bup init [-r host:path]
15 --
16 r,remote=  remote repository path
17 """
18 o = options.Options(optspec)
19 (opt, flags, extra) = o.parse(sys.argv[1:])
20
21 if extra:
22     o.fatal("no arguments expected")
23
24
25 try:
26     git.init_repo()  # local repo
27 except git.GitError, e:
28     log("bup: error: could not init repository: %s" % e)
29     sys.exit(1)
30
31 if opt.remote:
32     git.check_repo_or_die()
33     cli = client.Client(opt.remote, create=True)
34     cli.close()