summaryrefslogtreecommitdiffstats
path: root/ipa-server/ipa-install
diff options
context:
space:
mode:
authormccann@jhu.edu <mccann@jhu.edu>2007-10-02 16:56:51 -0400
committermccann@jhu.edu <mccann@jhu.edu>2007-10-02 16:56:51 -0400
commit3ef4a374f723b61f8497c4a4d8921cc18d7f4070 (patch)
treee03fcbaa5de62292b1f19842a46a029e083a10c0 /ipa-server/ipa-install
parente0b225b1b6dc7330c5bbb0007f58e231b726f84d (diff)
downloadfreeipa-3ef4a374f723b61f8497c4a4d8921cc18d7f4070.tar.gz
freeipa-3ef4a374f723b61f8497c4a4d8921cc18d7f4070.tar.xz
freeipa-3ef4a374f723b61f8497c4a4d8921cc18d7f4070.zip
Patch to fix the installer crashing if selinux is disabled. Also changes
the exception to contain the complete command. Add a check to make sure installer is running as root. Add signal handler to detect a user-cancelled installation. Detect existing DS instances and prompt to remove them.
Diffstat (limited to 'ipa-server/ipa-install')
-rw-r--r--ipa-server/ipa-install/ipa-server-install58
1 files changed, 57 insertions, 1 deletions
diff --git a/ipa-server/ipa-install/ipa-server-install b/ipa-server/ipa-install/ipa-server-install
index c5d6d4871..fd2071ad8 100644
--- a/ipa-server/ipa-install/ipa-server-install
+++ b/ipa-server/ipa-install/ipa-server-install
@@ -29,10 +29,14 @@ VERSION = "%prog .1"
import sys
sys.path.append("/usr/share/ipa")
+import os
import socket
import logging
import pwd
import getpass
+import signal
+import shutil
+import glob
from optparse import OptionParser
import ipaserver.dsinstance
import ipaserver.krbinstance
@@ -90,7 +94,55 @@ def logging_setup(options):
console.setFormatter(formatter)
logging.getLogger('').addHandler(console)
+def erase_ds_instance_data(serverid):
+ try:
+ shutil.rmtree("/etc/dirsrv/slapd-%s" % serverid)
+ except:
+ pass
+ try:
+ shutil.rmtree("/var/lib/dirsrv/slapd-%s" % serverid)
+ except:
+ pass
+ try:
+ shutil.rmtree("/var/lock/dirsrv/slapd-%s" % serverid)
+ except:
+ pass
+
+def signal_handler(signum, frame):
+ global ds
+ print "\nCleaning up..."
+ if ds:
+ print "Removing configuration for %s instance" % ds.serverid
+ ds.stop()
+ if ds.serverid:
+ erase_ds_instance_data (ds.serverid)
+ sys.exit(1)
+
+def check_existing_installation():
+ dirs = glob.glob("/etc/dirsrv/slapd-*")
+ if not dirs:
+ return
+ yesno = raw_input("An existing Directory Server has been detected. Do you wish to remove it and create a new one? [y/N]: ")
+ if yesno.lower() != "y":
+ sys.exit(1)
+ for d in dirs:
+ serverid = os.path.basename(d).split("slapd-", 1)[1]
+ if ds.serverid:
+ erase_ds_instance_data (serverid)
+
def main():
+ global ds
+ ds = None
+
+ if os.getegid() != 0:
+ print "Must be root to setup server"
+ return
+
+ signal.signal(signal.SIGTERM, signal_handler)
+ signal.signal(signal.SIGINT, signal_handler)
+
+ check_existing_installation()
+
options = parse_options()
logging_setup(options)
@@ -379,7 +431,11 @@ def main():
krb.restart()
# Allow apache to connect to the turbogears web gui
- run(["/usr/sbin/setsebool", "-P", "httpd_can_network_connect", "true"])
+ try:
+ run(["/usr/sbin/setsebool", "-P", "httpd_can_network_connect", "true"])
+ except:
+ # SELinux may be disabled
+ pass
# Start the web gui
run(["/sbin/service", "ipa-webgui", "start"])