Rename mir-prepare, mir-setup, mir-choose-java to mir-*.lenny.
[mir.git] / scripts / mir-setup / mir-prepare
diff --git a/scripts/mir-setup/mir-prepare b/scripts/mir-setup/mir-prepare
deleted file mode 100755 (executable)
index ace2b82..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/bin/sh
-# ianb@erislabs.net 20081122
-# checkpoint code taken from zak's mir-setup
-# $Id: mir-prepare,v 1.1.2.2 2009/01/18 04:43:02 ianb Exp $
-
-set -e
-
-CONFDIR="/etc/mir-setup"
-PROG="`basename $0`"
-
-PACKAGES="openssh-server pwgen apache2 ant tomcat5.5 tomcat5.5-admin imagemagick postgresql libjmagick6-java libapache2-mod-jk procmail cvs rsync sudo wget"
-
-CUR_CHECKPOINT=0
-checkpoint()
-{
-  CUR_CHECKPOINT=$(($CUR_CHECKPOINT + 1))
-  if [ -n "$START_CHECKPOINT" ]; then
-    if [ "$CUR_CHECKPOINT" -lt "$START_CHECKPOINT" ]; then
-      echo "Skipping checkpoint $CUR_CHECKPOINT: $@"
-      unset RUNNING
-    else
-      echo "Running from checkpoint $CUR_CHECKPOINT: $@"
-      RUNNING=1
-    fi
-  else
-    echo "Checkpoint $CUR_CHECKPOINT: $@"
-    RUNNING=1
-  fi
-}
-
-die()
-{
-  echo >&2 "$@";
-  exit 1;
-}
-
-optdie()
-{
-  echo >&2 "$@";
-  echo >&2 "Try $PROG --help";
-  exit 1;
-}
-
-usage() {
-    echo >&2 "Usage: $PROG options"
-    echo >&2 "  Prepares system for a mir install"
-    echo >&2 "  Run before mir-setup"
-    echo >&2 "    -d|--debug                Debugging output, including 'set -x' shell trace"
-    echo >&2 "    -p|--checkpoint <start>   Run from specified checkpoint after failed run"
-    echo >&2 "    -j|--java sun|gcj         Select Java implementation. Default: sun"
-}
-
-# default
-JAVA=sun
-while [ $# != 0 ]; do
-    case "$1" in
-       -d|--debug)  set -x; DEBUG=1 ;;
-       -p|--checkpoint) shift; START_CHECKPOINT="$1" ;;
-       -j|--java) shift; JAVA="$1" ;;
-       -h|-?|--help) usage; exit 0 ;;
-        -*) optdie "$PROG: unknown option $1" ;;
-       *) optdie "$PROG: unexpected argument '$1'" ;;
-    esac
-    shift
-done
-
-checkpoint "Installing mir-setup"
-if [ -n "$RUNNING" ]
-then
-    mkdir -p /etc/mir-setup /usr/local/share/mir-setup
-    cp mir-setup mir-choose-java /usr/local/sbin
-    cp munge_config_file.pl  /usr/local/share/mir-setup
-    CONFFILES="config config-examplesite config.properties-default env robots.txt site-httpd.conf site-ssl-dedicated-httpd.conf site-ssl-httpd-fragment.conf tomcat-manager.conf"
-    (cd conf && cp $CONFFILES /etc/mir-setup)
-fi
-
-checkpoint "Installing packages"
-if [ -n "$RUNNING" ]
-then
-    apt-get install $PACKAGES
-    echo "You probably want to do 'apt-get clean'"
-fi
-
-checkpoint "Selecting $JAVA java with mir-choose-java"
-if [ -n "$RUNNING" ]
-then
-    mir-choose-java --subprocess $JAVA
-fi
-
-checkpoint "Enabling apache modules"
-if [ -n "$RUNNING" ]
-then
-    a2enmod headers ssl include deflate jk rewrite
-fi
-
-checkpoint "Anonymise apache error log"
-if [ -n "$RUNNING" ]
-then
-    if [ ! -f /etc/apache2/conf.d/mir-anon-error-log ]
-    then
-       echo 'ErrorLog "| /usr/local/bin/strip-ips-from-apache-error-log /var/log/apache2/error.log"' > /etc/apache2/conf.d/mir-anon-error-log
-    fi
-    cp strip-ips-from-apache-error-log /usr/local/bin
-fi
-
-checkpoint "Configure 'anon' log format"
-if [ -n "$RUNNING" ]
-then
-    if [ ! -f /etc/apache2/conf.d/mir-anon-access-log ]
-    then
-       echo 'LogFormat "noip %l %u %t \"%r\" %>s %b" anon' > /etc/apache2/conf.d/mir-anon-access-log
-    fi
-fi
-
-checkpoint "Creating directory for mir sites in apache"
-if [ -n "$RUNNING" ]
-then
-    if [ ! -d /etc/apache2/mir-sites ]
-    then
-       mkdir /etc/apache2/mir-sites
-    fi
-fi
-
-checkpoint "Enabling mir sites in apache"
-if [ -n "$RUNNING" ]
-then
-    if [ ! -f /etc/apache2/sites-available/mir-sites ]
-    then
-       echo "Include /etc/apache2/mir-sites/*.conf" > /etc/apache2/sites-available/mir-sites
-       a2ensite mir-sites
-    fi
-fi
-
-checkpoint "Configuring apache jakarta workers"
-if [ -n "$RUNNING" ]
-then
-    if [ ! -f /etc/apache2/conf.d/mir-jk ]
-    then
-       echo "JkWorkersFile  /etc/libapache2-mod-jk/workers.properties" > /etc/apache2/conf.d/mir-jk
-    fi
-fi
-
-checkpoint "Disabling tomcat security (yes, this is bad)"
-if [ -n "$RUNNING" ]
-then
-    if ! grep -q "^TOMCAT5_SECURITY=no" /etc/default/tomcat5.5
-    then
-       echo "TOMCAT5_SECURITY=no" >> /etc/default/tomcat5.5
-    fi
-fi
-
-checkpoint "Configuring password for tomcat manager"
-if [ -n "$RUNNING" ]
-then
-    if ! grep -q 'user username="mir-setup"' /etc/tomcat5.5/tomcat-users.xml
-    then
-       PASSWORD=$(pwgen -n 10 1)
-       ROLE='  <role rolename="manager"\/>'
-       USERNAME='  <user username="mir-setup" password="'"$PASSWORD"'" roles="manager"\/>'
-       perl -pi.bak -e 's/(mir-setup:)[^@]+/$1'"$PASSWORD"'/;' /etc/mir-setup/tomcat-manager.conf
-       perl -pi.bak -e 's/(<tomcat-users>)/$1\n'"$ROLE"'\n'"$USERNAME"'\n/;' /etc/tomcat5.5/tomcat-users.xml
-    fi
-fi
-
-checkpoint "Creating directory for SSL certs"
-if [ -n "$RUNNING" ]
-then
-    if [ ! -d /etc/apache2/ssl ]
-    then
-       mkdir /etc/apache2/ssl
-    fi
-fi
-
-checkpoint "Restarting apache and tomcat"
-if [ -n "$RUNNING" ]
-then
-    invoke-rc.d tomcat5.5 force-reload
-    invoke-rc.d apache2 force-reload
-fi
-
-checkpoint "All done!"