1.1 --- a/TO_DO.txt Tue May 04 00:14:00 2010 +0200
1.2 +++ b/TO_DO.txt Tue May 04 00:25:24 2010 +0200
1.3 @@ -1,3 +1,3 @@
1.4 -Automatic superuser initialisation and/or avoidance of competing site definitions.
1.5 Site directory detection.
1.6 Enabled/available site listings.
1.7 +HTTP user integration and Apache user/group file editing.
2.1 --- a/moinsetup.py Tue May 04 00:14:00 2010 +0200
2.2 +++ b/moinsetup.py Tue May 04 00:25:24 2010 +0200
2.3 @@ -1,6 +1,7 @@
2.4 #!/usr/bin/env python
2.5
2.6 from os.path import abspath, exists, join, split
2.7 +from getpass import getpass
2.8 import os
2.9 import sys
2.10 import shutil
2.11 @@ -31,13 +32,6 @@
2.12 Alias %(static_url_path)s "%(htdocs_dir)s/"
2.13 """
2.14
2.15 -apache_site_host_restriction = """
2.16 -<Location "%(url_path)s">
2.17 - Deny from all
2.18 - Allow from %(superuser_client_host)s
2.19 -</Location>
2.20 -"""
2.21 -
2.22 # Utility functions.
2.23
2.24 def readfile(filename):
2.25 @@ -160,6 +154,7 @@
2.26 self.install_data()
2.27 self.configure_moin()
2.28 self.edit_moin_scripts()
2.29 + self.add_superuser()
2.30 self.make_site_files()
2.31 self.make_post_install_script()
2.32
2.33 @@ -264,6 +259,30 @@
2.34 writefile(moin_cgi_installed, s)
2.35 os.system("chmod a+rx '%s'" % moin_cgi_installed)
2.36
2.37 + def add_superuser(self):
2.38 +
2.39 + "Add the superuser account."
2.40 +
2.41 + moin_script = join(self.prefix, "bin", "moin")
2.42 +
2.43 + print "Creating superuser", self.superuser, "using..."
2.44 + email = raw_input("E-mail address: ")
2.45 + password = getpass("Password: ")
2.46 +
2.47 + path = os.environ.get("PYTHONPATH", "")
2.48 +
2.49 + if path:
2.50 + os.environ["PYTHONPATH"] = path + ":" + self.conf_dir
2.51 + else:
2.52 + os.environ["PYTHONPATH"] = self.conf_dir
2.53 +
2.54 + os.system(moin_script + " account create --name='%s' --email='%s' --password='%s'" % (self.superuser, email, password))
2.55 +
2.56 + if path:
2.57 + os.environ["PYTHONPATH"] = path
2.58 + else:
2.59 + del os.environ["PYTHONPATH"]
2.60 +
2.61 def make_site_files(self):
2.62
2.63 "Make the Apache site files."
2.64 @@ -282,13 +301,6 @@
2.65
2.66 writefile(site_def, s)
2.67
2.68 - # NOTE: By making the superuser in the installed Wiki, this site file
2.69 - # NOTE: would no longer be required.
2.70 -
2.71 - s += apache_site_host_restriction % self.__dict__
2.72 -
2.73 - writefile(site_def_private, s)
2.74 -
2.75 def make_post_install_script(self):
2.76
2.77 "Write a post-install script with additional actions."
2.78 @@ -296,7 +308,7 @@
2.79 this_user = os.environ["USER"]
2.80 postinst_script = "moinsetup-post.sh"
2.81
2.82 - s = ""
2.83 + s = "#!/bin/sh\n"
2.84
2.85 for d in ("data", "underlay"):
2.86 s += "chown -R %s.%s '%s'\n" % (this_user, self.web_group, join(self.conf_dir, d))
2.87 @@ -306,6 +318,7 @@
2.88 s += "chown -R %s.%s '%s'\n" % (this_user, self.web_group, self.htdocs_dir)
2.89
2.90 writefile(postinst_script, s)
2.91 + os.chmod(postinst_script, 0755)
2.92 note("Run %s as root to set file ownership and permissions." % postinst_script)
2.93
2.94 # Main program.