diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..7790e63 --- /dev/null +++ b/__init__.py @@ -0,0 +1,8 @@ +__author__ = "Nathan Adams" +__copyright__ = "Copyright 2015, srchub" +__credits__ = ["Nathan Adams"] +__license__ = "MIT" +__version__ = "2.0" +__maintainer__ = "Nathan Adams" +__email__ = "adamsna@datanethost.net" +__status__ = "Beta" \ No newline at end of file diff --git a/srchub-install.py b/srchub-install.py new file mode 100644 index 0000000..ce5d64e --- /dev/null +++ b/srchub-install.py @@ -0,0 +1,125 @@ +import locale +from dialog import Dialog +from subprocess import call +import sys + +# This is almost always a good thing to do at the beginning of your programs. +locale.setlocale(locale.LC_ALL, '') + +""" + @name: srchub-install + @description: Used to bootstrap a system with srchub or indefero + @notes: This replaces the Debian package - it seemed like a good idea at the time but didn't really work. + And this will allow support for other distros + This script will never work on Windows and unless there is extreme demand for it - one will probably never + exist. +""" + +INDEFERO_BASE_APACHE = """ +Include /home/www/indefero/scripts/private_indefero.conf +""" + +INDEFERO_HG_APACHE = """ +ScriptAliasMatch ^/hg(.*) /home/www/indefero/scripts/hgweb.cgi$1 + + Options +ExecCGI + AuthName "Restricted" + AuthType Basic + AuthUserFile /home/mercurial/.htpasswd + + Require valid-user + + + + + + Options +ExecCGI + AuthName "Restricted" + AuthType Basic + AuthUserFile /home/mercurial/.htpasswd + + Require valid-user + + +""" + +INDEFERO_SVN_APACHE = """ + + DAV svn + SVNParentPath /home/svn/repositories + AuthzSVNAccessFile /home/svn/dav_svn.authz + Satisfy Any + Require valid-user + AuthType Basic + AuthName "Subversion Repository" + AuthUserFile /home/svn/dav_svn.passwd + +""" +d = Dialog(dialog="dialog", autowidgetsize=True) +distro = "" + +def install_debian_package(package): + d.infobox(package, title="Installing...") + # install package + + +def exit_msg(): + print "Thank you for using the srchub installer\n" + print "Please send feedback to adamsna@datanethost.net" + +def install_cron_jobs(): + return d.yesno("Do you want me to attempt to install the cron jobs?") + +def install_package(package): + if distro == "Debian": + call(["apt-get", "--assume-yes", "-y", "install", package]) + +def install_packages(): + code = d.yesno("Do you want me to attempt to install the needed packages?") + if code == d.OK: + d.gauge_start("Installing...") + packages = ["git", "mercurial", "subversion", "mariadb-server", "mariadb-client", "libapache2-mod-php5", + "php5-curl", "php5-mysql", "php5-cli", "git-daemon-run", "gitweb", "php-pear"] + percent = 0 + i = 0 + for package in packages: + d.gauge_update(percent, "Installing " + package) + install_package(package) + i += 1 + percent = (i / len(packages)) * 100 + + + +d.set_background_title("Srchub Installer") + +d.msgbox("""This will guide you through installing srchub +Any comments should be directed towards +adamsna@datanethost.net""") + +with open('/etc/issue', 'r') as content_file: + issue_file = content_file.read() + +if "Debian" in issue_file or "Ubuntu" in issue_file: + distro = "Debian" +else: + code = d.yesno("""This script was designed for Debian/Ubuntu but it seems you are using a different distro.\n +However - you may still attempt to run it if you know what you are doing.\n\n + +I recommend canceling and emailing the author and telling them the name of your distro which is:\n """ + issue_file) + if code == d.CANCEL: + exit_msg() + sys.exit() + +code, tag = d.menu("Choose carefully:", choices=[ + ("1", "Install srchub"), + ("2", "Install indefero") +]) + +if code == d.OK: + if tag == "1": # Install srchub + pass + else: # Install indefero vanilla + pass + + +exit_msg() \ No newline at end of file