GIT repositories

Index page of all the GIT repositories that are clonable form this server via HTTPS. Übersichtsseite aller GIT-Repositories, die von diesem Server aus über git clone (HTTPS) erreichbar sind.

Services

A bunch of service scripts to convert, analyse and generate data. Ein paar Services zum Konvertieren, Analysieren und Generieren von Daten.

GNU octave web interface

A web interface for GNU Octave, which allows to run scientific calculations from netbooks, tables or smartphones. The interface provides a web form generator for Octave script parameters with pre-validation, automatic script list generation, as well presenting of output text, figures and files in a output HTML page. Ein Webinterface für GNU-Octave, mit dem wissenschaftliche Berechnungen von Netbooks, Tablets oder Smartphones aus durchgeführt werden können. Die Schnittstelle beinhaltet einen Formulargenerator für Octave-Scriptparameter, mit Einheiten und Einfabevalidierung. Textausgabe, Abbildungen und generierte Dateien werden abgefangen und in einer HTML-Seite dem Nutzer als Ergebnis zur Verfügung gestellt.

Mantis installation script for Debian/Ubuntu

The MantisBT is a PHP/MySQL based issue tracking system , licensed under the GPL and quite popular in the open source community to deal with software bugs. There are different ways to install MantisBT on your Ubuntu 10.04 server (e.g. aptitude ), but if you want a one-shot preconfigured system in your /var/www/ folder, take a look at this small blog article.

Sequence:

What happens then?

Result

Installation script source code

#!/bin/bash
 
#########################################################################################
## Settings
#########################################################################################
 
APTITUDE='/usr/bin/aptitude'
WWW_ROOT="/var/www"
APACHE_USER="www-data"
APACHE_GROUP="www-data"
TEMP_DIR="/tmp/mantis-setup"
GIT="/usr/bin/git"
MANTIS_GITHUB_URL="https://github.com/mantisbt/mantisbt.git"
MANTIS_GIT_PLUGIN_SOURCE_URL="git://git.mantisforge.org/source-integration.git"
MANTIS_GIT_PLUGIN_META_URL="git://git.mantisforge.org/meta.git"
WWW_MANTIS_DIRNAME='mantis'
DB_MYSQL_ROOT_PASS="$2"
DB_NAME="$3"
DB_USER="$4"
DB_PASS="$5"
DB_HOST='localhost'
CRYPTO_SALT="$(cat /dev/urandom | head -c 64 | base64 -w 1000)"
 
pushd . > /dev/null
cd "$(dirname $0)"
SCRIPT_DIR="$(pwd)"
popd > /dev/null
 
#########################################################################################
## Program starts here
#########################################################################################
 
# functions
function echo_error()  { echo -e "\033[0;31m[FAILED] $@\033[0m"; }
function echo_ok()     { echo -e "\033[0;32m[OK] $@\033[0m"; }
function echo_info()   { echo -e "\033[0;33m$@\033[0m"; }
 
function set_php_var() {
    sudo grep -Fq "${1}" "${3}";
    if [ $? -eq 0 ]; then
        sudo sed -i "s,${1}.*,${1} = ${2};," "${3}";
    else
        sudo sed -i "\$a\\${1} = ${2};" "${3}";
    fi;
}
 
function print_usage() {
    echo "Usage:"
    echo ""
    echo " To install:"
    echo "   $SCRIPT_DIR install <mysql root password> <database name> <database user> <database password>"
    echo ""
    echo " To uninstall:"
    echo "   $SCRIPT_DIR uninstall --really"
    echo ""
    exit
}
 
function chmod_chown_wwwdata() {
    echo_info "Changing file modes/owner/group to make them suitable for Apache"
    sudo chown -R $APACHE_USER:$APACHE_GROUP $TEMP_DIR/mantisbt
    sudo find . -type d -exec chmod 550 {} \;
    sudo find . -type f -exec chmod 440 {} \;
}
 
# uninstall process
if [ "$1" = "uninstall" ]; then
    if [ "$2" != "--really" ]; then
        echo_error 'You must say "setup uninstall --really"'
        exit
    fi
    echo_error "TODO: IMPLEMENT UNINSTALLER"
    sudo echo ""
    echo_info "----------------------------------------------------------------------"
    echo_info "UNINSTALL"
    echo_info "----------------------------------------------------------------------"
    echo_info "remove mantis ..."
 
    if [ ! -d $WWW_ROOT ]; then
        echo_error "Web root directory not there ($WWW_ROOT)"
        exit
    elif [ ! -d $WWW_ROOT/$WWW_MANTIS_DIRNAME ]; then
        echo_error "Mantis is not installed in $WWW_ROOT/$WWW_MANTIS_DIRNAME"
        exit
    fi
 
    sudo rm -rf $WWW_ROOT/$WWW_MANTIS_DIRNAME
 
    echo_info "NOTE: DATABASE WILL NOT BE DELETED"
    echo_ok "uninstalled"
    exit
elif [ "$1" = "install" ]; then
    # mark sudo
    sudo echo ""
 
    if [ ! -d $WWW_ROOT ]; then
        echo_error "Web root directory not there ($WWW_ROOT)"
        exit
    elif [ "$4" = "" ]; then
        print_usage
    elif [ -d $WWW_ROOT/$WWW_MANTIS_DIRNAME ]; then
        echo_error "Mantis is already installed in $WWW_ROOT/$WWW_MANTIS_DIRNAME"
        exit
    fi
 
    if [ "$DB_NAME" = "" -o "$DB_USER" = "" -o "$DB_PASS" = "" ]; then
        echo_error "You must set database name, user and password."
    fi
 
    echo_info "Preparing temporary direcory"
    pushd . &> /dev/null
    mkdir $TEMP_DIR
    cd $TEMP_DIR
 
    echo_info "Cloning mantis from github"
    if [ ! -d "$TEMP_DIR/mantisbt" ]; then
        # get mantis
        $GIT clone $MANTIS_GITHUB_URL
        echo_info "(To ensure compatibility when generating the database structure,"
        echo_info " we checkout release-1.2.6, can be updated later ...)"
        cd $TEMP_DIR/mantisbt
        $GIT checkout release-1.2.6
        rm -rf .git
 
        # get source-integration
        cd $TEMP_DIR/mantisbt/plugins
        $GIT clone "$MANTIS_GIT_PLUGIN_SOURCE_URL"
        if [ ! -d "$TEMP_DIR/mantisbt/plugins/source-integration" ]; then
            echo_error "Failed to get source-integration plugin from $MANTIS_GIT_PLUGIN_META_URL"
        else
            mv $TEMP_DIR/mantisbt/plugins/source-integration/Source* $TEMP_DIR/mantisbt/plugins
            rm -rf $TEMP_DIR/mantisbt/plugins/source-integration
        fi
 
        # get meta
        cd $TEMP_DIR/mantisbt/plugins
        $GIT clone "$MANTIS_GIT_PLUGIN_META_URL"
        if [ ! -d "$TEMP_DIR/mantisbt/plugins/meta" ]; then
            echo_error "Failed to get meta plugin from $MANTIS_GIT_PLUGIN_META_URL"
        else
            mv $TEMP_DIR/mantisbt/plugins/meta/Meta $TEMP_DIR/mantisbt/plugins/
            rm -rf $TEMP_DIR/mantisbt/plugins/meta
        fi
 
        # finish git clone stuff
        cd $TEMP_DIR/mantisbt
    fi
 
    if [ ! -d "$TEMP_DIR/mantisbt" ]; then
        echo_error "Mantis was not cloned from git"
    fi
 
    echo_info "Processing $TEMP_DIR/mantisbt/config_inc.php"
    sudo chown -R $USER:$USER $TEMP_DIR/mantisbt
    sudo rm $TEMP_DIR/mantisbt/config_inc.php &> /dev/null
    sudo cp -f $TEMP_DIR/mantisbt/config_inc.php.sample $TEMP_DIR/mantisbt/config_inc.php
    set_php_var '$g_hostname' '"'"$DB_HOST"'"' $TEMP_DIR/mantisbt/config_inc.php
    set_php_var '$g_db_username' '"'"$DB_USER"'"'  $TEMP_DIR/mantisbt/config_inc.php
    set_php_var '$g_db_password' '"'"$DB_PASS"'"'  $TEMP_DIR/mantisbt/config_inc.php
    set_php_var '$g_database_name' '"'"$DB_NAME"'"'  $TEMP_DIR/mantisbt/config_inc.php
    set_php_var '$g_allow_signup' 'false'  $TEMP_DIR/mantisbt/config_inc.php
    set_php_var '$g_allow_anonymous_login' 'false'  $TEMP_DIR/mantisbt/config_inc.php
    set_php_var '$g_crypto_master_salt' '"'"$CRYPTO_SALT"'"'  $TEMP_DIR/mantisbt/config_inc.php
    #sudo cat $TEMP_DIR/mantisbt/config_inc.php
 
    echo_info "Changing file modes/owner/group to make them suitable for Apache"
    sudo chown -R $APACHE_USER:$APACHE_GROUP $TEMP_DIR/mantisbt
    sudo find . -type d -exec chmod 550 {} \;
    sudo find . -type f -exec chmod 440 {} \;
 
    echo_info "Generating database"
    sudo cp "$SCRIPT_DIR/dbcreate.sql" "$TEMP_DIR/dbcreate.sql"
    sudo chmod 666 "$TEMP_DIR/dbcreate.sql"
    sudo sed -i "s/@@@mantisbt_db/$DB_NAME/" "$TEMP_DIR/dbcreate.sql"
    sudo sed -i "s/@@@mantisbt_user/$DB_USER/" "$TEMP_DIR/dbcreate.sql"
    sudo sed -i "s/@@@mantisbt_pass/$DB_PASS/" "$TEMP_DIR/dbcreate.sql"
    sudo cat "$SCRIPT_DIR/copytables.sql" >> "$TEMP_DIR/dbcreate.sql"
    sudo cat "$SCRIPT_DIR/dbcreate-finish.sql" >> "$TEMP_DIR/dbcreate.sql"
 
    echo_info "Running mysql, you must enter the mysql root password now"
    #cat "$TEMP_DIR/dbcreate.sql"
    if [ "$DB_MYSQL_ROOT_PASS" = "" ]; then
        mysql --user="root" -p < "$TEMP_DIR/dbcreate.sql"
    else
        mysql --user="root" --password="$DB_MYSQL_ROOT_PASS" < "$TEMP_DIR/dbcreate.sql"
    fi
    sudo rm "$TEMP_DIR/dbcreate.sql"
 
    # Finish install
    echo_info "Moving to www root"
    sudo mv $TEMP_DIR/mantisbt $WWW_ROOT/$WWW_MANTIS_DIRNAME
    echo_info "Renaming mantis admin path ($WWW_ROOT/$WWW_MANTIS_DIRNAME/admin)"
    sudo mv $WWW_ROOT/$WWW_MANTIS_DIRNAME/admin $WWW_ROOT/$WWW_MANTIS_DIRNAME/.admin
    popd &> /dev/null
    echo_info "Removing temp directory"
    sudo rm -rf $TEMP_DIR &> /dev/null
 
    echo_info "NOTE: You can now login as administrator under /$WWW_MANTIS_DIRNAME/index.php"
    echo_info "      login name: administrator"
    echo_info "      login pass: root"
    echo_info "      AND YOU SHOULD CHANGE THIS PASSWORD IMMEDIATELY"
 
    echo_ok "Installed"
else
    echo 'You mus say "install" or "uninstall"'
    exit
fi

Output

The script output should look similar to this (just in color):

foo@host:~/ubuntu-setup-scripts/mantis$ ./setup install "*******************" mantisbt mantisbt "****************"

Preparing temporary direcory
Cloning mantis from github
Initialized empty Git repository in /tmp/mantis-setup/mantisbt/.git/
remote: Counting objects: 64350, done.
remote: Compressing objects: 100% (11204/11204), done.
remote: Total 64350 (delta 52967), reused 63836 (delta 52508)
Receiving objects: 100% (64350/64350), 22.87 MiB | 1.10 MiB/s, done.
Resolving deltas: 100% (52967/52967), done.
(To ensure compatibility when generating the database structure,
 we checkout release-1.2.6, can be updated later ...)
Note: checking out 'release-1.2.6'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 89738d5... Bump
Initialized empty Git repository in /tmp/mantis-setup/mantisbt/plugins/source-integration/.git/
remote: Counting objects: 2442, done.
remote: Compressing objects: 100% (651/651), done.
remote: Total 2442 (delta 1693), reused 2442 (delta 1693)
Receiving objects: 100% (2442/2442), 369.03 KiB, done.
Resolving deltas: 100% (1693/1693), done.
Initialized empty Git repository in /tmp/mantis-setup/mantisbt/plugins/meta/.git/
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 9 (delta 0), reused 9 (delta 0)
Receiving objects: 100% (9/9), 12.59 KiB, done.
Processing /tmp/mantis-setup/mantisbt/config_inc.php
Changing file modes/owner/group to make them suitable for Apache
Generating database
Running mysql, you must enter the mysql root password now
Moving to www root
Renaming mantis admin path (/var/www/mantis/admin)
Removing temp directory
NOTE: You can now login as administrator under /mantis/index.php
      login name: administrator
      login pass: root
      AND YOU SHOULD CHANGE THIS PASSWORD IMMEDIATELY
[OK] Installed