+if __name__ == "__main__":
+ # allow overwriting some values on the command-line
+ parser = argparse.ArgumentParser(description='Update a domain managed by a dyn-nsupdate server')
+ parser.add_argument("-p", "--password",
+ dest="password", default=password,
+ help="The password used to update the domains")
+ parser.add_argument("-v", "--verbose",
+ action="store_true", dest="verbose",
+ help="Be more verbose")
+ parser.add_argument("domains", metavar='DOMAIN', nargs='*', default=domains,
+ help="The domains to update")
+ args = parser.parse_args()
+
+ # get our own IPv4
+ if haveIPv4:
+ myIPv4 = getMyIP(serverIPv4)
+ if args.verbose:
+ print("My IPv4 is",myIPv4)
+ else:
+ myIPv4 = None
+ # and IPv6
+ if haveIPv6:
+ myIPv6 = getMyIP(serverIPv6)
+ if args.verbose:
+ print("My IPv6 is",myIPv6)
+ else:
+ myIPv6 = None
+
+ # update all the domains
+ exitcode = 0
+ for domain in args.domains:
+ if not update_domain(server, domain, myIPv4, myIPv6, args.password, verbose=args.verbose):
+ exitcode = 1
+ sys.exit(exitcode)