summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsource4/setup/provision29
1 files changed, 27 insertions, 2 deletions
diff --git a/source4/setup/provision b/source4/setup/provision
index 7bd61fc1d8..882a92ad48 100755
--- a/source4/setup/provision
+++ b/source4/setup/provision
@@ -24,7 +24,8 @@
import getopt
import optparse
-import os, sys
+import os
+import sys
# Find right directory when running from source tree
sys.path.insert(0, "bin/python")
@@ -46,6 +47,7 @@ parser.add_option_group(sambaopts)
parser.add_option_group(options.VersionOptions(parser))
credopts = options.CredentialsOptions(parser)
parser.add_option_group(credopts)
+parser.add_option("--interactive", help="Ask for names")
parser.add_option("--setupdir", type="string", metavar="DIR",
help="directory with setup files")
parser.add_option("--realm", type="string", metavar="REALM", help="set realm")
@@ -108,7 +110,10 @@ def message(text):
if not opts.quiet:
print text
-if opts.realm is None or opts.domain is None:
+if len(sys.argv) == 1:
+ opts.interactive = True
+
+if not opts.interactive and (opts.realm is None or opts.domain is None):
if opts.realm is None:
print >>sys.stderr, "No realm set"
if opts.domain is None:
@@ -116,6 +121,26 @@ if opts.realm is None or opts.domain is None:
parser.print_usage()
sys.exit(1)
+if opts.interactive:
+ from getpass import getpass
+ import readline
+ import socket
+ def ask(prompt, default=None):
+ if default is not None:
+ print "%s [%s]: " % (prompt,default),
+ else:
+ print "%s: " % (prompt,),
+ return sys.stdin.readline().rstrip("\n") or default
+ opts.realm = ask("Realm", socket.gethostname().split(".", 1)[1])
+ opts.domain = ask("Domain", opts.realm)
+ opts.server_role = ask("Server Role (dc, member, standalone)", "dc")
+ for i in range(3):
+ opts.adminpass = getpass("Administrator password: ")
+ if not opts.adminpass:
+ print >>sys.stderr, "Invalid administrator password."
+ else:
+ break
+
lp = sambaopts.get_loadparm()
smbconf = lp.configfile()