diff options
author | Mark McLoughlin <markmc@redhat.com> | 2008-01-11 11:57:36 +0000 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2008-01-11 11:57:36 +0000 |
commit | 4a162f6fc8d53d959dd23e1138059dd239ff5124 (patch) | |
tree | 650d2c3394b728aa694e6da9ea8ded29427ab99c /ipa-server/ipa-install/ipa-server-install | |
parent | c7f3c746ccfd74480064dbe73fbc754548c30927 (diff) | |
download | freeipa-4a162f6fc8d53d959dd23e1138059dd239ff5124.tar.gz freeipa-4a162f6fc8d53d959dd23e1138059dd239ff5124.tar.xz freeipa-4a162f6fc8d53d959dd23e1138059dd239ff5124.zip |
Add ipa-server-install --uninstall
Add a --uninstall option to ipa-server-install which tries to
restore the system to the way it was before ipa-server-install
was run using the state backed up through sysrestore.py.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Diffstat (limited to 'ipa-server/ipa-install/ipa-server-install')
-rw-r--r-- | ipa-server/ipa-install/ipa-server-install | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/ipa-server/ipa-install/ipa-server-install b/ipa-server/ipa-install/ipa-server-install index bc4d8e27a..7a8ebe259 100644 --- a/ipa-server/ipa-install/ipa-server-install +++ b/ipa-server/ipa-install/ipa-server-install @@ -74,15 +74,21 @@ def parse_options(): default=False, help="configure bind with our zone file") parser.add_option("-U", "--unattended", dest="unattended", action="store_true", default=False, help="unattended installation never prompts the user") + parser.add_option("", "--uninstall", dest="uninstall", action="store_true", + default=False, help="uninstall an existing installation") options, args = parser.parse_args() - if options.unattended and (not options.ds_user or - not options.realm_name or - not options.dm_password or - not options.admin_password or - not options.master_password): - parser.error("error: In unattended mode you need to provide at least -u, -r, -p and -P options") + if options.uninstall: + if (options.ds_user or options.realm_name or + options.dm_password or options.admin_password or + options.master_password): + parser.error("error: In uninstall mode, -u, r, -p and -P options are not allowed") + elif options.unattended: + if (not options.ds_user or not options.realm_name or + not options.dm_password or not options.admin_password or + not options.master_password): + parser.error("error: In unattended mode you need to provide at least -u, -r, -p and -P options") return options @@ -241,6 +247,17 @@ def read_admin_password(): admin_password = read_password("IPA admin") return admin_password +def uninstall(): + ipaserver.ntpinstance.NTPInstance().uninstall() + ipaserver.bindinstance.BindInstance().uninstall() + ipaserver.webguiinstance.WebGuiInstance().uninstall() + ipaserver.httpinstance.HTTPInstance().uninstall() + ipaserver.krbinstance.KrbInstance().uninstall() + ipaserver.dsinstance.DsInstance().uninstall() + sysrestore.restore_file("/etc/hosts") + sysrestore.restore_file("/etc/ipa/ipa.conf") + return 0 + def main(): global ds ds = None @@ -256,6 +273,9 @@ def main(): standard_logging_setup("ipaserver-install.log", options.debug) + if options.uninstall: + return uninstall() + print "==============================================================================" print "This program will setup the FreeIPA Server." print "" |