<commit_before>#!/bin/sh
# Copyright (c) 2009 The Open Source Geospatial Foundation.
# Licensed under the GNU LGPL.
# 
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 2.1 of the License,
# or any later version.  This program is distributed in the hope that
# it will be useful, but WITHOUT ANY WARRANTY, without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details, either
# in the "LICENSE.LGPL.txt" file distributed with this software or at
# web page "http://www.fsf.org/licenses/lgpl.html".

# About:
# =====
# This script will install ushahidi

# Running:
# =======
# sudo ./install_ushahidi.sh

# Requires: Apache2, PHP5 mysql-server
#
# more install instructions can be found here /usr/share/ushahidi/readme.html
#
# Uninstall:
# ============
# sudo rm -rf /var/www/ushahidi/

echo "==============================================================="
echo "install_ushahidi.sh"
echo "==============================================================="

# live disc's username is "user"
if [ -z "$USER_NAME" ] ; then
   USER_NAME="user"
fi
USER_HOME="/home/$USER_NAME"
TMP_DIR="/tmp/build_ushahidi"
mkdir -p "$TMP_DIR"

# Install ushahidi dependencies.
echo "Installing ushahidi"

apt-get --assume-yes install php5 php5-mcrypt php5-curl apache2 \
   mysql-server libapache2-mod-php5 php5-mysql 

if [ ! -x "`which wget`" ] ; then
    echo "ERROR: wget is required, please install it and try again"
    exit 1
fi

cd "$TMP_DIR"

#the archive changed from .tgz to .zip updating accordingly 
if [ ! -e "ushahidi.zip" ] ; then 
   wget -O ushahidi.zip --progress=dot:mega \
      "http://download.ushahidi.com/track_download.php?download=ushahidi"
else
    echo "... Ushahidi already downloaded"
fi

# uncompress ushahidi
unzip -q "ushahidi.zip"
mkdir /usr/local/share/ushahidi

#now rename Ushahidi_Web to ushahidi

mv Ushahidi_Web ushahidi

#now copy the ushahidi folder to a different location
cp -R ushahidi/ /usr/local/share/
ln -s /usr/local/share/ushahidi /var/www/ushahidi
chown -R www-data:www-data /usr/local/share/ushahidi

#check if mysql is running and do appropriate action
if [ `ps aux | grep -c 'mysql'` -eq 0 ] ; then
    echo "Starting mysql.."
    service mysql start
else
    echo "Restarting mysql.."
    service mysql restart
fi

## (Note: on installing mysql-server you should have been prompted to
##  create a new root password. Repeat that here)
MYSQL_ADMIN_NM="user"
MYSQL_ADMIN_PW="<PASSWORD>"
echo "
CREATE DATABASE ushahidi;
GRANT ALL PRIVILEGES ON ushahidi.* TO 'user'@'localhost' IDENTIFIED BY 'user';
" | mysql -u"$MYSQL_ADMIN_NM" -p"$MYSQL_ADMIN_PW"


# tweak apache to allow Clean URLs<commit_msg>Fix issue #969 relating to a missing folder<commit_after>#!/bin/sh
# Copyright (c) 2009 The Open Source Geospatial Foundation.
# Licensed under the GNU LGPL.
# 
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 2.1 of the License,
# or any later version.  This program is distributed in the hope that
# it will be useful, but WITHOUT ANY WARRANTY, without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details, either
# in the "LICENSE.LGPL.txt" file distributed with this software or at
# web page "http://www.fsf.org/licenses/lgpl.html".

# About:
# =====
# This script will install ushahidi

# Running:
# =======
# sudo ./install_ushahidi.sh

# Requires: Apache2, PHP5 mysql-server
#
# more install instructions can be found here /usr/share/ushahidi/readme.html
#
# Uninstall:
# ============
# sudo rm -rf /var/www/ushahidi/

echo "==============================================================="
echo "install_ushahidi.sh"
echo "==============================================================="

# live disc's username is "user"
if [ -z "$USER_NAME" ] ; then
   USER_NAME="user"
fi
USER_HOME="/home/$USER_NAME"
TMP_DIR="/tmp/build_ushahidi"
mkdir -p "$TMP_DIR"

# Install ushahidi dependencies.
echo "Installing ushahidi"

apt-get --assume-yes install php5 php5-mcrypt php5-curl apache2 \
   mysql-server libapache2-mod-php5 php5-mysql 

if [ ! -x "`which wget`" ] ; then
    echo "ERROR: wget is required, please install it and try again"
    exit 1
fi

cd "$TMP_DIR"

# the archive changed from .tgz to .zip updating accordingly 
if [ ! -e "ushahidi.zip" ] ; then 
   wget -O ushahidi.zip --progress=dot:mega \
      "http://download.ushahidi.com/track_download.php?download=ushahidi"
else
    echo "... Ushahidi already downloaded"
fi

# uncompress ushahidi
unzip -q "ushahidi.zip"
mkdir /usr/local/share/ushahidi

# delete the zip file to leave only the extracted folder
rm ushahidi.zip

# now rename the extracted folder to ushahidi
mv * ushahidi

#now copy the ushahidi folder to a different location
cp -R ushahidi/ /usr/local/share/
ln -s /usr/local/share/ushahidi /var/www/ushahidi
chown -R www-data:www-data /usr/local/share/ushahidi

#check if mysql is running and do appropriate action
if [ `ps aux | grep -c 'mysql'` -eq 0 ] ; then
    echo "Starting mysql.."
    service mysql start
else
    echo "Restarting mysql.."
    service mysql restart
fi

## (Note: on installing mysql-server you should have been prompted to
##  create a new root password. Repeat that here)
MYSQL_ADMIN_NM="user"
MYSQL_ADMIN_PW="<PASSWORD>"
echo "
CREATE DATABASE ushahidi;
GRANT ALL PRIVILEGES ON ushahidi.* TO 'user'@'localhost' IDENTIFIED BY 'user';
" | mysql -u"$MYSQL_ADMIN_NM" -p"$MYSQL_ADMIN_PW"


# tweak apache to allow Clean URLs
{'fraction_non_alphanumeric': 0.14559780746831105, 'fraction_numerical': 0.006337786913326482, 'mean_word_length': 4.139964788732394, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 10, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7623419', 'n_tokens_mistral': 1955, 'n_tokens_neox': 1862, 'n_words': 667}