Created
October 13, 2011 18:47
-
-
Save smira2000/1285106 to your computer and use it in GitHub Desktop.
localhost barracuda setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
###----------------------------------------### | |
### | |
### Barracuda Aegir Installer | |
### | |
### Copyright (C) 2010-2011 Omega8.cc | |
### noc@omega8.cc www.omega8.cc | |
### | |
### This program is free software. You can | |
### redistribute it and/or modify it under | |
### the terms of the GNU GPL as published by | |
### the Free Software Foundation, version 2 | |
### or later. | |
### | |
### 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 GPL | |
### for more details. | |
### | |
### You should have received a copy of the | |
### GNU GPL along with this program. | |
### If not, see http://www.gnu.org/licenses/ | |
### | |
### Code: http://code.aegir.cc/aegir | |
### | |
###----------------------------------------### | |
###----------------------------------------### | |
### HOW-TO: run it with bash, not with sh ### | |
###----------------------------------------### | |
### | |
### $ bash BARRACUDA.sh.txt | |
### | |
###----------------------------------------### | |
### EDITME ### | |
###----------------------------------------### | |
### | |
### Enter your valid e-mail address below. | |
### | |
_MY_EMAIL="nomail@localhost" | |
###----------------------------------------### | |
### XTRAS INSTALL MODE ### | |
###----------------------------------------### | |
### | |
### You can use wildcard "ALL" to install all | |
### available xtras or configure the list | |
### of xtras to be installed as explained | |
### below. | |
### | |
### Note: the "ALL" wildcard is not default! | |
### | |
### When combined with _AUTOPILOT=YES option | |
### you can speed up the process and still | |
### control which xtras will be installed, | |
### using the symbols listed below. | |
### | |
### PDS --- fast DNS cache server (pdnsd) | |
### BND --- Bind9 DNS Server | |
### SLR --- MultiCore Apache Solr Tomcat | |
### CHV --- Chive DB Manager | |
### BDD --- SQL Buddy DB Manager | |
### CGP --- Collectd Graph Panel | |
### WMN --- Webmin Control Panel | |
### CSF --- csf/lfd Firewall | |
### | |
### Examples: | |
### | |
### _XTRAS_LIST="" | |
### _XTRAS_LIST=ALL | |
### _XTRAS_LIST="CHV CGP CSF" | |
### | |
_XTRAS_LIST="SLR" | |
###----------------------------------------### | |
### HTTP LISTENING MODE ### | |
###----------------------------------------### | |
### | |
### By default Nginx will listen on defined | |
### or discovered IP address, but you can | |
### change this to wildcard, so it will listen | |
### on all available IPs. This may be useful | |
### in some environments like Amazon EC2 | |
### with dynamic local IP and separate public | |
### IP not available on the local interface. | |
### | |
### Note: this option works only on initial | |
### install. You can't change this on upgrade | |
### because it could cause serious issues. | |
### | |
### To enable wildcard mode, change this to: | |
### | |
### _HTTP_WILDCARD=YES | |
### | |
_HTTP_WILDCARD=YES | |
###----------------------------------------### | |
### AUTOPILOT MODE ### | |
###----------------------------------------### | |
### | |
### To disable all Yes/no prompts and just run | |
### everything as-is, change it to YES. | |
### | |
### _AUTOPILOT=YES | |
### | |
_AUTOPILOT=NO | |
###----------------------------------------### | |
### DEBUG MODE SWITCH (available) ### | |
###----------------------------------------### | |
### | |
### Use this when you experience silent hangs | |
### or other hard to debug problems to display | |
### some errors on screen. | |
### | |
### _DEBUG_MODE=YES | |
### | |
_DEBUG_MODE=NO | |
###----------------------------------------### | |
### AEGIR BARRACUDA VERSION ### | |
###----------------------------------------### | |
### | |
### By default latest release version will | |
### be installed. Please never use HEAD (dev) | |
### version on any production server. | |
### The HEAD can be occasionally broken | |
### and should be used **only** for testing! | |
### | |
### _AEGIR_VERSION=HEAD | |
### _AEGIR_VERSION=1.0-boa-T-8.10 | |
### | |
_AEGIR_VERSION=HEAD | |
###----------------------------------------### | |
### DB SERVER ### | |
###----------------------------------------### | |
### | |
### You can choose MariaDB 5.2 (default) | |
### or Percona 5.5 - available now only for | |
### Squeeze, Lucid, Maverick and Natty. | |
### | |
### You can choose/change the DB server both | |
### on Barracuda install and upgrade, but | |
### the only upgrade path available is from | |
### MariaDB to Percona - it will also force | |
### PHP-FPM rebuild automatically. | |
### | |
### Note: Since Percona 5.5.11 is currently | |
### broken on Lenny, and 5.5.12 is not yet | |
### available in the apt repository, we force | |
### installation of MariaDB 5.2 on Lenny. | |
### | |
### _DB_SERVER=Percona | |
### | |
_DB_SERVER=MariaDB | |
###----------------------------------------### | |
### SSH CUSTOM PORT ### | |
###----------------------------------------### | |
### | |
### Change this if you want to use non-default | |
### port for SSH and SFTP connections. | |
### | |
### Changing the port will alter also your | |
### server firewall (csf) settings and can | |
### be used only once - on initial Barracuda | |
### install or on the first upgrade after | |
### this feature has been introduced. | |
### | |
_SSH_PORT=22 | |
###----------------------------------------### | |
### LOCAL DEBIAN OR UBUNTU MIRROR ### | |
###----------------------------------------### | |
### | |
### Use this when you prefer to use the mirror | |
### you know is the best / the fastest for you | |
### and skip searching around the globe. | |
### | |
### _LOCAL_DEBIAN_MIRROR=ftp.au.debian.org | |
### _LOCAL_UBUNTU_MIRROR=au.archive.ubuntu.com | |
### | |
_LOCAL_DEBIAN_MIRROR="" | |
_LOCAL_UBUNTU_MIRROR="" | |
###----------------------------------------### | |
### FORCE PREFERRED GIT REPOSITORY ### | |
###----------------------------------------### | |
### | |
### Use this when you are experiencing issues | |
### trying to connect to the default drupal | |
### repository. Valid options: | |
### | |
### _FORCE_GIT_MIRROR=drupal | |
### _FORCE_GIT_MIRROR=github | |
### _FORCE_GIT_MIRROR=gitorious | |
### | |
### Note: with forced mirror the script will | |
### not try to connect and then switch to | |
### alternate mirror. It will simply fail | |
### if the forced mirror doesn't respond. | |
### | |
_FORCE_GIT_MIRROR="" | |
###----------------------------------------### | |
### DNS MANUAL CONFIG ### | |
###----------------------------------------### | |
### | |
### Starting with release 0.4-alpha9 Aegir | |
### requires proper DNS configuration | |
### of your server. Your hostname has to be | |
### FQDN and has to match your server IP. | |
### | |
### This script is trying to discover your | |
### DNS details and allow or deny the install, | |
### if something doesn't look correct. | |
### | |
### This script will also use your FQDN | |
### hostname as a web address of your Aegir | |
### frontend (control panel). | |
### | |
### You can try to change the automatic | |
### defaults by setting up your IP address, | |
### your FQDN hostname and your Aegir frontend | |
### web address below. | |
### | |
### It can be useful when you are using local | |
### environment with custom settings in your | |
### /etc/hosts, when you have more than one | |
### public IPs on eth0 and you wish to use | |
### non-default (first) IP address, or when | |
### you want to use non-hostname (sub)domain | |
### to access your Aegir frontend. | |
### | |
### It is also useful when you plan to use | |
### available in Barracuda optional installs | |
### of Chive, SQL Buddy and Collectd, since | |
### all of them will use subdomains in the | |
### server hostname and it will not work | |
### when your hostname domain DNS is not | |
### under your control (like many default | |
### hostnames and reverse DNS provided by | |
### VPS hosting companies). | |
### | |
### Please change *all 3 values* if you wish | |
### to customize this automatic setup. | |
### | |
### Example: | |
### | |
### _MY_OWNIP=192.168.0.108 | |
### _MY_HOSTN=server.mydomain.com | |
### _MY_FRONT=aegir.mydomain.com | |
### | |
### NOTE: | |
### | |
### If you will use your custom DNS settings, | |
### they will be still validated, therefore | |
### make sure your _MY_HOSTN and _MY_FRONT | |
### both matches your _MY_OWNIP or the script | |
### will fail to install Aegir (unless you | |
### will disable the DNS test completely | |
### below in _DNS_SETUP_TEST). | |
### | |
_MY_OWNIP="" | |
_MY_HOSTN="" | |
_MY_FRONT="" | |
###----------------------------------------### | |
### SPEED BOOSTER ### | |
###----------------------------------------### | |
### | |
### It is an experimental feature allowing you | |
### to use Nginx built-in cache system, using | |
### static copies of full pages, similar to | |
### those created by Boost module, but without | |
### Boost at all, so it works the same with | |
### any Drupal core version: 5.x, 6.x and 7.x. | |
### | |
### Even when enabled, it will not cache | |
### anything if the site is using SSL mode | |
### or the platform is Drupal 6 Ubercart, | |
### Drupal 7 Commerce or any platform with | |
### ubercart module uploaded to sites/all. | |
### | |
### Also any requests to /user* or /admin* | |
### are never cached for obvious reasons. | |
### | |
### Note: this cache will use hardcoded | |
### lifetime value, set to 60 minutes, | |
### but if you have also Boost enabled, then | |
### the Boost cached pages will be served | |
### first, if exists, so it is still possible | |
### to use both systems for a bit better | |
### cache lifetime control. | |
### | |
### It is now possible to use this cache | |
### system for logged in users, with pages | |
### cached per user (valid for 5 minutes max) | |
### | |
### To disable Speed Booster per platform, | |
### create an empty directory with the name | |
### "ubercart" (unless you have there the | |
### real ubercart module), with one empty | |
### README.txt file inside, so its path will | |
### be sites/all/modules/ubercart/README.txt | |
### | |
### You can turn ON/OFF this feature on every | |
### upgrade for all platforms on this Aegir | |
### Master Instance by changing the value | |
### below to YES or NO. | |
### | |
### _USE_SPEED_BOOSTER=NO | |
### | |
### | |
_USE_SPEED_BOOSTER=NO | |
###----------------------------------------### | |
### DATABASE CUSTOM HOST ### | |
###----------------------------------------### | |
### | |
### If you prefer, you can set the database | |
### to be connected locally via "localhost" | |
### instead of FQDN pointing to your public IP | |
### address. | |
### | |
### This feature allows you to "revert" to the | |
### old Aegir behavior, when localhost was | |
### used by default for database connections. | |
### | |
### You could also use this feature to connect | |
### to the remote database server by default, | |
### since it allows to "override" the new | |
### behavior, designed for Aegir multiserver | |
### compatibility. | |
### | |
### If not sure, please don't change the | |
### default FQDN config keyword. | |
### | |
### Available options: | |
### | |
### _THIS_DB_HOST=localhost | |
### _THIS_DB_HOST=some.remote.host.name | |
### | |
_THIS_DB_HOST=localhost | |
###----------------------------------------### | |
### DNS SETUP TEST ### | |
###----------------------------------------### | |
### | |
### If you don't want to test your DNS | |
### because of some custom local setup | |
### you know is correct (like DynDNS) | |
### but the script can't validate it with its | |
### standard ifconfig tests, set this to: | |
### | |
### _DNS_SETUP_TEST=NO | |
### | |
### There is no guarantee it will work. | |
### | |
_DNS_SETUP_TEST=YES | |
###----------------------------------------### | |
### SMTP CONNECTION TEST ### | |
###----------------------------------------### | |
### | |
### If you don't want to test outgoing SMTP | |
### connections, change _SMTP_RELAY_TEST | |
### value to "NO". | |
### | |
_SMTP_RELAY_TEST=YES | |
###----------------------------------------### | |
### SMTP RELAY HOST - ONLY WHEN REQUIRED ### | |
###----------------------------------------### | |
### | |
### _SMTP_RELAY_HOST="smtp.cust.voxel.net" | |
### | |
_SMTP_RELAY_HOST="" | |
###----------------------------------------### | |
### LOCALHOST ON LOCAL NETWORK ### | |
###----------------------------------------### | |
### | |
### When enabled, it will force your Nginx web | |
### server to listen only on local IP with | |
### local hostname: | |
### | |
### _LOCAL_NETWORK_IP=10.10.80.80 | |
### _LOCAL_NETWORK_HN=aegir.local | |
### | |
### In this example 10.10.80.80 is your local | |
### server IP address, where public traffic | |
### is NAT'd from another, public IP address. | |
### | |
### In this case "aegir.local" will be used | |
### as your hostname and all connections and | |
### grants will use "aegir.local" instead of | |
### FQDN. Also your Aegir Master Instance | |
### will be available at http://aegir.local | |
### | |
### This option is useful when your server is | |
### available only in your local network | |
### without any public IP address assigned/ | |
### available on any eth interface. This also | |
### means it should work as a handy local | |
### setup on your wirelessly connected laptop | |
### or netbook, with improved DNS cache | |
### support - pdnsd will save results in file. | |
### | |
### In this case you could use 127.0.1.1 as | |
### _LOCAL_NETWORK_IP to avoid issues with | |
### DHCP changing your assigned IP on the fly | |
### and to avoid conflicts with some other | |
### services listening on 127.0.0.1 | |
### | |
### This option works only with initial | |
### install and is disabled for upgrades. | |
### When used, it will override all defined | |
### above _MY_OWNIP, _MY_HOSTN and _MY_FRONT. | |
### It will also disable all DNS and SMTP | |
### relay tests automatically. It will also | |
### enable debug mode by default. | |
### | |
### In general: DON'T TRY THIS OPTION, unless | |
### you know, what are you doing. It is only | |
### to make local install easier and helps | |
### with using Aegir on servers without direct | |
### connection to the Internet, but again, you | |
### must understand how it works. | |
### | |
_LOCAL_NETWORK_IP="192.168.100.101" | |
_LOCAL_NETWORK_HN="aegir.icyou-dev" | |
###----------------------------------------### | |
### ADVANCED CONFIGURATION OPTIONS ### | |
###----------------------------------------### | |
_NGINX_EXTRA_CONF="" | |
_PHP_FORCE_REINSTALL=NO | |
_SQL_FORCE_REINSTALL=NO | |
###----------------------------------------### | |
### DON'T EDIT ANYTHING BELOW THIS LINE ### | |
###----------------------------------------### | |
_INSTALLER_VERSION=1.0-boa-T-8.10 | |
_NGINX_VERSION=1.0.8 | |
_PHP_VERSION=5.2.17 | |
_APC_VERSION=3.1.9 | |
_CHIVE_VERSION=0.5.1 | |
_BZR_VERSION=2.3.4 | |
_LSHELL_VERSION=0.9.14 | |
_PURE_FTPD_VERSION=1.0.32 | |
_DRUSH_VERSION=7.x-4.5 ### or HEAD | |
_DRUSH_FAMILY=4 ### change to 5 for HEAD | |
_NOW=`date +%y%m%d-%H%M` | |
_TEST_MODE=OFF | |
###---### Avoid too many questions | |
# | |
export DEBIAN_FRONTEND=noninteractive | |
# | |
###---### Functions | |
# | |
# Noticeable messages. | |
msg () { | |
echo "Barracuda [`date`] ==> $*" | |
} | |
# Simple prompt. | |
prompt_yes_no () { | |
if [ "$_AUTOPILOT" = "YES" ]; then | |
return 0 | |
else | |
while true ; do | |
printf "$* [Y/n] " | |
read answer | |
if [ -z "$answer" ] ; then | |
return 0 | |
fi | |
case $answer in | |
[Yy]|[Yy][Ee][Ss]) | |
return 0 | |
;; | |
[Nn]|[Nn][Oo]) | |
return 1 | |
;; | |
*) | |
echo "Please answer yes or no" | |
;; | |
esac | |
done | |
fi | |
} | |
# | |
# Prompt to confirm choice. | |
prompt_confirm_choice () { | |
read -p "$1 [$2]:" _CONFIRMED_ANSWER | |
if [ -z "$_CONFIRMED_ANSWER" ] ; then | |
_CONFIRMED_ANSWER=$2 | |
fi | |
} | |
# | |
# Stop on error. | |
# set -e ### disable this for debugging | |
# | |
# Success msg. | |
success () { | |
msg "$1 Succeeded." | |
} | |
# | |
# Error msg. | |
fatal () { | |
echo " " | |
msg "Fatal Error Occurred: $1" | |
msg "Cannot continue installation." | |
exit 1 | |
} | |
# | |
# Not supported OS. | |
not_supported_os () { | |
msg "== FATAL ERROR ==" | |
msg "Invalid install script or OS used." | |
msg "It is not any supported Ubuntu or Debian version. Sorry." | |
msg "You need Debian (Squeeze or Lenny) or Ubuntu (Natty, Maverick, Lucid, Karmic or Jaunty)," | |
msg "or Jolicloud (Robby)." | |
msg "Ciao... :)" | |
exit 1 | |
} | |
# | |
# Perform an action, log it, and run the spinner throughout. | |
runner () { | |
CMD="$1" | |
touch busy | |
bash $_SRCDIR/spinner busy & | |
if $CMD >> $_LOG; then | |
rm busy | |
sleep 1 | |
success "$CMD:" | |
return 0 | |
else | |
rm busy | |
sleep 1 | |
echo "$CMD failed. Error (if any): $?" | |
echo " " | |
echo "Displaying the last 15 lines of $_LOG to help troubleshoot this problem." | |
echo "If you see any error with advice to run 'dpkg --configure -a', run this" | |
echo "command first and choose default answer, then run this installer again." | |
echo " " | |
tail -15 $_LOG | |
return 1 | |
fi | |
} | |
# | |
# Small spinner. | |
mrun () { | |
CMD="$1" | |
touch busy | |
bash $_SRCDIR/spinner busy & | |
if $CMD >> $_LOG; then | |
rm busy | |
sleep 1 | |
return 0 | |
fi | |
} | |
# | |
# Silent runner. | |
st_runner () { | |
CMD="$1" | |
touch busy | |
bash $_SRCDIR/spinner busy & | |
if $CMD >> $_LOG; then | |
rm busy | |
sleep 1 | |
return 0 | |
else | |
rm busy | |
sleep 1 | |
echo "$CMD failed. Error (if any): $?" | |
echo " " | |
echo "Displaying the last 15 lines of $_LOG to help troubleshoot this problem." | |
echo "If you see any error with advice to run 'dpkg --configure -a', run this" | |
echo "command first and choose default answer, then run this installer again." | |
echo " " | |
tail -15 $_LOG | |
return 1 | |
fi | |
} | |
# | |
# Find correct IP. | |
find_correct_ip () { | |
_FQDN_TEST=$(host $_LOC_DOM) | |
if [[ $_FQDN_TEST =~ "is an alias for" ]] ; then | |
_LOC_IP=`echo $_FQDN_TEST | cut -d: -f2 | awk '{ print $10}'` | |
else | |
_LOC_IP=`echo $_FQDN_TEST | cut -d: -f2 | awk '{ print $4}'` | |
fi | |
} | |
# | |
# Install Redis from sources. | |
install_redis_src () { | |
msg "INFO: Installing Redis update for $_THIS_OS/$_THIS_RV, please wait..." | |
mrun "sleep 3" | |
if [ ! -e "/var/lib/redis" ] ; then | |
st_runner "adduser --system --group redis" 2> /dev/null | |
fi | |
cd /var/opt | |
rm -f -r /var/opt/redis* | |
wget -q -U iCab http://redis.googlecode.com/files/redis-2.0.5.tar.gz | |
tar -xzf redis-2.0.5.tar.gz | |
cd redis-2.0.5 | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
if [ -e "/var/lib/redis" ] ; then | |
st_runner "invoke-rc.d redis-server stop" &> /dev/null | |
mrun "sleep 5" | |
killall -9 redis-server &> /dev/null | |
fi | |
cd /usr/local/bin | |
cp -p redis-server /usr/bin/ | |
cp -p redis-benchmark /usr/bin/ | |
cp -p redis-cli /usr/bin/ | |
cp -p redis-check-dump /usr/bin/ | |
cp -p redis-check-aof /usr/bin/ | |
cd /etc/init.d | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/redis-server ./ | |
chmod 755 redis-server &> /dev/null | |
st_runner "update-rc.d redis-server defaults" &> /dev/null | |
mkdir -p /etc/redis | |
cd /etc/redis | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/redis.conf ./ | |
mkdir -p /var/log/redis | |
chown redis:redis /var/log/redis | |
mkdir -p /var/lib/redis | |
chown redis:redis /var/lib/redis | |
rm -f /var/lib/redis/* | |
st_runner "invoke-rc.d redis-server start" &> /dev/null | |
touch /var/log/redis-2.0.5.log | |
} | |
# | |
# Fix this on upgrade. | |
fix_on_upgrade () { | |
sed -i "s/apc.include_once_override = 1/apc.include_once_override = 0/g" /opt/etc/php.ini | |
perl -p -i -e "s/allowed\s+:.*\]/allowed : \['drush','drush dbup','drush mup','drush make','drush help','drush dl','drush cc','drush en','drush dis','drush st','drush cron','drush dd','drush pml','drush pmi','drush sa','drush sql-conf','drush sqlq','drush sql-connect','drush sqlc','drush sql-dump','drush uinf','drush ublk','drush uublk','drush urol','drush urrol','drush ucrt','drush uli','drush ucan','drush upwd','drush vget','drush vset','drush vdel','drush fd','drush fe','drush fl','drush fr','drush fra','drush fu','drush fua','ls','echo','cd','ll','mysql','git','svn','cvs','rsync','less','nano','cp','wget','bzr','vi','cat','lftp','sed','grep','mkdir','tar','gzip','unzip','passwd','scp','rm','mv','pwd','chmod','patch','touch','ssh-keygen','git-receive-pack','git-upload-pack','git-upload-archive','mysqldump','drush gm'\]/g" /etc/lshell.conf | |
perl -p -i -e "s/'drush up',.*\]/'drush up', 'drush pm-update', 'drush upc', 'drush pm-updatecode', 'drush si', 'drush site-install', 'drush sup', 'drush site-upgrade', 'drush cli', 'drush core-cli', 'drush core-rsync', 'drush rsync', 'drush php-eval', 'drush scr', 'drush php-script'\]/g" /etc/lshell.conf | |
perl -p -i -e "s/overssh\s+:.*\]/overssh : \['ls', 'rsync', 'scp', 'git', 'git-receive-pack', 'git-upload-pack', 'git-upload-archive', 'mysqldump'\]/g" /etc/lshell.conf | |
perl -p -i -e "s/,'drush mup':'drush upc'\}/,'drush mup':'drush upc','drush gm':'drush generate-makefile'\}/g" /etc/lshell.conf | |
mkdir -p /var/backups/dragon/t | |
cp -af /opt/etc/php.ini /var/backups/dragon/t/opt-etc-php.ini-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/php.ini /opt/etc/php.ini &> /dev/null | |
cp -af /usr/local/lib/php.ini /var/backups/dragon/t/usr-local-lib-php.ini-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/php-cli.ini /usr/local/lib/php.ini &> /dev/null | |
if [ ! -e "/var/log/check_for_crashed_tables_disabled" ] ; then | |
perl -p -i -e "s/check_for_crashed_tables/\#check_for_crashed_tables/g" /etc/mysql/debian-start | |
touch /var/log/check_for_crashed_tables_disabled | |
fi | |
cd /etc/mysql | |
mv -f my.cnf my.cnf-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/my.cnf.txt ./ | |
mv -f my.cnf.txt my.cnf &> /dev/null | |
_DB_SERVER_TEST=`mysql -V 2>&1` | |
if [[ $_DB_SERVER_TEST =~ MariaDB ]] ; then | |
_DB_SERVER=MariaDB | |
else | |
_DB_SERVER=Percona | |
fi | |
if [ "$_DB_SERVER" = "Percona" ]; then | |
sed -i "s/default-table-type/\#default-table-type/g" /etc/mysql/my.cnf | |
sed -i "s/language/\#language/g" /etc/mysql/my.cnf | |
fi | |
if [ ! -e "/var/log/nginx_config_fixed" ] ; then | |
cd /var/aegir | |
sed -i "s/access_log/\#access_log/g" /etc/nginx/nginx.conf | |
perl -p -i -e "s/worker_connections\s+1024/worker_connections 4096/g" /etc/nginx/nginx.conf | |
perl -p -i -e "s/worker_processes\s+1\;/worker_processes 4\;\nworker_rlimit_nofile 8192\;/g" /etc/nginx/nginx.conf | |
if [ "$_REL_VERSION" = "maverick" ] || [ "$_REL_VERSION" = "natty" ]; then | |
if [ -e "/opt/tmp/$_BOA_REPO_NAME/aegir/conf/nginx.conf" ]; then | |
mv -f /etc/nginx/nginx.conf /etc/nginx/nginx.conf-old &> /dev/null | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/nginx.conf /etc/nginx/nginx.conf | |
fi | |
fi | |
touch /var/log/nginx_config_fixed | |
fi | |
} | |
# | |
# Validate server public IP. | |
validate_public_ip () { | |
if [ ! -z "$_LOCAL_NETWORK_IP" ] ; then | |
if [ -z "$_LOCAL_NETWORK_HN" ] ; then | |
msg "FATAL ERROR: you must specify also _LOCAL_NETWORK_HN" | |
exit 1 | |
else | |
_MY_OWNIP="$_LOCAL_NETWORK_IP" | |
_MY_HOSTN="$_LOCAL_NETWORK_HN" | |
_MY_FRONT="$_LOCAL_NETWORK_HN" | |
_THISHTIP="$_LOCAL_NETWORK_IP" | |
fi | |
else | |
_ETH_TEST=`ifconfig 2>&1` | |
if [[ $_ETH_TEST =~ venet0 ]] ; then | |
_VMFAMILY="VZ" | |
_IFCONFIG="venet0" | |
elif [ -e "/proc/bean_counters" ] ; then | |
_VMFAMILY="VZ" | |
_IFCONFIG="venet0" | |
else | |
_VMFAMILY="XEN" | |
_IFCONFIG="eth0" | |
fi | |
if [ "$_DNS_SETUP_TEST" = "YES" ] ; then | |
if [ -z "$_MY_OWNIP" ] ; then | |
_THISHTIP=`ifconfig $_IFCONFIG | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` | |
else | |
_THISHTIP="$_MY_OWNIP" | |
fi | |
else | |
if [ -z "$_MY_OWNIP" ] ; then | |
_LOC_DOM="$_DOMAIN" | |
find_correct_ip | |
_THISHTIP="$_LOC_IP" | |
else | |
_THISHTIP="$_MY_OWNIP" | |
fi | |
fi | |
fi | |
} | |
# | |
# Validate server IP for xtras. | |
validate_xtras_ip () { | |
if [ $_HTTP_WILDCARD = "YES" ] ; then | |
_XTRAS_THISHTIP="*" | |
else | |
_ETH_TEST=`ifconfig 2>&1` | |
if [[ $_ETH_TEST =~ venet0 ]] ; then | |
_VMFAMILY="VZ" | |
_IFCONFIG="venet0" | |
elif [ -e "/proc/bean_counters" ] ; then | |
_VMFAMILY="VZ" | |
_IFCONFIG="venet0" | |
else | |
_VMFAMILY="XEN" | |
_IFCONFIG="eth0" | |
fi | |
if [ "$_DNS_SETUP_TEST" = "YES" ] ; then | |
if [ -z "$_MY_OWNIP" ] ; then | |
_XTRAS_THISHTIP=`ifconfig $_IFCONFIG | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` | |
else | |
_XTRAS_THISHTIP="$_MY_OWNIP" | |
fi | |
else | |
if [ -z "$_MY_OWNIP" ] ; then | |
if [ -e "/usr/bin/sipcalc" ] ; then | |
if [ -z "$_THISHTIP" ] ; then | |
_LOC_DOM="$_THISHOST" | |
find_correct_ip | |
_THISHTIP="$_LOC_IP" | |
fi | |
_IP_TEST=`sipcalc $_THISHTIP 2>&1` | |
if [[ $_IP_TEST =~ ERR ]] ; then | |
_IP_TEST_RESULT=FAIL | |
_XTRAS_THISHTIP="*" | |
else | |
_IP_TEST_RESULT=OK | |
_XTRAS_THISHTIP="$_THISHTIP" | |
fi | |
else | |
_XTRAS_THISHTIP="$_THISHTIP" | |
fi | |
else | |
_XTRAS_THISHTIP="$_MY_OWNIP" | |
fi | |
fi | |
if [ -z "$_XTRAS_THISHTIP" ] ; then | |
_XTRAS_THISHTIP="*" | |
fi | |
fi | |
} | |
# | |
# Validate local server IP. | |
validate_local_ip () { | |
if [ $_HTTP_WILDCARD = "YES" ] ; then | |
_LOCAL_THISHTIP=all | |
else | |
_ETH_TEST=`ifconfig 2>&1` | |
if [[ $_ETH_TEST =~ venet0 ]] ; then | |
_VMFAMILY="VZ" | |
_IFCONFIG="venet0" | |
elif [ -e "/proc/bean_counters" ] ; then | |
_VMFAMILY="VZ" | |
_IFCONFIG="venet0" | |
else | |
_VMFAMILY="XEN" | |
_IFCONFIG="eth0" | |
fi | |
if [ "$_DNS_SETUP_TEST" = "YES" ] ; then | |
if [ -z "$_MY_OWNIP" ] ; then | |
_LOCAL_THISHTIP=`ifconfig $_IFCONFIG | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` | |
else | |
_LOCAL_THISHTIP="$_MY_OWNIP" | |
fi | |
else | |
if [ -z "$_MY_OWNIP" ] ; then | |
if [ -e "/usr/bin/sipcalc" ] ; then | |
if [ -z "$_THISHTIP" ] ; then | |
_LOC_DOM="$_THISHOST" | |
find_correct_ip | |
_THISHTIP="$_LOC_IP" | |
fi | |
_IP_TEST=`sipcalc $_THISHTIP 2>&1` | |
if [[ $_IP_TEST =~ ERR ]] ; then | |
_IP_TEST_RESULT=FAIL | |
_LOCAL_THISHTIP=all | |
else | |
_IP_TEST_RESULT=OK | |
_LOCAL_THISHTIP="$_THISHTIP" | |
fi | |
else | |
_LOCAL_THISHTIP="$_THISHTIP" | |
fi | |
else | |
_LOCAL_THISHTIP="$_MY_OWNIP" | |
fi | |
fi | |
if [ -z "$_LOCAL_THISHTIP" ] ; then | |
_LOCAL_THISHTIP=all | |
fi | |
fi | |
} | |
# | |
# Force advanced Nginx configuration. | |
force_advanced_nginx_config () { | |
validate_local_ip | |
sed -i "s/EDIT_THISHTIP/$_LOCAL_THISHTIP/g" /opt/tmp/$_BOA_REPO_NAME/aegir/conf/nginx_advanced_include.conf | |
sed -i "s/EDIT_THISHTIP/$_LOCAL_THISHTIP/g" /opt/tmp/$_BOA_REPO_NAME/aegir/conf/nginx_octopus_include.conf | |
cd /var/aegir/config/includes | |
rm -f nginx_compact_include.conf | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/nginx_compact_include.conf ./ | |
if [ $_USE_SPEED_BOOSTER = "YES" ] ; then | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/nginx_octopus_include.conf ./ | |
cp -af nginx_octopus_include.conf nginx_simple_include.conf &> /dev/null | |
cp -af nginx_octopus_include.conf nginx_advanced_include.conf &> /dev/null | |
else | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/nginx_advanced_include.conf ./ | |
cp -af nginx_advanced_include.conf nginx_simple_include.conf &> /dev/null | |
fi | |
chown aegir:aegir * | |
cd /var/aegir/.drush/provision/http/nginx | |
rm -f nginx_simple_include.conf | |
rm -f nginx_advanced_include.conf | |
if [ $_USE_SPEED_BOOSTER = "YES" ] ; then | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/nginx_octopus_include.conf ./ | |
cp -af nginx_octopus_include.conf nginx_simple_include.conf &> /dev/null | |
cp -af nginx_octopus_include.conf nginx_advanced_include.conf &> /dev/null | |
else | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/nginx_advanced_include.conf ./ | |
cp -af nginx_advanced_include.conf nginx_simple_include.conf &> /dev/null | |
fi | |
chown aegir:aegir * | |
} | |
# | |
# Tune memory limits for PHP-FPM-FPM, Nginx and MariaDB/Percona. | |
tune_memory_limits () { | |
_ETH_TEST=`ifconfig 2>&1` | |
_VM_TEST=`uname -a 2>&1` | |
if [[ $_ETH_TEST =~ venet0 ]] ; then | |
_VMFAMILY="VZ" | |
elif [ -e "/proc/bean_counters" ] ; then | |
_VMFAMILY="VZ" | |
elif [[ $_VM_TEST =~ beng ]] ; then | |
_VMFAMILY="VS" | |
elif [[ "$_THISHOST" =~ ".host8." ]] && [ -d "/boot/grub" ] ; then | |
_VMFAMILY="TG" | |
else | |
_VMFAMILY="XEN" | |
fi | |
_RAM=`free -mto | grep Mem: | awk '{ print $2 }'` | |
let "_USE = (($_RAM / 4))" | |
if [[ "$_THISHOST" =~ ".host8." ]] ; then | |
if [ "$_VMFAMILY" = "VS" ] && [ ! -d "/boot/grub" ] ; then | |
let "_USE_SQL = (($_RAM / 32))" | |
else | |
let "_USE_SQL = (($_RAM / 6))" | |
fi | |
else | |
let "_USE_SQL = (($_RAM / 4))" | |
fi | |
if [ "$_USE" -ge "512" ] && [ "$_USE" -lt "1024" ] ; then | |
_USE_PHP=512 | |
_USE_APC=512 | |
elif [ "$_USE" -ge "1024" ] ; then | |
if [ "$_VMFAMILY" = "XEN" ] ; then | |
_USE_PHP=512 | |
_USE_APC=1024 | |
sed -i "s/max_children\">4/max_children\"\>8/g" /opt/etc/php-fpm.conf | |
sed -i "s/worker_processes 4/worker_processes 8/g" /etc/nginx/nginx.conf | |
elif [ "$_VMFAMILY" = "VS" ] || [ "$_VMFAMILY" = "TG" ] ; then | |
_USE_PHP=512 | |
if [ -d "/boot/grub" ] ; then | |
_USE_APC=1024 | |
sed -i "s/max_children\">4/max_children\"\>8/g" /opt/etc/php-fpm.conf | |
sed -i "s/worker_processes 4/worker_processes 8/g" /etc/nginx/nginx.conf | |
else | |
_USE_APC=256 | |
sed -i "s/max_children\">4/max_children\"\>2/g" /opt/etc/php-fpm.conf | |
sed -i "s/max_children\">8/max_children\"\>2/g" /opt/etc/php-fpm.conf | |
sed -i "s/worker_processes 8/worker_processes 4/g" /etc/nginx/nginx.conf | |
fi | |
else | |
_USE_PHP=256 | |
_USE_APC=128 | |
fi | |
else | |
_USE_PHP="$_USE" | |
_USE_APC="$_USE" | |
fi | |
if [ "$_VMFAMILY" = "VZ" ] ; then | |
_USE_APC=128 | |
fi | |
let "_USE_FPM = (($_USE_PHP / 2))" | |
if [ "$_USE_FPM" -lt "128" ] ; then | |
_USE_FPM=128 | |
fi | |
if [ "$_USE_PHP" -lt "256" ] ; then | |
_USE_PHP=256 | |
fi | |
sed -i "s/256/$_USE_FPM/g" /opt/etc/php.ini | |
sed -i "s/888/$_USE_APC/g" /opt/etc/php.ini | |
sed -i "s/256/$_USE_PHP/g" /usr/local/lib/php.ini | |
sed -i "s/888/$_USE_SQL/g" /etc/mysql/my.cnf | |
} | |
# | |
# Fix locales. | |
fix_locales () { | |
_LOC_TEST=`locale 2>&1` | |
if [[ $_LOC_TEST =~ Cannot ]] ; then | |
_LOCALE_TEST=BROKEN | |
msg "WARNING!" | |
cat <<EOF | |
Locales on this system are broken or not installed | |
and/or not configured correctly yet. This is "default" | |
issue at RackSpaceCloud (and maybe others). | |
We will fix this problem for you now, so you shouldn't | |
use any tricks to change system/ssh settings before | |
running this Barracuda installer. | |
You can experience problems if your SSH client | |
forces locales other than en_US.UTF-8 we are using by default. | |
You should log out when Barracuda will finish all its tasks | |
and display last line with "BYE!" and then log in again | |
to see the result (and possibly run Octopus installer). | |
We will continue in 30 seconds... | |
EOF | |
sleep 30 | |
locale-gen en_US en_US.UTF-8 &> /dev/null | |
update-locale &> /dev/null | |
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 &> /dev/null | |
echo "LANG=en_US.UTF-8" > /etc/default/locale | |
export LANG=en_US.UTF-8 | |
export LC_ALL=en_US.UTF-8 | |
export LANGUAGE=en_US.UTF-8 | |
echo "export LANG=en_US.UTF-8" >> /root/.bashrc | |
echo "export LC_ALL=en_US.UTF-8" >> /root/.bashrc | |
echo "export LANGUAGE=en_US.UTF-8" >> /root/.bashrc | |
else | |
_LOCALE_TEST=OK | |
locale-gen en_US en_US.UTF-8 &> /dev/null | |
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 &> /dev/null | |
fi | |
} | |
# | |
# Read or create Barracuda cnf file. | |
barracuda_cnf () { | |
if [ ! -e "/root/.barracuda.cnf" ] ; then | |
msg "INFO: Creating your /root/.barracuda.cnf config file" | |
sleep 3 | |
echo "###" > /root/.barracuda.cnf | |
echo "### Configuration created on $_NOW with" >> /root/.barracuda.cnf | |
echo "### Barracuda version $_INSTALLER_VERSION" >> /root/.barracuda.cnf | |
echo "###" >> /root/.barracuda.cnf | |
echo "### NOTE: the group of settings displayed bellow will *not* be overriden" >> /root/.barracuda.cnf | |
echo "### on upgrade by the Barracuda script nor by this configuration file." >> /root/.barracuda.cnf | |
echo "### They can be defined only on initial Barracuda install." >> /root/.barracuda.cnf | |
echo "###" >> /root/.barracuda.cnf | |
echo "_HTTP_WILDCARD=$_HTTP_WILDCARD" >> /root/.barracuda.cnf | |
echo "_MY_OWNIP=\"$_MY_OWNIP\"" >> /root/.barracuda.cnf | |
echo "_MY_HOSTN=\"$_MY_HOSTN\"" >> /root/.barracuda.cnf | |
echo "_MY_FRONT=\"$_MY_FRONT\"" >> /root/.barracuda.cnf | |
echo "_THIS_DB_HOST=$_THIS_DB_HOST" >> /root/.barracuda.cnf | |
echo "_SMTP_RELAY_TEST=$_SMTP_RELAY_TEST" >> /root/.barracuda.cnf | |
echo "_SMTP_RELAY_HOST=\"$_SMTP_RELAY_HOST\"" >> /root/.barracuda.cnf | |
echo "_LOCAL_NETWORK_IP=\"$_LOCAL_NETWORK_IP\"" >> /root/.barracuda.cnf | |
echo "_LOCAL_NETWORK_HN=\"$_LOCAL_NETWORK_HN\"" >> /root/.barracuda.cnf | |
echo "###" >> /root/.barracuda.cnf | |
echo "### NOTE: the group of settings displayed bellow" >> /root/.barracuda.cnf | |
echo "### will *override* all listed settings in the Barracuda script," >> /root/.barracuda.cnf | |
echo "### both on initial install and upgrade." >> /root/.barracuda.cnf | |
echo "###" >> /root/.barracuda.cnf | |
echo "_MY_EMAIL=\"$_MY_EMAIL\"" >> /root/.barracuda.cnf | |
echo "_XTRAS_LIST=\"$_XTRAS_LIST\"" >> /root/.barracuda.cnf | |
echo "_AUTOPILOT=$_AUTOPILOT" >> /root/.barracuda.cnf | |
echo "_DEBUG_MODE=$_DEBUG_MODE" >> /root/.barracuda.cnf | |
echo "_DB_SERVER=$_DB_SERVER" >> /root/.barracuda.cnf | |
echo "_SSH_PORT=$_SSH_PORT" >> /root/.barracuda.cnf | |
echo "_LOCAL_DEBIAN_MIRROR=\"$_LOCAL_DEBIAN_MIRROR\"" >> /root/.barracuda.cnf | |
echo "_LOCAL_UBUNTU_MIRROR=\"$_LOCAL_UBUNTU_MIRROR\"" >> /root/.barracuda.cnf | |
echo "_FORCE_GIT_MIRROR=\"$_FORCE_GIT_MIRROR\"" >> /root/.barracuda.cnf | |
echo "_USE_SPEED_BOOSTER=$_USE_SPEED_BOOSTER" >> /root/.barracuda.cnf | |
echo "_DNS_SETUP_TEST=$_DNS_SETUP_TEST" >> /root/.barracuda.cnf | |
echo "_NGINX_EXTRA_CONF=\"$_NGINX_EXTRA_CONF\"" >> /root/.barracuda.cnf | |
echo "_PHP_FORCE_REINSTALL=$_PHP_FORCE_REINSTALL" >> /root/.barracuda.cnf | |
echo "_SQL_FORCE_REINSTALL=$_SQL_FORCE_REINSTALL" >> /root/.barracuda.cnf | |
echo "###" >> /root/.barracuda.cnf | |
echo "### Configuration created on $_NOW with" >> /root/.barracuda.cnf | |
echo "### Barracuda version $_INSTALLER_VERSION" >> /root/.barracuda.cnf | |
echo "###" >> /root/.barracuda.cnf | |
else | |
msg "INFO: Reading your /root/.barracuda.cnf config file." | |
sleep 3 | |
msg "NOTE: Please review all config options displayed below." | |
msg "NOTE: It will *override* all settings in the Barracuda script." | |
sleep 5 | |
echo " " | |
while read line ; do | |
echo "$line" | |
done < /root/.barracuda.cnf | |
echo " " | |
if [ $_STATUS = "INIT" ] ; then | |
if prompt_yes_no "Do you want to proceed with the install?" ; then | |
true | |
source /root/.barracuda.cnf | |
else | |
echo "Installation aborted by you." | |
exit 1 | |
fi | |
else | |
if prompt_yes_no "Do you want to proceed with the upgrade?" ; then | |
true | |
source /root/.barracuda.cnf | |
else | |
echo "Upgrade aborted by you." | |
exit 1 | |
fi | |
fi | |
fi | |
} | |
###--------------------### | |
if [ `whoami` = "root" ] ; then | |
msg "STATUS: This script is ran as a root user." | |
msg "STATUS: Stop the cron and wait 5 sec." | |
rm -f -r /opt/tmp/* | |
rm -f /tmp/cache.inc | |
invoke-rc.d cron stop &> /dev/null | |
touch /var/run/octopus_barracuda.pid | |
_VM_TEST=`uname -a 2>&1` | |
if [[ $_VM_TEST =~ beng ]] ; then | |
_VMFAMILY="VS" | |
touch /var/run/cloud_vhost.pid | |
fi | |
sleep 5 | |
else | |
msg "ERROR: This script should be ran as a root user, please `su - root` or `sudo -i` first." | |
exit 1 | |
fi | |
###--------------------### | |
msg "INFO: Install or upgrade checking, please wait..." | |
sleep 3 | |
if [ -d "/var/aegir" ] ; then | |
_STATUS=UPGRADE | |
msg "INFO: UPGRADE..." | |
barracuda_cnf | |
if [ -f "/var/aegir/config/includes/wildcard_listen_http_enabled.txt" ] ; then | |
_HTTP_WILDCARD=YES | |
else | |
_HTTP_WILDCARD=NO | |
fi | |
else | |
_STATUS=INIT | |
msg "INFO: INIT..." | |
barracuda_cnf | |
fi | |
_INITINS="/usr/bin/apt-get -y --force-yes install" | |
_INSTALL="/usr/bin/apt-get -y --force-yes --config-file /opt/tmp/apt.conf.noninteractive install" | |
_SRCDIR=/opt/tmp/files | |
rm -f -r /var/opt/* | |
mkdir -p $_SRCDIR | |
chmod -R 777 /opt/tmp &> /dev/null | |
rm -f /var/run/aegir_upgrade.pid | |
###--------------------### | |
if [ $_STATUS = "UPGRADE" ] ; then | |
if [ ! -e "/root/.my.cnf" ] ; then | |
msg "EXIT on error due to not found file with your MySQL/$_DB_SERVER root password." | |
cat <<EOF | |
It appears you don't have required file with your root sql password. | |
Create this file first and run this script again: | |
echo "[client]" > /root/.my.cnf | |
echo "user=root" >> /root/.my.cnf | |
echo "password=your_SQL_ROOT_password" >> /root/.my.cnf | |
chmod 0600 /root/.my.cnf | |
EOF | |
msg "EXIT on error due to not found file with your MySQL/$_DB_SERVER root password." | |
echo " " | |
exit 1 | |
fi | |
fi | |
###--------------------### | |
if [ $_STATUS = "INIT" ] ; then | |
msg "INFO: We need to install wget, axel, aptitude, netcat & git first, please wait..." | |
sleep 3 | |
apt-get update &> /dev/null | |
$_INITINS locales &> /dev/null | |
sleep 5 | |
fix_locales | |
$_INITINS wget git-core axel netcat aptitude &> /dev/null | |
fi | |
###--------------------### | |
_DRUPAL_WORKS=NO | |
_GITORIOUS_WORKS=NO | |
_GITHUB_WORKS=NO | |
if [ "$_FORCE_GIT_MIRROR" = "drupal" ] ; then | |
msg "INFO: We will use forced Drupal repository without testing connection" | |
_DRUPAL_WORKS=YES | |
_GITORIOUS_WORKS=NO | |
_GITHUB_WORKS=NO | |
sleep 3 | |
elif [ "$_FORCE_GIT_MIRROR" = "github" ] ; then | |
msg "INFO: We will use forced GitHub mirror without testing connection" | |
_DRUPAL_WORKS=NO | |
_GITORIOUS_WORKS=NO | |
_GITHUB_WORKS=YES | |
sleep 3 | |
elif [ "$_FORCE_GIT_MIRROR" = "gitorious" ] ; then | |
msg "INFO: We will use forced Gitorious mirror without testing connection" | |
_DRUPAL_WORKS=NO | |
_GITORIOUS_WORKS=YES | |
_GITHUB_WORKS=NO | |
sleep 3 | |
else | |
msg "INFO: Testing Drupal, GitHub and Gitorious servers availability, please wait..." | |
sleep 3 | |
_DRUPAL_WORKS=YES | |
_GITORIOUS_WORKS=YES | |
_GITHUB_WORKS=YES | |
if ! netcat -w 8 -z git.drupal.org 80 ; then | |
_DRUPAL_WORKS=NO | |
msg "WARN: The Drupal master repository server doesn't respond..." | |
elif ! netcat -w 8 -z github.com 9418 ; then | |
_GITHUB_WORKS=NO | |
msg "WARN: The GitHub mirror repository server doesn't respond..." | |
elif ! netcat -w 8 -z code.aegir.cc 9418 ; then | |
_GITORIOUS_WORKS=NO | |
msg "WARN: The Gitorious mirror repository server doesn't respond..." | |
fi | |
fi | |
if [ "$_DRUPAL_WORKS" = "YES" ] ; then | |
_BOA_REPO_NAME="barracuda" | |
_BOA_REPO_GIT_URL="http://git.drupal.org/project" | |
msg "INFO: Drupal master repository will be used for this install" | |
elif [ "$_GITHUB_WORKS" = "YES" ] ; then | |
_BOA_REPO_NAME="nginx-for-drupal" | |
_BOA_REPO_GIT_URL="git://github.com/omega8cc" | |
msg "INFO: GitHub mirror repository will be used for this install" | |
elif [ "$_GITORIOUS_WORKS" = "YES" ] ; then | |
_BOA_REPO_NAME="barracuda-octopus" | |
_BOA_REPO_GIT_URL="git://code.aegir.cc/aegir" | |
msg "INFO: Gitorious mirror repository will be used for this install" | |
else | |
cat <<EOF | |
None of repository servers respond in 8 seconds, | |
so we can't continue this installation. | |
Please try again later or check if your firewall has port 9418 open. | |
Bye. | |
EOF | |
exit 1 | |
fi | |
_BOA_REPO_GIT_URLX=${_BOA_REPO_GIT_URL//\//\\\/} | |
###--------------------### | |
if [ -d "/usr/share/git-core" ] ; then | |
msg "INFO: Fix for possibly broken git-core" | |
sleep 3 | |
chmod 644 /usr/share/git-core/templates/description &> /dev/null | |
chmod 644 /usr/share/git-core/templates/hooks/* &> /dev/null | |
chmod 644 /usr/share/git-core/templates/info/* &> /dev/null | |
fi | |
###--------------------### | |
msg "INFO: Downloading little helpers, please wait..." | |
sleep 3 | |
# | |
# Git clone all | |
cd /opt/tmp | |
rm -f -r /opt/tmp/$_BOA_REPO_NAME | |
if [ "$_AEGIR_VERSION" = "HEAD" ]; then | |
git clone $_BOA_REPO_GIT_URL/$_BOA_REPO_NAME.git &> /dev/null | |
else | |
wget -q -U iCab http://files.aegir.cc/versions/nginx-for-drupal-$_AEGIR_VERSION.tar.gz | |
gunzip -q -c nginx-for-drupal-$_AEGIR_VERSION.tar.gz | tar -xf - | |
rm -f nginx-for-drupal-$_AEGIR_VERSION.tar.gz | |
_BOA_REPO_NAME="nginx-for-drupal" | |
fi | |
# | |
if [ ! -e "/opt/tmp/$_BOA_REPO_NAME/aegir/helpers/apt.conf.noninteractive" ] ; then | |
echo " " | |
msg "EXIT on error due to missing helpers." | |
msg "Please try to run this script again in a few minutes." | |
msg "Also, make sure the git port 9418 is open." | |
msg "Bye." | |
echo " " | |
exit 1 | |
fi | |
# Get apt helper | |
rm -f apt.conf.noninteractive* | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/helpers/apt.conf.noninteractive ./ | |
# | |
# Create tmp stuff | |
_LOG=/opt/tmp/aegir-install.log | |
_SILENT=/opt/tmp/silent.log | |
cd $_SRCDIR | |
# | |
# Get spinner | |
rm -f spinner* | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/helpers/spinner ./ | |
chmod +x spinner &> /dev/null | |
# | |
# Get axelerator | |
if [ ! -e "/usr/bin/apt-fast" ] ; then | |
cd /usr/bin | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/helpers/apt-fast.sh.txt ./ | |
mv -f apt-fast.sh.txt apt-fast &> /dev/null | |
chmod +x apt-fast &> /dev/null | |
cd /opt/tmp | |
fi | |
###--------------------### | |
msg "INFO: Checking BARRACUDA version, please wait..." | |
if [ -e "/opt/tmp/$_BOA_REPO_NAME/aegir/conf/version.txt" ] ; then | |
_VERSIONS_TEST=`cat /opt/tmp/$_BOA_REPO_NAME/aegir/conf/version.txt` | |
if [[ $_VERSIONS_TEST =~ "$_INSTALLER_VERSION" ]] ; then | |
_VERSIONS_TEST_RESULT=OK | |
msg "INFO: Version test result: OK" | |
else | |
msg "ERROR: This BARRACUDA version is outdated and will not work correctly." | |
msg "Please download and use new version:" | |
msg "wget -q -U iCab http://files.aegir.cc/versions/BARRACUDA.sh.txt" | |
msg "Bye." | |
exit 1 | |
fi | |
fi | |
###--------------------### | |
if [ $_STATUS = "INIT" ] ; then | |
msg "INFO: Installing lsb-release and dnsutils now, please wait..." | |
mrun "sleep 3" | |
if ! st_runner "$_INSTALL lsb-release dnsutils"; then | |
fatal "Installation failed: $?" | |
fi | |
fi | |
###--------------------### | |
msg "STATUS: Checking your Debian or Ubuntu version..." | |
mrun "sleep 3" | |
_THIS_OS=`lsb_release -si` | |
_THIS_RV=`lsb_release -sc` | |
if [ $_THIS_OS = "Ubuntu" ] ; then | |
if [ $_THIS_RV = "natty" ] ; then | |
_REL_VERSION="natty" | |
elif [ $_THIS_RV = "maverick" ] ; then | |
_REL_VERSION="maverick" | |
elif [ $_THIS_RV = "lucid" ] ; then | |
_REL_VERSION="lucid" | |
elif [ $_THIS_RV = "karmic" ] ; then | |
_REL_VERSION="karmic" | |
_DB_SERVER=MariaDB | |
elif [ $_THIS_RV = "jaunty" ] ; then | |
_REL_VERSION="jaunty" | |
_DB_SERVER=MariaDB | |
elif [ $_THIS_RV = "hardy" ] ; then | |
_REL_VERSION="hardy" | |
_DB_SERVER=MariaDB | |
else | |
not_supported_os | |
fi | |
elif [ $_THIS_OS = "Debian" ] ; then | |
if [ $_THIS_RV = "squeeze" ] ; then | |
_REL_VERSION="squeeze" | |
elif [ $_THIS_RV = "lenny" ] ; then | |
_REL_VERSION="lenny" | |
_DB_SERVER=MariaDB | |
else | |
not_supported_os | |
fi | |
elif [ $_THIS_OS = "Jolicloud" ] ; then | |
if [ $_THIS_RV = "robby" ] ; then | |
_THIS_OS=Ubuntu | |
_REL_VERSION=jaunty | |
_DB_SERVER=MariaDB | |
else | |
not_supported_os | |
fi | |
else | |
not_supported_os | |
fi | |
echo " " | |
msg "Aegir v.$_AEGIR_VERSION with Nginx on $_THIS_OS/$_REL_VERSION - highly automated install script." | |
echo " " | |
mrun "sleep 3" | |
###--------------------### | |
if [ $_STATUS = "INIT" ] ; then | |
if [ ! -z "$_LOCAL_NETWORK_IP" ] ; then | |
if [ -z "$_LOCAL_NETWORK_HN" ] ; then | |
msg "FATAL ERROR: you must specify also _LOCAL_NETWORK_HN" | |
exit 1 | |
else | |
_DNS_SETUP_TEST=NO | |
_SMTP_RELAY_TEST=NO | |
_DEBUG_MODE=YES | |
_MY_OWNIP="$_LOCAL_NETWORK_IP" | |
_MY_HOSTN="$_LOCAL_NETWORK_HN" | |
_MY_FRONT="$_LOCAL_NETWORK_HN" | |
fi | |
fi | |
fi | |
###--------------------### | |
if [ $_STATUS = "INIT" ] ; then | |
_ETH_TEST=`ifconfig 2>&1` | |
if [[ $_ETH_TEST =~ venet0 ]] ; then | |
_VMFAMILY="VZ" | |
_IFCONFIG="venet0" | |
elif [ -e "/proc/bean_counters" ] ; then | |
_VMFAMILY="VZ" | |
_IFCONFIG="venet0" | |
else | |
_VMFAMILY="XEN" | |
_IFCONFIG="eth0" | |
fi | |
if [ ! -z "$_MY_OWNIP" ] ; then | |
if [ ! -z "$_MY_HOSTN" ] ; then | |
_S_N=$_MY_HOSTN | |
_S_T=${_S_N#*.*} | |
_S_Q=${_S_N%%${_S_T}} | |
_S_E=${_S_Q%*.*} | |
if [ ! -z "$_LOCAL_NETWORK_HN" ] ; then | |
echo "$_MY_OWNIP .$_MY_HOSTN $_S_E" >> /etc/hosts | |
else | |
_TURNED=OFF | |
#echo "$_MY_OWNIP .$_MY_HOSTN $_S_E" >> /etc/hosts | |
fi | |
hostname -v $_MY_HOSTN ### force our custom FQDN/local hostname | |
echo "$_MY_HOSTN" > /etc/hostname | |
echo "$_MY_HOSTN" > /etc/mailname | |
fi | |
_THISHTIP="$_MY_OWNIP" | |
_THISHOST="$_MY_HOSTN" | |
_LOC_DOM="$_THISHOST" | |
find_correct_ip | |
_THISRDIP="$_LOC_IP" | |
if [ "$_THISRDIP" = "$_THISHTIP" ] ; then | |
_FQDNTEST="TRUE" | |
_LOC_DOM="$_MY_FRONT" | |
find_correct_ip | |
_THEFRDIP="$_LOC_IP" | |
if [ "$_THEFRDIP" = "$_THISHTIP" ] ; then | |
_TESTHOST=`uname -n` | |
_LOC_DOM="$_TESTHOST" | |
find_correct_ip | |
_TESTRDIP="$_LOC_IP" | |
if [ "$_TESTRDIP" = "$_THISHTIP" ] ; then | |
_FQDNTEST="TRUE" | |
hostname -v $_TESTHOST | |
else | |
_FQDNTEST="FALSE" | |
fi | |
else | |
_FQDNTEST="FALSE" | |
fi | |
else | |
_FQDNTEST="FALSE" | |
fi | |
else | |
_THISHTIP=`ifconfig $_IFCONFIG | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` | |
_FQDNPROB=`uname -n 2> /dev/null` | |
_FQDNTEST="FALSE" | |
_THISHOST=`uname -n` | |
if [ ! -z "$_FQDNPROB" ] ; then | |
_THISHOST=`uname -n` | |
_LOC_DOM="$_THISHOST" | |
find_correct_ip | |
_THISRDIP="$_LOC_IP" | |
if [ "$_THISRDIP" = "$_THISHTIP" ] ; then | |
_FQDNTEST="TRUE" | |
hostname -v $_THISHOST | |
else | |
_FQDNTEST="FALSE" | |
_REVHOSTN=`host $_THISHTIP | cut -d: -f2 | awk '{ print $5}'` | |
_REVHOSTN=`echo -n $_REVHOSTN |sed 's/\(.*\)./\1/'` | |
_LOC_DOM="$_REVHOSTN" | |
find_correct_ip | |
_REVHSTIP="$_LOC_IP" | |
if [ "$_REVHSTIP" = "$_THISHTIP" ] ; then | |
hostname -v $_REVHOSTN | |
_THISHOST="$_REVHOSTN" | |
_FQDNTEST="TRUE" | |
else | |
_FQDNTEST="FALSE" | |
fi | |
fi | |
else | |
_REVHOSTN=`host $_THISHTIP | cut -d: -f2 | awk '{ print $5}'` | |
_REVHOSTN=`echo -n $_REVHOSTN |sed 's/\(.*\)./\1/'` | |
_LOC_DOM="$_REVHOSTN" | |
find_correct_ip | |
_REVHSTIP="$_LOC_IP" | |
if [ "$_REVHSTIP" = "$_THISHTIP" ] ; then | |
hostname -v $_REVHOSTN | |
_THISHOST="$_REVHOSTN" | |
_FQDNTEST="TRUE" | |
else | |
_FQDNTEST="FALSE" | |
fi | |
fi | |
fi | |
if [ ! -z "$_MY_FRONT" ] ; then | |
_THIS_FRONT="$_MY_FRONT" | |
else | |
_THIS_FRONT="$_THISHOST" | |
fi | |
if [ "$_DNS_SETUP_TEST" = "NO" ] ; then | |
_FQDNTEST=TRUE | |
fi | |
if [ $_THISHOST = "localhost" ] ; then | |
msg "FATAL ERROR: you can't use localhost as your FQDN hostname" | |
msg "Please try something like: aegir.local" | |
exit 1 | |
fi | |
if [ "$_FQDNTEST" = "FALSE" ] ; then | |
echo " " | |
msg "EXIT on error due to invalid DNS setup." | |
if [ ! -z "$_MY_OWNIP" ] ; then | |
cat <<EOF | |
* Your custom _MY_OWNIP is set to "$_MY_OWNIP" | |
* Your custom _MY_HOSTN is set to "$_MY_HOSTN" | |
* Your custom _MY_FRONT is set to "$_MY_FRONT" | |
* Your _MY_HOSTN and/or _MY_FRONT doesn't match your _MY_OWNIP, | |
or your hostname is not set properly yet. | |
* Please add/check correct line in your /etc/hosts file on the server: | |
$ echo "$_MY_OWNIP *.$_MY_HOSTN $_MY_FRONT" >> /etc/hosts | |
* Please make sure that below command returns your FQDN hostname "$_MY_HOSTN": | |
$ uname -n | |
EOF | |
fi | |
cat <<EOF | |
* Your server has to have already working FQDN hostname matching your IP address. | |
This means you _have to_ configure the dns for your server IP/hostname _before_ | |
trying to use this install script. Reverse dns is _not_ required. | |
* Your hostname appears to be $_THISHOST - are you sure it's a valid FQDN hostname? | |
* Are you sure your FQDN hostname matches your IP address: $_THISHTIP? | |
EOF | |
msg "EXIT on error due to invalid DNS setup." | |
echo " " | |
exit 1 | |
else | |
echo "$_THISHOST" > /etc/hostname | |
echo "$_THISHOST" > /etc/mailname | |
hostname -v $_THISHOST | |
msg "DNS test OK - your FQDN hostname is $_THISHOST and it matches your IP $_THISHTIP" | |
msg "Please double check whether this is a valid result of my test." | |
fi | |
mrun "sleep 3" | |
echo " " | |
msg "INSTALL START -> checkpoint: " | |
cat <<EOF | |
* Your e-mail address appears to be $_MY_EMAIL - is that correct? | |
* Your IP address appears to be $_THISHTIP - are you sure it's a valid IP? | |
* Your hostname appears to be $_THISHOST - are you sure it's a valid FQDN hostname? | |
NOTE: If your outgoing SMTP requires using relayhost, define _SMTP_RELAY_HOST first. | |
* Your Aegir Master Instance control panel will be available at https://$_THIS_FRONT. | |
* Your (optional) fast DNS cache server (pdnsd) will listen on 127.0.0.1:53. | |
* Your (optional) Bind9 DNS Server will listen on $_THISHTIP:53. | |
* Your (optional) MultiCore Apache Solr Tomcat will listen on 127.0.0.1:8080. | |
* Your (optional) Chive $_DB_SERVER Manager will be available at https://chive.$_THIS_FRONT. | |
* Your (optional) SQL Buddy $_DB_SERVER Manager will be available at https://sqlbuddy.$_THIS_FRONT. | |
* Your (optional) Collectd Graph Panel will be available at https://cgp.$_THIS_FRONT. | |
* Your (optional) Webmin Control Panel will be available at https://$_THISHOST:10000. | |
* Your (optional) csf/lfd Firewall will support integrated Nginx abuse guard. | |
NOTE: Chive, SQL Buddy and Collectd will work only if chive. sqlbuddy. and cgp. | |
subdomains point to your IP (we recommend using wildcard DNS to simplify it). | |
But don't worry, you can add proper DNS entries for those subdomains later, | |
if you didn't enable wildcard DNS yet. Barracuda can install it all now, anyway. | |
EOF | |
echo " " | |
if prompt_yes_no "Do you want to proceed with the install?" ; then | |
true | |
else | |
echo "Installation aborted by you." | |
exit 1 | |
fi | |
else ### if [ $_STATUS = "UPGRADE" ] ; then | |
_THISHOST=`cat /etc/hostname` | |
_THISHOST=`echo -n $_THISHOST | tr -d "\n"` | |
if [ -e "/var/aegir/.drush/hostmaster.alias.drushrc.php" ] ; then | |
_THIS_FRONT=`cat /var/aegir/.drush/hostmaster.alias.drushrc.php | grep "uri'" | cut -d: -f2 | awk '{ print $3}' | sed "s/[\,']//g"` | |
elif [ ! -z "$_MY_FRONT" ] ; then | |
_THIS_FRONT="$_MY_FRONT" | |
else | |
msg "EXIT on error due to not found or not specified Aegir domain." | |
msg "Please specify your previously working Aegir domain as a value of _MY_FRONT." | |
echo " " | |
exit 1 | |
fi | |
mrun "sleep 3" | |
echo " " | |
msg "UPGRADE START -> checkpoint: " | |
cat <<EOF | |
* Your e-mail address appears to be $_MY_EMAIL - is that correct? | |
* Your server hostname is $_THISHOST. | |
* Your Aegir control panel is/will be available at https://$_THIS_FRONT. | |
EOF | |
echo " " | |
if prompt_yes_no "Do you want to proceed with the upgrade?" ; then | |
true | |
else | |
echo "Upgrade aborted by you." | |
exit 1 | |
fi | |
fi | |
###--------------------### | |
if [ $_THIS_DB_HOST = "FQDN" ] ; then | |
_THIS_DB_HOST="$_THISHOST" | |
fi | |
###--------------------### | |
msg "INFO: Clean up temp files in /var/opt/" | |
mrun "sleep 3" | |
rm -f -r /var/opt/* | |
mkdir -p /var/log/php | |
chmod 777 /var/log/php* &> /dev/null | |
###--------------------### | |
install_pdnsd_cache () { | |
msg "INFO: Installing DNS cache pdnsd server, please wait..." | |
mrun "sleep 3" | |
cp -a /etc/resolv.conf /var/backups/resolv.conf.bak | |
st_runner "$_INSTALL pdnsd resolvconf"; | |
sed -i "s/START_DAEMON=no/START_DAEMON=yes/g" /etc/default/pdnsd | |
cat /opt/tmp/$_BOA_REPO_NAME/aegir/conf/pdnsd.conf > /etc/pdnsd.conf | |
st_runner "invoke-rc.d pdnsd stop" &> /dev/null | |
rm -f /var/cache/pdnsd/pdnsd.cache | |
st_runner "invoke-rc.d pdnsd start" &> /dev/null | |
mrun "sleep 3" | |
st_runner "invoke-rc.d pdnsd stop" &> /dev/null | |
mrun "sleep 3" | |
rm -f /var/cache/pdnsd/pdnsd.cache | |
st_runner "invoke-rc.d pdnsd start" &> /dev/null | |
} | |
_INSTALL_PDNSD=NO | |
_HOSTN_TEST=`hostname -f 2>&1` | |
if [[ $_HOSTN_TEST =~ "Name or service not known" ]] ; then | |
_INSTALL_PDNSD=YES | |
fi | |
if [[ $_HOSTN_TEST =~ "Temporary failure in name resolution" ]] ; then | |
_INSTALL_PDNSD=YES | |
fi | |
if [ ! -z "$_LOCAL_NETWORK_HN" ] ; then | |
_INSTALL_PDNSD=YES | |
fi | |
if [ -f "/etc/default/dhcpcd" ] ; then | |
_INSTALL_PDNSD=YES | |
sed -i "s/SET_DNS/\#SET_DNS/g" /etc/default/dhcpcd | |
sed -i "s/SET_HOSTNAME/\#SET_HOSTNAME/g" /etc/default/dhcpcd | |
fi | |
if [ ! -e "/usr/sbin/pdnsd" ] ; then | |
if [ $_INSTALL_PDNSD = "NO" ] && [ ! -e "/var/run/cloud_vhost.pid" ] ; then | |
if [ "$_XTRAS_LIST" = "ALL" ] || [[ $_XTRAS_LIST =~ PDS ]] ; then | |
echo " " | |
if prompt_yes_no "Do you want to install fast DNS cache pdnsd server?" ; then | |
true | |
install_pdnsd_cache | |
msg "INFO: DNS cache pdnsd server installation completed" | |
mrun "sleep 2" | |
else | |
msg "INFO: DNS cache pdnsd server installation skipped" | |
mrun "sleep 2" | |
fi | |
fi | |
elif [ $_INSTALL_PDNSD = "YES" ] ; then | |
install_pdnsd_cache | |
fi | |
fi | |
###--------------------### | |
if [ -e "/var/log/apt-fast-install-log.txt" ] ; then | |
_APT_SOURCES_REWRITE=NO | |
if [ ! -z "$_LOCAL_DEBIAN_MIRROR" ] ; then | |
_APT_SOURCES_REWRITE=YES | |
fi | |
if [ ! -z "$_LOCAL_UBUNTU_MIRROR" ] ; then | |
_APT_SOURCES_REWRITE=YES | |
fi | |
else | |
_APT_SOURCES_REWRITE=YES | |
fi | |
if [ $_APT_SOURCES_REWRITE = "YES" ] ; then | |
msg "INFO: Update apt sources" | |
mrun "sleep 3" | |
mv -f /etc/apt/sources.list /var/backups/sources.list-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
if [ "$_THIS_OS" = "Ubuntu" ] ; then | |
if [ -z "$_LOCAL_UBUNTU_MIRROR" ] ; then | |
msg "INFO: Now looking for the best/fastest $_THIS_OS mirror, it can take a while, please wait..." | |
mrun "sleep 3" | |
cd /opt/tmp/$_BOA_REPO_NAME/aegir/helpers | |
_MIRROR=`bash ffmirror.sh.txt < apt-list-ubuntu.txt` | |
_MIRROR=`bash ffmirror.sh.txt < apt-list-ubuntu.txt` | |
echo " " | |
prompt_confirm_choice "Enter your own mirror to use or press enter to use the fastest found mirror" $_MIRROR | |
echo " " | |
_MIRROR=$_CONFIRMED_ANSWER | |
else | |
_MIRROR=$_LOCAL_UBUNTU_MIRROR | |
fi | |
if ! netcat -w 5 -z $_MIRROR 80 ; then | |
msg "INFO: The mirror $_MIRROR doesn't respond now, let's try default" | |
_MIRROR=archive.ubuntu.com | |
fi | |
msg "INFO: We will use $_THIS_OS mirror $_MIRROR" | |
cd /var/opt | |
mrun "sleep 3" | |
echo "## MAIN REPOSITORIES" > /etc/apt/sources.list | |
echo "deb http://$_MIRROR/ubuntu/ $_REL_VERSION main restricted universe multiverse" >> /etc/apt/sources.list | |
echo "deb-src http://$_MIRROR/ubuntu/ $_REL_VERSION main restricted universe multiverse" >> /etc/apt/sources.list | |
echo "" >> /etc/apt/sources.list | |
echo "## MAJOR BUG FIX UPDATES produced after the final release" >> /etc/apt/sources.list | |
echo "deb http://$_MIRROR/ubuntu/ $_REL_VERSION-updates main restricted universe multiverse" >> /etc/apt/sources.list | |
echo "deb-src http://$_MIRROR/ubuntu/ $_REL_VERSION-updates main restricted universe multiverse" >> /etc/apt/sources.list | |
echo "" >> /etc/apt/sources.list | |
echo "## UBUNTU SECURITY UPDATES" >> /etc/apt/sources.list | |
echo "deb http://security.ubuntu.com/ubuntu $_REL_VERSION-security main restricted universe multiverse" >> /etc/apt/sources.list | |
echo "deb-src http://security.ubuntu.com/ubuntu $_REL_VERSION-security main restricted universe multiverse" >> /etc/apt/sources.list | |
elif [ "$_THIS_OS" = "Debian" ] ; then | |
if [ -z "$_LOCAL_DEBIAN_MIRROR" ] ; then | |
msg "INFO: Now looking for the best/fastest $_THIS_OS mirror, it can take a while, please wait..." | |
mrun "sleep 3" | |
cd /opt/tmp/$_BOA_REPO_NAME/aegir/helpers | |
_MIRROR=`bash ffmirror.sh.txt < apt-list-debian.txt` | |
_MIRROR=`bash ffmirror.sh.txt < apt-list-debian.txt` | |
echo " " | |
prompt_confirm_choice "Enter your own mirror to use or press enter to use the fastest found mirror" $_MIRROR | |
echo " " | |
_MIRROR=$_CONFIRMED_ANSWER | |
else | |
_MIRROR=$_LOCAL_DEBIAN_MIRROR | |
fi | |
if ! netcat -w 5 -z $_MIRROR 80 ; then | |
msg "INFO: The mirror $_MIRROR doesn't respond now, let's try default" | |
_MIRROR=ftp.debian.org | |
fi | |
msg "INFO: We will use $_THIS_OS mirror $_MIRROR" | |
cd /var/opt | |
mrun "sleep 3" | |
echo "deb http://$_MIRROR/debian/ $_REL_VERSION main contrib non-free" > /etc/apt/sources.list | |
echo "deb-src http://$_MIRROR/debian/ $_REL_VERSION main contrib non-free" >> /etc/apt/sources.list | |
echo "deb http://security.debian.org/ $_REL_VERSION/updates main contrib non-free" >> /etc/apt/sources.list | |
echo "deb-src http://security.debian.org/ $_REL_VERSION/updates main contrib non-free" >> /etc/apt/sources.list | |
if [ "$_REL_VERSION" = "lenny" ] ; then | |
echo "deb http://volatile.debian.org/debian-volatile $_REL_VERSION/volatile main contrib non-free" >> /etc/apt/sources.list | |
echo "deb-src http://volatile.debian.org/debian-volatile $_REL_VERSION/volatile main contrib non-free" >> /etc/apt/sources.list | |
fi | |
fi | |
cd /var/log | |
echo "`date` / `lsb_release -si`.`lsb_release -sc` `uname -m` $_VMFAMILY / Aegir $_AEGIR_VERSION / Barracuda $_INSTALLER_VERSION$_FORCE_GIT_MIRROR / Nginx $_NGINX_VERSION / PHP $_PHP_VERSION / $_DB_SERVER $_THIS_DB_HOST / SpeedWild $_USE_SPEED_BOOSTER-$_HTTP_WILDCARD" >> ./apt-fast-install-log.txt | |
cd /var/opt | |
fi | |
###--------------------### | |
if [ -d "/etc/webmin" ] ; then | |
if [ ! -e "/var/log/webmin_new_apt.log" ] ; then | |
msg "INFO: Fix for new Webmin Control Panel apt key, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
wget -q -U iCab http://www.webmin.com/jcameron-key.asc | |
apt-key add jcameron-key.asc &> /dev/null | |
touch /var/log/webmin_new_apt.log | |
fi | |
fi | |
###--------------------### | |
msg "INFO: Run apt update, please wait..." | |
st_runner "dpkg --configure --force-all -a" 2> /dev/null | |
st_runner "aptitude update -y" 2> /dev/null | |
_DB_SERVER_TEST=`mysql -V 2>&1` | |
if [ "$_STATUS" = "INIT" ] ; then | |
st_runner "aptitude safe-upgrade -y" 2> /dev/null | |
st_runner "aptitude update -y" 2> /dev/null | |
st_runner "aptitude clean -y" 2> /dev/null | |
st_runner "aptitude full-upgrade -y" 2> /dev/null | |
st_runner "aptitude autoclean -y" 2> /dev/null | |
else | |
if [ -e "/var/lib/mysql/debian-5.5.flag" ] ; then | |
rm -f /var/lib/mysql/debian-5.5.flag &> /dev/null | |
fi | |
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 1BB943DB &> /dev/null | |
fi | |
###--------------------### | |
msg "INFO: Install/upgrade required libraries and tools" | |
msg "NOTE: This step can take a few minutes (depending on your server speed), please wait..." | |
if [ "$_REL_VERSION" = "lenny" ] ; then | |
DEBDEPS="apticron aptitude autoconf2.13 automake automake1.4 autotools-dev bc bison build-essential cron curl cvs defoma devscripts dnsutils dstat flex fontconfig-config ghostscript gnupg imagemagick htop ifstat iptables lemon libapr1 libaprutil1 libc-client-dev libc-client2007b libc-client2007b-dev libcurl4-openssl-dev libfilesys-diskspace-perl libfontconfig1 libfreetype6 libfreetype6-dev libfribidi0 libgd2-xpm libhtml-template-perl libjpeg-dev libjpeg62 libmcrypt-dev libmemcache-dev libnet-daemon-perl libpcre3 libpcre3-dev libplrpc-perl libpng12-dev libpng12-0 libpq5 libsasl2-modules libssl-dev libt1-5 libt1-dev libtool libwww-perl libxml2-dev libxpm4 libxslt-dev libxslt1-dbg libxslt1-dev libxslt1.1 lftp m4 makepasswd mc mcrypt nano netcat nginx ncurses-dev openjdk-6-jdk postfix postfix-pcre pwgen python-dev re2c rsync shtool ssh ssl-cert subversion sudo sysstat sysvconfig t1lib-bin telnet time ttf-dejavu ttf-dejavu-core ttf-dejavu-extra vim whois xml-core xml2 zlib1g-dev zlibc unzip zip xpdf catdoc unrtf pdftk libterm-readkey-perl rrdtool libpam-umask ntpdate p7zip-full sipcalc rsyslog libgmp3-dev" | |
elif [ "$_REL_VERSION" = "squeeze" ] || [ "$_REL_VERSION" = "lucid" ] || [ "$_REL_VERSION" = "maverick" ] || [ "$_REL_VERSION" = "natty" ]; then | |
DEBDEPS="apticron aptitude autoconf2.13 automake automake1.4 autotools-dev bc bison build-essential cron curl cvs defoma devscripts dnsutils dstat flex fontconfig-config ghostscript gnupg imagemagick htop ifstat iptables libapr1 lemon libaprutil1 libc-client-dev libc-client2007e libc-client2007e-dev libcurl4-openssl-dev libfilesys-diskspace-perl libfontconfig1 libfreetype6 libfreetype6-dev libfribidi0 libgd2-xpm libhtml-template-perl libjpeg-dev libjpeg62 libmcrypt-dev libmemcache-dev libnet-daemon-perl libpcre3 libpcre3-dev libplrpc-perl libpng12-0 libpng12-dev libpq5 libsasl2-modules libssl-dev libt1-5 libt1-dev libtool libwww-perl libxml2-dev libxpm4 libxslt-dev libxslt1-dbg libxslt1-dev libxslt1.1 lftp m4 makepasswd mc mcrypt nano netcat ncurses-dev nginx openjdk-6-jdk postfix postfix-pcre pwgen python-dev re2c redis-server rsync shtool ssh ssl-cert subversion sudo sysstat sysvinit-utils t1lib-bin telnet time ttf-dejavu ttf-dejavu-core ttf-dejavu-extra unzip vim whois xml-core xml2 zip zlib1g-dev zlibc xpdf catdoc unrtf pdftk libterm-readkey-perl rrdtool libpam-umask ntpdate p7zip-full sipcalc rsyslog libgmp3-dev" | |
else | |
DEBDEPS="apticron aptitude autoconf2.13 automake automake1.4 autotools-dev bc bison build-essential cron curl cvs defoma devscripts dnsutils dstat flex fontconfig-config ghostscript gnupg imagemagick htop ifstat iptables lemon libapr1 libaprutil1 libc-client-dev libc-client2007b libc-client2007b-dev libcurl4-openssl-dev libfilesys-diskspace-perl libfontconfig1 libfreetype6 libfreetype6-dev libfribidi0 libgd2-xpm libhtml-template-perl libjpeg-dev libjpeg62 libmcrypt-dev libmemcache-dev libnet-daemon-perl libpcre3 libpcre3-dev libplrpc-perl libpng12-dev libpng12-0 libpq5 libsasl2-modules libssl-dev libt1-5 libt1-dev libtool libwww-perl libxml2-dev libxpm4 libxslt-dev libxslt1-dbg libxslt1-dev libxslt1.1 lftp m4 makepasswd mc mcrypt nano netcat nginx ncurses-dev openjdk-6-jdk postfix postfix-pcre pwgen python-dev re2c rsync shtool ssh ssl-cert subversion sudo sysstat sysvinit-utils t1lib-bin telnet time ttf-dejavu ttf-dejavu-core ttf-dejavu-extra vim whois xml-core xml2 zlib1g-dev zlibc unzip zip xpdf catdoc unrtf pdftk libterm-readkey-perl rrdtool libpam-umask ntpdate p7zip-full sipcalc rsyslog libgmp3-dev" | |
fi | |
if [ "$_REL_VERSION" = "squeeze" ] || [ "$_REL_VERSION" = "maverick" ] || [ "$_REL_VERSION" = "natty" ]; then | |
_INSTALL="aptitude -y install" | |
fi | |
install_with_apt_deps () { | |
if ! st_runner "$_INSTALL $DEBDEPS" &> /dev/null; then | |
fatal "Installation failed: $?" | |
fi | |
return 0 | |
} | |
install_percona_sql () { | |
cd /var/opt | |
gpg --keyserver hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A &> /dev/null | |
gpg -a --export CD2EFD2A | apt-key add - &> /dev/null | |
if [ "$_REL_VERSION" = "natty" ] ; then | |
_THIS_REL_VERSION=maverick | |
else | |
_THIS_REL_VERSION="$_REL_VERSION" | |
fi | |
echo "## Percona APT Repository" > /etc/apt/sources.list.d/percona.list | |
echo "deb http://repo.percona.com/apt $_THIS_REL_VERSION main" >> /etc/apt/sources.list.d/percona.list | |
echo "deb-src http://repo.percona.com/apt $_THIS_REL_VERSION main" >> /etc/apt/sources.list.d/percona.list | |
if [ "$_SQL_UPGRADE" = "YES" ] ; then | |
st_runner "apt-get autoremove -y" &> /dev/null | |
st_runner "apt-get remove mysql-common -y" &> /dev/null | |
st_runner "apt-get purge mysql-common -y" &> /dev/null | |
fi | |
st_runner "apt-get update -y" &> /dev/null | |
SQLDEB="percona-server-server-5.5" | |
SQLADD="libmysqlclient-dev libmysqld-dev libdbd-mysql-perl python-mysqldb libdbi-perl" | |
} | |
install_mariadb_sql () { | |
cd /var/opt | |
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 1BB943DB &> /dev/null | |
if [ $_THIS_OS = "Debian" ] ; then | |
_THIS_OS_NAME=debian | |
elif [ $_THIS_OS = "Ubuntu" ] ; then | |
_THIS_OS_NAME=ubuntu | |
fi | |
echo "## MariaDB APT Repository" > /etc/apt/sources.list.d/mariadb.list | |
echo "deb http://ftp.osuosl.org/pub/mariadb/repo/5.2/$_THIS_OS_NAME $_REL_VERSION main" >> /etc/apt/sources.list.d/mariadb.list | |
echo "deb-src http://ftp.osuosl.org/pub/mariadb/repo/5.2/$_THIS_OS_NAME $_REL_VERSION main" >> /etc/apt/sources.list.d/mariadb.list | |
st_runner "apt-get autoremove -y" &> /dev/null | |
st_runner "apt-get remove mysql-common -y" &> /dev/null | |
st_runner "apt-get purge mysql-common -y" &> /dev/null | |
st_runner "apt-get update -y" &> /dev/null | |
SQLDEB="mariadb-server-5.2 mariadb-client-5.2 mariadb-common" | |
SQLADD="libmariadbclient-dev libmariadbclient16 libmariadbd-dev libdbd-mysql-perl python-mysqldb libdbi-perl" | |
} | |
install_with_apt_sql () { | |
if [ "$_REL_VERSION" = "squeeze" ] || [ "$_REL_VERSION" = "lucid" ] || [ "$_REL_VERSION" = "maverick" ] || [ "$_REL_VERSION" = "natty" ] ; then | |
_PERCONA_READY=YES | |
else | |
_PERCONA_READY=NO | |
fi | |
if [ "$_PERCONA_READY" = "YES" ] && [ "$_DB_SERVER" = "Percona" ] ; then | |
install_percona_sql | |
else | |
install_mariadb_sql | |
fi | |
if [ "$_REL_VERSION" = "natty" ] ; then | |
st_runner "$_LOCAL_INSTALL $SQLDEB" &> /dev/null | |
st_runner "apt-get autoremove -y" &> /dev/null | |
st_runner "apt-get update -y" &> /dev/null | |
st_runner "$_LOCAL_INSTALL $SQLDEB" &> /dev/null | |
st_runner "$_LOCAL_INSTALL $SQLADD" &> /dev/null | |
st_runner "$_LOCAL_INSTALL $SQLDEB" &> /dev/null | |
else | |
st_runner "$_LOCAL_INSTALL $SQLDEB" &> /dev/null | |
st_runner "apt-get autoremove -y" &> /dev/null | |
st_runner "apt-get update -y" &> /dev/null | |
st_runner "$_LOCAL_INSTALL $SQLDEB" &> /dev/null | |
st_runner "$_LOCAL_INSTALL $SQLADD" &> /dev/null | |
st_runner "$_LOCAL_INSTALL $SQLDEB" &> /dev/null | |
fi | |
} | |
st_runner "$_INSTALL $DEBDEPS" 2> /dev/null | |
fix_locales | |
if [ "$_STATUS" = "INIT" ] ; then | |
_LOCAL_INSTALL="aptitude -y install" | |
install_with_apt_sql | |
else | |
_SQL_UPGRADE=NO | |
if [ "$_SQL_FORCE_REINSTALL" = "YES" ] ; then | |
_SQL_UPGRADE=YES | |
elif [[ $_DB_SERVER_TEST =~ MariaDB ]] && [ "$_DB_SERVER" = "Percona" ] ; then | |
_SQL_UPGRADE=YES | |
elif [[ $_DB_SERVER_TEST =~ 5.1.49-MariaDB ]] || [[ $_DB_SERVER_TEST =~ 5.2.7-MariaDB ]] ; then | |
_SQL_UPGRADE=YES | |
fi | |
if [ "$_SQL_UPGRADE" = "YES" ] ; then | |
invoke-rc.d cron stop &> /dev/null | |
invoke-rc.d lfd stop &> /dev/null | |
invoke-rc.d csf stop &> /dev/null | |
invoke-rc.d csf stop &> /dev/null | |
msg "INFO: Running $_DB_SERVER upgrade and then PHP-FPM forced rebuild, please wait..." | |
mrun "sleep 50" | |
invoke-rc.d php-fpm stop &> /dev/null | |
mrun "sleep 10" | |
if [ "$_DB_SERVER" = "Percona" ] ; then | |
rm -f /etc/apt/sources.list.d/mariadb.list | |
rm -f /etc/apt/sources.list.d/ourdelta.list | |
st_runner "apt-get update -y" 2> /dev/null | |
st_runner "apt-get clean -y --force-yes" 2> /dev/null | |
elif [ "$_DB_SERVER" = "MariaDB" ] ; then | |
rm -f /etc/apt/sources.list.d/ourdelta.list | |
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 1BB943DB &> /dev/null | |
st_runner "apt-get update -y" 2> /dev/null | |
st_runner "apt-get clean -y --force-yes" 2> /dev/null | |
fi | |
_LOCAL_INSTALL="/usr/bin/apt-get -y --force-yes --config-file /opt/tmp/apt.conf.noninteractive install" | |
cp -af /etc/mysql/debian-start /etc/mysql/debian-start-mariadb &> /dev/null | |
sed -i "s/default-table-type/\#default-table-type/g" /etc/mysql/my.cnf | |
sed -i "s/language/\#language/g" /etc/mysql/my.cnf | |
rm -f /var/lib/mysql/debian-5.1.flag &> /dev/null | |
rm -f /var/lib/mysql/debian-5.2.flag &> /dev/null | |
rm -f /var/lib/mysql/mysql_upgrade_info &> /dev/null | |
install_with_apt_sql | |
_PHP_FORCE_REINSTALL=YES | |
invoke-rc.d lfd start &> /dev/null | |
invoke-rc.d csf start &> /dev/null | |
invoke-rc.d php-fpm start &> /dev/null | |
else | |
_LOCAL_INSTALL="aptitude -y install" | |
fi | |
fi | |
###--------------------### | |
msg "INFO: Run apt update again, please wait..." | |
st_runner "dpkg --configure --force-all -a" 2> /dev/null | |
st_runner "aptitude update -y" 2> /dev/null | |
st_runner "aptitude clean -y" 2> /dev/null | |
if [ "$_THIS_OS" = "Ubuntu" ] ; then | |
st_runner "aptitude safe-upgrade -y" 2> /dev/null | |
fix_locales | |
st_runner "aptitude autoclean -y" 2> /dev/null | |
st_runner "aptitude full-upgrade -y" 2> /dev/null | |
fix_locales | |
elif [ "$_THIS_OS" = "Debian" ] ; then | |
st_runner "aptitude full-upgrade -y" 2> /dev/null | |
fix_locales | |
fi | |
###--------------------### | |
msg "INFO: Run apt update again, please wait..." | |
st_runner "dpkg --configure --force-all -a" 2> /dev/null | |
st_runner "aptitude update -y" 2> /dev/null | |
st_runner "aptitude clean -y" 2> /dev/null | |
if [ "$_THIS_OS" = "Ubuntu" ] ; then | |
st_runner "aptitude safe-upgrade -y" 2> /dev/null | |
st_runner "aptitude autoclean -y" 2> /dev/null | |
st_runner "aptitude full-upgrade -y" 2> /dev/null | |
elif [ "$_THIS_OS" = "Debian" ] ; then | |
st_runner "aptitude full-upgrade -y" 2> /dev/null | |
fi | |
st_runner "$_INSTALL $DEBDEPS" 2> /dev/null | |
###--------------------### | |
if [ $_REL_VERSION = "natty" ] ; then | |
if [ ! -L "/usr/lib/libpng.so" ] ; then | |
msg "INFO: Fix for libs in Ubuntu Natty, please wait..." | |
_X86_64_TEST=`uname -m` | |
if [ "$_X86_64_TEST" = "x86_64" ] ; then | |
ln -s /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/libpng.so | |
ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/libjpeg.so | |
ln -s /usr/lib/x86_64-linux-gnu/libkrb5.so /usr/lib/libkrb5.so | |
else | |
ln -s /usr/lib/i386-linux-gnu/libpng.so /usr/lib/libpng.so | |
ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib/libjpeg.so | |
ln -s /usr/lib/i386-linux-gnu/libkrb5.so /usr/lib/libkrb5.so | |
fi | |
fi | |
fi | |
###--------------------### | |
if [ "$_THIS_OS" = "Debian" ] ; then | |
msg "INFO: Fix for broken git-core after upgrade to version: 1:1.5.6.5-3+lenny3.1 on Lenny 32bit" | |
mrun "sleep 3" | |
chmod 644 /usr/share/git-core/templates/description &> /dev/null | |
chmod 644 /usr/share/git-core/templates/hooks/* &> /dev/null | |
chmod 644 /usr/share/git-core/templates/info/* &> /dev/null | |
fi | |
###--------------------### | |
if [ ! -e "/var/run/cloud_vhost.pid" ] && [ ! -e "/sbin/udevd" ] ; then | |
msg "INFO: Install udev, just in case it is missing, please wait..." | |
mrun "sleep 3" | |
st_runner "apt-get -y install udev" 2> /dev/null | |
fi | |
###--------------------### | |
if [ -z "$_SMTP_RELAY_HOST" ] && [ "$_SMTP_RELAY_TEST" = "YES" ] ; then | |
msg "INFO: SMTP check" | |
mrun "sleep 3" | |
if ! netcat -w 8 -z smtp.postoffice.net 25 ; then | |
WE_NEED_RELAY="YES" | |
cat <<EOF | |
Your outgoing SMTP port 25 doesn't work | |
as expected, so your server can't send out | |
any e-mails directly. | |
It appears you need a SMTP relayhost added | |
in your Postfix /etc/postfix/main.cf config. | |
Please enter your SMTP relay host name | |
as a value for _SMTP_RELAY_HOST="smtp.your.relay.server" | |
Then run this script again. | |
EOF | |
exit 1 | |
else | |
true | |
fi | |
### | |
### required if you have closed outgoing smtp port and you have to use smtp relay | |
### | |
if [ ! -z "$_SMTP_RELAY_HOST" ]; then | |
sed -i "s/$_SMTP_RELAY_HOST//g" /etc/postfix/main.cf | |
sed -i "s/relayhost =/relayhost = $_SMTP_RELAY_HOST/g" /etc/postfix/main.cf | |
postfix reload &> /dev/null | |
fi | |
### | |
### | |
fi | |
###--------------------### | |
msg "INFO: Fix for Nginx startup script, please wait..." | |
mrun "sleep 3" | |
_X_INIT_TEST=`cat /etc/init.d/nginx 2>&1` | |
if [[ $_X_INIT_TEST =~ Barracuda ]] ; then | |
true | |
msg "INFO: No fix required" | |
sed -i "s/sleep 5/sleep 1/g" /etc/init.d/nginx | |
else | |
cd /etc/init.d | |
mv -f /etc/init.d/nginx /var/backups/nginx-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/nginx ./ | |
chmod 755 /etc/init.d/nginx &> /dev/null | |
msg "INFO: Fix for Nginx startup script applied" | |
fi | |
###--------------------### | |
if [ ! -e "/usr/bin/redis-server" ] ; then | |
if [ "$_REL_VERSION" = "robby" ] ; then | |
install_redis_src | |
fi | |
if [ "$_REL_VERSION" = "lenny" ] ; then | |
install_redis_src | |
fi | |
fi | |
if [ ! -e "/var/log/redis-2.0.5.log" ] ; then | |
install_redis_src | |
fi | |
###--------------------### | |
if [ ! -e "/var/run/cloud_vhost.pid" ] ; then | |
if [ ! -e "/usr/bin/vnstat" ] ; then | |
msg "INFO: Installing VnStat monitor, please wait..." | |
_ETH_TEST=`ifconfig 2>&1` | |
if [[ $_ETH_TEST =~ venet0 ]] ; then | |
_VMFAMILY="VZ" | |
_IFCONFIG="venet0" | |
elif [ -e "/proc/bean_counters" ] ; then | |
_VMFAMILY="VZ" | |
_IFCONFIG="venet0" | |
else | |
_VMFAMILY="XEN" | |
_IFCONFIG="eth0" | |
fi | |
cd /var/opt | |
wget -q -U iCab http://humdi.net/vnstat/vnstat-1.10.tar.gz | |
tar -xzf vnstat-1.10.tar.gz | |
cd vnstat-1.10 | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
st_runner "vnstat -u -i $_IFCONFIG" 2> /dev/null | |
cd /etc/init.d | |
cp -af /var/opt/vnstat-1.10/examples/init.d/debian/vnstat ./ | |
chmod 755 vnstat &> /dev/null | |
st_runner "update-rc.d vnstat defaults" &> /dev/null | |
st_runner "invoke-rc.d vnstat start" &> /dev/null | |
fi | |
fi | |
if [ -e "/etc/init.d/vnstat" ] && [ "$_VMFAMILY" = "VS" ] && [ ! -d "/boot/grub" ] ; then | |
invoke-rc.d vnstat stop &> /dev/null | |
update-rc.d -f vnstat remove &> /dev/null | |
rm -f /etc/init.d/vnstat | |
rm -f /usr/bin/vnstat | |
rm -f -r /var/lib/vnstat | |
fi | |
###--------------------### | |
msg "INFO: Install/upgrade a few more tools, please wait..." | |
mrun "sleep 3" | |
cd /var | |
if [ -d "/var/xdrago" ] ; then | |
fix_on_upgrade | |
cd /var | |
mkdir -p /var/backups/dragon/x | |
mkdir -p /var/backups/dragon/z | |
mv -f /var/xdrago-pre* /var/backups/dragon/x/ &> /dev/null | |
rm -f -r /var/xdrago/log/init.d-pre* | |
rm -f -r /var/backups/dragon/z/init.d-pre-* | |
rm -f /var/xdrago/log/cron-root-pre* | |
cp -af /var/xdrago /var/backups/dragon/x/xdrago-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
rm -f /var/xdrago/log/VISITOR_ABUSE_ONE.log | |
rm -f /var/xdrago/log/blackIP.log | |
rm -f /var/xdrago/{enableStatus,graceful,move_sql,run_all,second,Minute,firewall.sh,stop-mysql-innodb.sh,firewall_restarter,FireStart,memcache,redis} | |
cp -af /var/spool/cron/crontabs/root /var/backups/dragon/z/cron-root-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/tools/auto-healing-monitoring/* /var/xdrago/ &> /dev/null | |
if [ -z "$_THISHTIP" ] ; then | |
_LOC_DOM="$_THISHOST" | |
find_correct_ip | |
_THISHTIP="$_LOC_IP" | |
fi | |
sed -i "s/88.88.88.88/$_THISHTIP/g" /var/xdrago/firewall/check/scan_nginx | |
cp -af /var/xdrago/cron/crontabs/root /var/spool/cron/crontabs/ &> /dev/null | |
chown root:crontab /var/spool/cron/crontabs/root | |
chmod 600 /var/spool/cron/crontabs/root | |
if [[ "$_THISHOST" =~ ".host8." ]] ; then | |
sed -i "s/critnumber = 300/critnumber = 222/g" /var/xdrago/firewall/check/scan_nginx | |
sed -i "s/600/300/g" /var/xdrago/minute.sh | |
sed -i "s/\* \* \* \* \* bash \/var\/xdrago\/runner.sh/*\/2 * * * * bash \/var\/xdrago\/runner.sh/g" /var/spool/cron/crontabs/root | |
sed -i "s/rotate 52/rotate 1/g" /etc/logrotate.d/nginx | |
rm -f /etc/logrotate.d/lshell | |
if [ -e "/usr/share/man/man3/buagent.3.gz" ] ; then | |
chmod 644 /usr/share/man/man3/buagent.3.gz | |
fi | |
else | |
sed -i "s/600/900/g" /var/xdrago/minute.sh | |
sed -i "s/log\/lshell/log\/lsh/g" /etc/logrotate.d/lshell &> /dev/null | |
sed -i "s/rm -f -r \/tmp/#rm -f -r \/tmp/g" /var/xdrago/graceful.sh | |
sed -i "s/rm -f -r \/tmp/true\n#rm -f -r \/tmp/g" /var/xdrago/clear.sh | |
fi | |
fi | |
if [ $_STATUS = "INIT" ] ; then | |
mkdir -p ./xdrago | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/tools/auto-healing-monitoring/* ./xdrago/ &> /dev/null | |
mkdir -p /opt/etc | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/php.ini /opt/etc/php.ini &> /dev/null | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/php-fpm.conf /opt/etc/php-fpm.conf &> /dev/null | |
cp -af /var/xdrago/cron/crontabs/root /var/spool/cron/crontabs/ &> /dev/null | |
chown root:crontab /var/spool/cron/crontabs/root | |
chmod 600 /var/spool/cron/crontabs/root | |
sed -i "s/>127.0.0.1</\>127.0.0.1,$_THISHTIP\</g" /opt/etc/php-fpm.conf | |
sed -i "s/max_children\">1/max_children\"\>4/g" /opt/etc/php-fpm.conf | |
if [ -z "$_THISHTIP" ] ; then | |
_LOC_DOM="$_THISHOST" | |
find_correct_ip | |
_THISHTIP="$_LOC_IP" | |
fi | |
sed -i "s/88.88.88.88/$_THISHTIP/g" /var/xdrago/firewall/check/scan_nginx | |
if [[ "$_THISHOST" =~ ".host8." ]] ; then | |
sed -i "s/critnumber = 300/critnumber = 222/g" /var/xdrago/firewall/check/scan_nginx | |
sed -i "s/600/300/g" /var/xdrago/minute.sh | |
sed -i "s/\* \* \* \* \* bash \/var\/xdrago\/runner.sh/*\/2 * * * * bash \/var\/xdrago\/runner.sh/g" /var/spool/cron/crontabs/root | |
sed -i "s/rotate 52/rotate 1/g" /etc/logrotate.d/nginx | |
rm -f /etc/logrotate.d/lshell | |
if [ -e "/usr/share/man/man3/buagent.3.gz" ] ; then | |
chmod 644 /usr/share/man/man3/buagent.3.gz | |
fi | |
else | |
sed -i "s/600/900/g" /var/xdrago/minute.sh | |
sed -i "s/rm -f -r \/tmp/#rm -f -r \/tmp/g" /var/xdrago/graceful.sh | |
sed -i "s/rm -f -r \/tmp/true\n#rm -f -r \/tmp/g" /var/xdrago/clear.sh | |
fi | |
fi | |
if [ -d "/var/xdrago-pre-$_INSTALLER_VERSION-$_NOW" ] ; then | |
cp -af /var/xdrago-pre-$_INSTALLER_VERSION-$_NOW/run-* /var/xdrago/ &> /dev/null | |
fi | |
chmod 700 /var/xdrago/* &> /dev/null | |
chmod 700 /var/xdrago &> /dev/null | |
###--------------------### | |
if [ ! -e "/var/log/fixed-libevent-2.0.11-stable.log" ] ; then | |
msg "INFO: Installing libevent, please wait..." | |
rm -f -r /var/opt/libevent* | |
cd /var/opt | |
wget -q -U iCab http://files.aegir.cc/dev/libevent-2.0.11-stable.tar.gz | |
tar -xzf libevent-2.0.11-stable.tar.gz | |
cd /var/opt/libevent-2.0.11-stable | |
st_runner "sh ./configure --prefix=/usr" 2> /dev/null | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
rm -f -r /var/opt/libevent* | |
cd /var/opt | |
wget -q -U iCab http://files.aegir.cc/dev/libevent-2.0.11-stable.tar.gz | |
tar -xzf libevent-2.0.11-stable.tar.gz | |
cd /var/opt/libevent-2.0.11-stable | |
st_runner "sh ./configure" 2> /dev/null | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
st_runner "ldconfig" 2> /dev/null | |
_PHP_FORCE_REINSTALL=YES | |
if [ $_STATUS = "UPGRADE" ] ; then | |
msg "INFO: PHP rebuild required to include newer libevent and memcached" | |
fi | |
echo "libevent-2.0.11-stable" > /var/log/fixed-libevent-2.0.11-stable.log | |
fi | |
###--------------------### | |
if [ ! -e "/var/log/memcached-1.6.0_beta1.log" ] ; then | |
msg "INFO: Installing Memcached server, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
rm -f /opt/bin/memcached | |
rm -f /usr/bin/memcached | |
rm -f /usr/local/bin/memcached | |
wget -q -U iCab http://memcached.googlecode.com/files/memcached-1.6.0_beta1.tar.gz | |
tar -xzf memcached-1.6.0_beta1.tar.gz | |
cd /var/opt/memcached-1.6.0_beta1 | |
st_runner "sh ./configure" 2> /dev/null | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
ln -s /usr/local/bin/memcached /usr/bin/memcached | |
echo "memcached-1.6.0_beta1" > /var/log/memcached-1.6.0_beta1.log | |
fi | |
###--------------------### | |
msg "INFO: PHP installed version auto-discovering now, please wait..." | |
mrun "sleep 3" | |
if [ -e "/usr/local/bin/php" ] ; then | |
_PHP_INSTALLED=`/usr/local/bin/php -v | grep 'PHP 5' | cut -d: -f1 | awk '{ print $2}'` | |
if [ "$_PHP_INSTALLED" = "$_PHP_VERSION" ] ; then | |
_PHP_INSTALL_REQUIRED=NO | |
msg "INFO: Installed PHP version $_PHP_INSTALLED, no upgrade required" | |
else | |
_PHP_INSTALL_REQUIRED=YES | |
msg "INFO: Installed PHP version $_PHP_INSTALLED, upgrade required" | |
fi | |
mrun "sleep 3" | |
else | |
_PHP_INSTALL_REQUIRED=YES | |
fi | |
if [ ! -e "/var/log/libcurl4-openssl-dev.log" ] ; then | |
_PHP_INSTALL_REQUIRED=YES | |
if [ $_STATUS = "UPGRADE" ] ; then | |
msg "INFO: PHP rebuild required to include libcurl4-openssl-dev" | |
mrun "sleep 3" | |
fi | |
fi | |
if [ $_STATUS = "UPGRADE" ] ; then | |
_THIS_DB_SERVER_TEST=`mysql -V 2>&1` | |
if [[ $_THIS_DB_SERVER_TEST =~ MariaDB ]] ; then | |
if [ ! -e "/var/log/5.2.9-MariaDB.log" ] ; then | |
_PHP_INSTALL_REQUIRED=YES | |
touch /var/log/5.2.9-MariaDB.log | |
msg "INFO: PHP rebuild required to include MariaDB 5.2.9 libs" | |
mrun "sleep 3" | |
fi | |
else | |
if [ ! -e "/var/log/5.5.15-Percona.log" ] ; then | |
_PHP_INSTALL_REQUIRED=YES | |
touch /var/log/5.5.15-Percona.log | |
msg "INFO: PHP rebuild required to include Percona 5.5.15 libs" | |
mrun "sleep 3" | |
fi | |
fi | |
fi | |
if [ "$_PHP_FORCE_REINSTALL" = "YES" ] ; then | |
_PHP_INSTALL_REQUIRED=YES | |
if [ $_STATUS = "UPGRADE" ] ; then | |
msg "INFO: PHP rebuild forced" | |
mrun "sleep 3" | |
fi | |
fi | |
if [ $_PHP_INSTALL_REQUIRED = "YES" ] ; then | |
###--------------------### | |
msg "INFO: Installing PHP-FPM" | |
msg "NOTE: This step can take longer than 8 minutes (depending on your server speed), please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
rm -f -r /var/opt/php* | |
rm -f /etc/init.d/php-fpm* | |
wget -q -U iCab http://www.php.net/distributions/php-$_PHP_VERSION.tar.gz | |
wget -q -U iCab http://download.suhosin.org/suhosin-patch-5.2.16-0.9.7.patch.gz | |
wget -q -U iCab http://php-fpm.org/downloads/php-$_PHP_VERSION-fpm-0.5.14.diff.gz | |
tar -xzf php-$_PHP_VERSION.tar.gz | |
gunzip -q php-$_PHP_VERSION-fpm-0.5.14.diff.gz | |
gunzip -q suhosin-patch-5.2.16-0.9.7.patch.gz | |
cat php-$_PHP_VERSION-fpm-0.5.14.diff | patch -d php-$_PHP_VERSION -p1 &> /dev/null | |
cat suhosin-patch-5.2.16-0.9.7.patch | patch -d php-$_PHP_VERSION -p1 &> /dev/null | |
msg "INFO: Installing PHP-FPM part 1/3" | |
mrun "sleep 3" | |
cd /var/opt/php-$_PHP_VERSION | |
st_runner "sh ./buildconf --force" 2> /dev/null | |
msg "INFO: Installing PHP-FPM part 2/3" | |
mrun "sleep 3" | |
st_runner "sh ./configure --quiet --enable-fpm --enable-fastcgi --with-mysql --with-mysqli --enable-force-cgi-redirect --enable-discard-path --with-zlib --with-curl --with-curlwrappers --with-gd --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --with-t1lib=/usr --with-pear --with-imap --with-imap-ssl --with-openssl --with-pdo-mysql --enable-exif --enable-soap --enable-ftp --enable-zip --enable-mbstring --enable-pcntl --enable-bcmath --with-kerberos --with-xsl --with-mcrypt --with-ldap --with-gmp" 2> /dev/null | |
msg "INFO: Installing PHP-FPM part 3/3" | |
mrun "sleep 3" | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
echo "libcurl4-openssl-dev" > /var/log/libcurl4-openssl-dev.log | |
cd /usr/local/sbin | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/php-fpm ./ | |
chmod 755 php-fpm | |
ln -s /usr/local/sbin/php-fpm /etc/init.d/php-fpm | |
###--------------------### | |
msg "INFO: Installing libmemcached with memcached for PHP-FPM, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
wget -q -U iCab http://files.aegir.cc/dev/libmemcached-0.49.tar.gz | |
mrun "sleep 3" | |
ldconfig &> /dev/null | |
tar -xzf libmemcached-0.49.tar.gz | |
if [ -e "/var/opt/libmemcached-0.49" ] ; then | |
cd /var/opt/libmemcached-0.49 | |
st_runner "sh ./configure" 2> /dev/null | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
echo "libmemcached-0.49" > /var/log/fixed-libmemcached-0.49.log | |
#msg "INFO: OK libmemcached installed" | |
mrun "sleep 3" | |
cd /var/opt | |
wget -q -U iCab http://files.aegir.cc/dev/memcached-1.0.2.tgz | |
tar -xzf memcached-1.0.2.tgz | |
if [ -e "/var/opt/memcached-1.0.2" ] ; then | |
cd /var/opt/memcached-1.0.2 | |
st_runner "/usr/local/bin/phpize" 2> /dev/null | |
st_runner "sh ./configure --with-php-config=/usr/local/bin/php-config" 2> /dev/null | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
echo "memcached-1.0.2" > /var/log/fixed-memcached-1.0.2.log | |
#msg "INFO: OK memcached installed" | |
mrun "sleep 3" | |
fi | |
fi | |
###--------------------### | |
msg "INFO: Installing Suhosin for PHP-FPM, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
wget -q -U iCab http://download.suhosin.org/suhosin-0.9.32.1.tar.gz | |
tar -xzf suhosin-0.9.32.1.tar.gz | |
cd /var/opt/suhosin-0.9.32.1 | |
st_runner "/usr/local/bin/phpize" 2> /dev/null | |
st_runner "sh ./configure --with-php-config=/usr/local/bin/php-config" 2> /dev/null | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
###--------------------### | |
msg "INFO: Installing UploadProgress for PHP-FPM, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
wget -q -U iCab http://files.aegir.cc/dev/uploadprogress-1.0.1.tgz | |
tar -xzf uploadprogress-1.0.1.tgz | |
cd /var/opt/uploadprogress-1.0.1 | |
st_runner "/usr/local/bin/phpize" 2> /dev/null | |
st_runner "sh ./configure --with-php-config=/usr/local/bin/php-config" 2> /dev/null | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
###--------------------### | |
msg "INFO: Installing APC for PHP-FPM, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
wget -q -U iCab http://files.aegir.cc/dev/APC-$_APC_VERSION.tgz | |
tar -xzf APC-$_APC_VERSION.tgz | |
cd /var/opt/APC-$_APC_VERSION | |
st_runner "/usr/local/bin/phpize" 2> /dev/null | |
st_runner "sh ./configure --with-php-config=/usr/local/bin/php-config" 2> /dev/null | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
echo "apc-$_APC_VERSION $_NOW" > /var/log/apc-$_APC_VERSION.log | |
###--------------------### | |
msg "INFO: Installing MailParse for PHP-FPM, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
wget -q -U iCab http://files.aegir.cc/dev/mailparse-2.1.5.tgz | |
tar -xzf mailparse-2.1.5.tgz | |
cd /var/opt/mailparse-2.1.5 | |
st_runner "/usr/local/bin/phpize" 2> /dev/null | |
st_runner "sh ./configure --with-php-config=/usr/local/bin/php-config" 2> /dev/null | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
###--------------------### | |
mkdir -p /usr/local/ioncube | |
_X86_64_TEST=`uname -m` | |
if [ "$_X86_64_TEST" = "x86_64" ] ; then | |
SYSTEMARCH="x86_64" | |
msg "INFO: Installing IonCube $SYSTEMARCH version for PHP-FPM, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
wget -q -U iCab http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz | |
tar -xzf ioncube_loaders_lin_x86-64.tar.gz | |
else | |
SYSTEMARCH="x86" | |
msg "INFO: Installing IonCube $SYSTEMARCH version for PHP-FPM, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
wget -q -U iCab http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz | |
tar -xzf ioncube_loaders_lin_x86.tar.gz | |
fi | |
cp -af /var/opt/ioncube/* /usr/local/ioncube/ &> /dev/null | |
invoke-rc.d php-fpm restart &> /dev/null | |
fi ### end if [ $_PHP_INSTALL_REQUIRED = "YES" ] ; then | |
###--------------------### | |
if [ ! -e "/var/log/apc-$_APC_VERSION.log" ] ; then | |
msg "INFO: Installing APC upgrade for PHP-FPM, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
wget -q -U iCab http://files.aegir.cc/dev/APC-$_APC_VERSION.tgz | |
tar -xzf APC-$_APC_VERSION.tgz | |
cd /var/opt/APC-$_APC_VERSION | |
st_runner "/usr/local/bin/phpize" 2> /dev/null | |
st_runner "sh ./configure --with-php-config=/usr/local/bin/php-config" 2> /dev/null | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
echo "apc-$_APC_VERSION $_NOW" > /var/log/apc-$_APC_VERSION.log | |
fi | |
###--------------------### | |
if [ ! -e "/var/log/fixed-libmemcached-0.49.log" ] ; then | |
msg "INFO: Installing libmemcached with memcached upgrade for PHP-FPM, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
wget -q -U iCab http://files.aegir.cc/dev/libmemcached-0.49.tar.gz | |
mrun "sleep 3" | |
tar -xzf libmemcached-0.49.tar.gz | |
if [ -e "/var/opt/libmemcached-0.49" ] ; then | |
cd /var/opt/libmemcached-0.49 | |
st_runner "sh ./configure" 2> /dev/null | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
echo "libmemcached-0.49" > /var/log/fixed-libmemcached-0.49.log | |
#msg "INFO: OK libmemcached installed" | |
mrun "sleep 3" | |
cd /var/opt | |
wget -q -U iCab http://files.aegir.cc/dev/memcached-1.0.2.tgz | |
tar -xzf memcached-1.0.2.tgz | |
if [ -e "/var/opt/memcached-1.0.2" ] ; then | |
cd /var/opt/memcached-1.0.2 | |
st_runner "/usr/local/bin/phpize" 2> /dev/null | |
st_runner "sh ./configure --with-php-config=/usr/local/bin/php-config" 2> /dev/null | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
echo "memcached-1.0.2" > /var/log/fixed-memcached-1.0.2.log | |
#msg "INFO: OK memcached installed" | |
mrun "sleep 3" | |
fi | |
fi | |
if [ -e "/data/conf/global.inc" ] ; then | |
cd /data/conf | |
mv -f global.inc global.inc-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
if [ -e "/var/aegir/config/server_master/nginx/pre.d/nginx_wild_ssl.conf" ] ; then | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/global.inc.ssl.aegir.txt ./ | |
mv -f global.inc.ssl.aegir.txt global.inc &> /dev/null | |
else | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/global.inc.aegir.txt ./ | |
mv -f global.inc.aegir.txt global.inc &> /dev/null | |
fi | |
fi | |
fi | |
###--------------------### | |
if [ "$_REL_VERSION" = "lenny" ] ; then | |
_PATH_BZR="/usr/bin/bzr" | |
else | |
_PATH_BZR="/usr/local/bin/bzr" | |
fi | |
if [ ! -e "$_PATH_BZR" ] || [ ! -e "/var/log/bzr-$_BZR_VERSION.log" ]; then | |
msg "INFO: Installing bzr, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
wget -q -U iCab http://launchpad.net/bzr/2.3/$_BZR_VERSION/+download/bzr-$_BZR_VERSION.tar.gz | |
tar -xzf bzr-$_BZR_VERSION.tar.gz | |
cd /var/opt/bzr-$_BZR_VERSION | |
st_runner "python setup.py --quiet install build_ext --allow-python-fallback" 2> /dev/null | |
echo "bzr-$_BZR_VERSION" > /var/log/bzr-$_BZR_VERSION.log | |
fi | |
###--------------------### | |
msg "INFO: Nginx version test, please wait..." | |
mrun "sleep 3" | |
if [ $_STATUS = "INIT" ] ; then | |
_NGINX_INSTALL_REQUIRED=YES | |
fi | |
if [ "$_TEST_MODE" = "ON" ] ; then | |
_NGINX_EXTRA_CTRL="/var/log/ngx-cache-purge-on.log" | |
rm -f /var/log/ngx-cache-purge-off.log | |
else | |
_NGINX_EXTRA_CTRL="/var/log/ngx-cache-purge-off.log" | |
rm -f /var/log/ngx-cache-purge-on.log | |
fi | |
if [ -e "/usr/sbin/nginx" ] ; then | |
_NGINX_F_INSTALLED=`/usr/sbin/nginx -v 2>&1 | tr -d "\n" | cut -d" " -f4 | awk '{ print $1}'` | |
_NGINX_F_VERSION="Barracuda/$_NGINX_VERSION" | |
if [ "$_NGINX_F_INSTALLED" = "$_NGINX_F_VERSION" ] && [ ! -e "$_NGINX_EXTRA_CTRL" ] ; then | |
_NGINX_INSTALL_REQUIRED=YES | |
msg "INFO: Installed Nginx version $_NGINX_F_INSTALLED, forced rebuild" | |
elif [ "$_NGINX_F_INSTALLED" = "$_NGINX_F_VERSION" ] && [ -e "$_NGINX_EXTRA_CTRL" ] ; then | |
_NGINX_INSTALL_REQUIRED=NO | |
msg "INFO: Installed Nginx version $_NGINX_F_INSTALLED, no upgrade required" | |
else | |
_NGINX_INSTALL_REQUIRED=YES | |
msg "INFO: Installed Nginx version $_NGINX_F_INSTALLED, upgrade required" | |
fi | |
mrun "sleep 3" | |
else | |
_NGINX_INSTALL_REQUIRED=YES | |
fi | |
###--------------------### | |
if [ $_NGINX_INSTALL_REQUIRED = "YES" ] ; then | |
msg "INFO: Install/upgrade Nginx, please wait..." | |
mrun "sleep 3" | |
cd /var/opt; rm -f -r nginx* | |
if [[ $_BOA_REPO_GIT_URL =~ drupal ]] ; then | |
_BOA_REPO_GIT_URL_LOCAL="git://github.com/omega8cc" | |
else | |
_BOA_REPO_GIT_URL_LOCAL="$_BOA_REPO_GIT_URL" | |
fi | |
#echo _BOA_REPO_NAME is $_BOA_REPO_NAME | |
#echo _BOA_REPO_GIT_URL is $_BOA_REPO_GIT_URL | |
#echo _BOA_REPO_GIT_URL_LOCAL is $_BOA_REPO_GIT_URL_LOCAL | |
git clone $_BOA_REPO_GIT_URL_LOCAL/nginx-upload-progress-module.git &> /dev/null | |
git clone git://github.com/FRiCKLE/ngx_cache_purge.git &> /dev/null | |
cd /var/opt | |
wget -q -U iCab http://nginx.org/download/nginx-$_NGINX_VERSION.tar.gz | |
tar -xzf nginx-$_NGINX_VERSION.tar.gz | |
sed -i "s/nginx/Barracuda/g" /var/opt/nginx-$_NGINX_VERSION/src/core/nginx.h | |
perl -p -i -e "s/\(c->node->length\s+.*\;/c->node->fs_size\;/g" /var/opt/ngx_cache_purge/ngx_cache_purge_module.c | |
cd /var/opt/nginx-$_NGINX_VERSION | |
if [ "$_TEST_MODE" = "ON" ] && [ -z "$_NGINX_EXTRA_CONF" ] ; then | |
_NGINX_EXTRA="--add-module=/var/opt/ngx_cache_purge/" | |
elif [ ! -z "$_NGINX_EXTRA_CONF" ] && [ "$_TEST_MODE" = "OFF" ] ; then | |
_NGINX_EXTRA="$_NGINX_EXTRA_CONF" | |
elif [ ! -z "$_NGINX_EXTRA_CONF" ] && [ "$_TEST_MODE" = "ON" ] ; then | |
_NGINX_EXTRA="--add-module=/var/opt/ngx_cache_purge/ $_NGINX_EXTRA_CONF" | |
else | |
_NGINX_EXTRA="" | |
fi | |
st_runner "sh ./configure --prefix=/usr --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=www-data --group=www-data --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --without-http_ssi_module --without-http_scgi_module --without-http_uwsgi_module --with-debug --with-ipv6 --add-module=/var/opt/nginx-upload-progress-module/ $_NGINX_EXTRA" 2> /dev/null | |
st_runner "make --quiet" 2> /dev/null | |
st_runner "make --quiet install" 2> /dev/null | |
killall -9 nginx &> /dev/null | |
mrun "sleep 3" | |
killall -9 nginx &> /dev/null | |
mrun "sleep 3" | |
invoke-rc.d nginx start &> /dev/null | |
touch $_NGINX_EXTRA_CTRL | |
fi | |
if [ ! -L "/usr/bin/nginx" ] ; then | |
ln -s /usr/sbin/nginx /usr/bin/nginx | |
fi | |
###--------------------### | |
if [ "$_REL_VERSION" = "lenny" ] ; then | |
_PATH_LSHELL="/usr/bin/lshell" | |
else | |
_PATH_LSHELL="/usr/local/bin/lshell" | |
fi | |
if [ ! -e "$_PATH_LSHELL" ] ; then | |
msg "INFO: Installing lshell, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
wget -q -U iCab http://garr.dl.sourceforge.net/project/lshell/lshell/$_LSHELL_VERSION/lshell-$_LSHELL_VERSION.tar.gz | |
tar -xzf lshell-$_LSHELL_VERSION.tar.gz | |
for Files in `find /var/opt/lshell-$_LSHELL_VERSION -type f` ; do | |
sed -i "s/kicked/logged/g" $Files | |
done | |
cd /var/opt/lshell-$_LSHELL_VERSION | |
st_runner "python setup.py install" 2> /dev/null | |
addgroup lshellg &> /dev/null | |
mkdir -p /var/log/lsh | |
chown :lshellg /var/log/lsh | |
chmod 770 /var/log/lsh &> /dev/null | |
cd /etc | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/lshell.conf.txt ./ | |
mv -f lshell.conf lshell.conf-pre-$_NOW &> /dev/null | |
mv -f lshell.conf.txt lshell.conf &> /dev/null | |
echo "$_PATH_LSHELL" >> /etc/shells | |
echo "lshell-$_LSHELL_VERSION" > /var/log/lshell-$_LSHELL_VERSION | |
sed -i "s/log\/lshell/log\/lsh/g" /etc/logrotate.d/lshell &> /dev/null | |
fi | |
if [ -f "/usr/local/bin/lshell" ] ; then | |
if [ ! -L "/usr/bin/lshell" ] ; then | |
ln -s /usr/local/bin/lshell /usr/bin/lshell &> /dev/null | |
fi | |
fi | |
###--------------------### | |
if [ ! -e "/var/log/lshell-$_LSHELL_VERSION" ] ; then | |
msg "INFO: Installing lshell upgrade, please wait..." | |
mrun "sleep 3" | |
cp -af /etc/lshell.conf /etc/lshell.conf-bak &> /dev/null | |
cp -af /etc/lshell.conf /etc/lshell.conf-bak-$_NOW &> /dev/null | |
cd /var/opt | |
wget -q -U iCab http://garr.dl.sourceforge.net/project/lshell/lshell/$_LSHELL_VERSION/lshell-$_LSHELL_VERSION.tar.gz | |
tar -xzf lshell-$_LSHELL_VERSION.tar.gz | |
for Files in `find /var/opt/lshell-$_LSHELL_VERSION -type f` ; do | |
sed -i "s/kicked/logged/g" $Files | |
done | |
cd /var/opt/lshell-$_LSHELL_VERSION | |
st_runner "python setup.py install" 2> /dev/null | |
cp -af /etc/lshell.conf-bak /etc/lshell.conf &> /dev/null | |
addgroup lshellg &> /dev/null | |
mkdir -p /var/log/lsh | |
chown :lshellg /var/log/lsh | |
chmod 770 /var/log/lsh &> /dev/null | |
echo "lshell-$_LSHELL_VERSION" > /var/log/lshell-$_LSHELL_VERSION | |
fi | |
###--------------------### | |
if [ ! -e "/var/log/umask_fixed.log" ] ; then | |
msg "INFO: Setting better default umask for users, please wait..." | |
mrun "sleep 3" | |
mkdir -p /var/www | |
echo "UMASK=002" >> /etc/default/login | |
echo "UMASK 002" >> /etc/login.defs | |
echo "session optional pam_umask.so umask=0002" >> /etc/pam.d/login | |
echo "umask 002" >> /var/www/.profile | |
chown -R www-data:www-data /var/www/* &> /dev/null | |
touch /var/log/umask_fixed.log | |
fi | |
###--------------------### | |
if [ ! -e "/var/log/pure-ftpd-$_PURE_FTPD_VERSION.log" ] ; then | |
msg "INFO: Installing latest Pure-FTPd server, please wait..." | |
mrun "sleep 3" | |
if [ ! -e "/usr/local/sbin/pure-config.pl" ] ; then | |
echo "/bin/false" >> /etc/shells | |
echo "/bin/true" >> /etc/shells | |
fi | |
mkdir -p /etc/ssl/private/ | |
rm -f /etc/ssl/private/pure-ftpd.pem | |
rm -f /usr/local/sbin/pure-ftpd | |
st_runner "openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem -batch" 2> /dev/null | |
chmod 600 /etc/ssl/private/pure-ftpd.pem &> /dev/null | |
cd /var/opt | |
mkdir -p /usr/local/etc | |
rm -f -r pure-ftpd* | |
wget -q -U iCab http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-$_PURE_FTPD_VERSION.tar.gz | |
tar -xzf pure-ftpd-$_PURE_FTPD_VERSION.tar.gz | |
cd pure-ftpd-$_PURE_FTPD_VERSION | |
st_runner "sh ./configure --with-everything --with-virtualchroot --without-humor --with-tls --with-diraliases --with-pam --with-certfile=/etc/ssl/private/pure-ftpd.pem" 2> /dev/null | |
st_runner "make install-strip" 2> /dev/null | |
cd /usr/local/sbin/ | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/pure-config.pl.txt ./ | |
mv -f pure-config.pl.txt pure-config.pl &> /dev/null | |
chmod 755 /usr/local/sbin/pure-config.pl &> /dev/null | |
cp -af /var/opt/pure-ftpd-$_PURE_FTPD_VERSION/pam/pure-ftpd /etc/pam.d/ | |
cd /usr/local/etc | |
rm -f pure-ftpd.conf | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/pure-ftpd.conf ./ | |
killall -9 pure-ftpd &> /dev/null | |
mrun "sleep 3" | |
st_runner "/usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf" &> /dev/null | |
cd /var/opt | |
echo "pure-ftpd-$_PURE_FTPD_VERSION" > /var/log/pure-ftpd-$_PURE_FTPD_VERSION.log | |
fi | |
###--------------------### | |
if [ $_STATUS = "INIT" ] ; then | |
msg "INFO: Update rc.d" | |
mrun "sleep 3" | |
chown root:crontab /var/spool/cron/crontabs/root &> /dev/null | |
chmod 600 /var/spool/cron/crontabs/root &> /dev/null | |
echo "UseDNS no" >> /etc/ssh/sshd_config | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/php.ini /opt/etc/php.ini &> /dev/null | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/php-cli.ini /usr/local/lib/php.ini &> /dev/null | |
chmod 700 /usr/local/sbin/php-fpm &> /dev/null | |
cd /etc/mysql | |
mv -f my.cnf my.cnf-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/my.cnf.txt ./ | |
mv -f my.cnf.txt my.cnf &> /dev/null | |
if [ "$_DB_SERVER" = "Percona" ]; then | |
sed -i "s/default-table-type/\#default-table-type/g" /etc/mysql/my.cnf | |
sed -i "s/language/\#language/g" /etc/mysql/my.cnf | |
fi | |
tune_memory_limits | |
if [ ! -e "/var/run/aegir_upgrade.pid" ] ; then | |
killall -9 nginx php-cgi php-fpm &> /dev/null | |
mrun "sleep 3" | |
st_runner "invoke-rc.d ssh restart" &> /dev/null | |
st_runner "update-rc.d cron defaults" &> /dev/null | |
st_runner "update-rc.d php-fpm defaults" &> /dev/null | |
st_runner "update-rc.d nginx defaults" &> /dev/null | |
st_runner "invoke-rc.d php-fpm start" &> /dev/null | |
st_runner "invoke-rc.d nginx start" &> /dev/null | |
fi | |
st_runner "invoke-rc.d mysql restart" &> /dev/null | |
else | |
if [ ! -e "/var/run/aegir_upgrade.pid" ] ; then | |
msg "INFO: Restarting PHP-FPM and Nginx" | |
mrun "sleep 3" | |
tune_memory_limits | |
st_runner "invoke-rc.d php-fpm reload" &> /dev/null | |
st_runner "invoke-rc.d nginx reload" &> /dev/null | |
fi | |
fi | |
###--------------------### | |
if [ ! -e "/root/.my.pass.txt" ] ; then | |
msg "INFO: Generate random password for $_DB_SERVER" | |
mrun "sleep 3" | |
touch /root/.my.pass.txt | |
chmod 0600 /root/.my.pass.txt &> /dev/null | |
pwgen -c -v -s > /root/.my.pass.txt | |
fi | |
if [ -e "/root/.my.pass.txt" ] ; then | |
PXSWD=`cat /root/.my.pass.txt` | |
PASWD=`echo -n $PXSWD | tr -d "\n"` | |
for Files in `find /var/xdrago -maxdepth 1 -type f` ; do | |
sed -i "s/NdKBu34erty325r6mUHxWy/$PASWD/g" $Files | |
sed -i "s/php-fpm nginx php/php-fpm php-cgi nginx php/g" $Files | |
done | |
msg "INFO: OS and services installation/upgrade completed" | |
mrun "sleep 3" | |
else | |
msg "EXIT on error due to not found file with your MySQL/$_DB_SERVER root password." | |
cat <<EOF | |
It appears you don't have required file with your root sql password. | |
Create this file first and run this script again: | |
echo "your_SQL_ROOT_password" > /root/.my.pass.txt | |
chmod 0600 /root/.my.pass.txt | |
EOF | |
msg "EXIT on error due to not found file with your MySQL/$_DB_SERVER root password." | |
echo " " | |
exit 1 | |
fi | |
if [ $_STATUS = "INIT" ] ; then | |
###--------------------### | |
msg "INFO: Installing Aegir Master Instance, please wait..." | |
mrun "sleep 3" | |
st_runner "adduser --system --group --home /var/aegir aegir" | |
st_runner "adduser aegir www-data" | |
echo "aegir ALL=NOPASSWD: /etc/init.d/nginx" >> /etc/sudoers | |
ln -s /var/aegir/config/nginx.conf /etc/nginx/conf.d/aegir.conf | |
cd /var/aegir | |
if [ "$_AEGIR_VERSION" = "HEAD" ] ; then | |
_AEGIR_SCRIPT="aegir-head-install" | |
elif [ "$_AEGIR_VERSION" = "TEST" ] ; then | |
_AEGIR_SCRIPT="aegir-test-install" | |
_DRUSH_VERSION=All-Versions-HEAD | |
_DRUSH_FAMILY=5 | |
else | |
_AEGIR_SCRIPT="aegir-alpha-install" | |
fi | |
for Files in `find /opt/tmp/$_BOA_REPO_NAME/aegir/scripts -type f` ; do | |
sed -i "s/EDIT_AEGIR_VERSION/$_AEGIR_VERSION/g" $Files | |
sed -i "s/EDIT_DRUSH_VERSION/$_DRUSH_VERSION/g" $Files | |
sed -i "s/EDIT_DRUSH_FAMILY/$_DRUSH_FAMILY/g" $Files | |
sed -i "s/EDIT_BOA_REPO_NAME/$_BOA_REPO_NAME/g" $Files | |
sed -i "s/EDIT_BOA_REPO_GIT_URL/$_BOA_REPO_GIT_URLX/g" $Files | |
sed -i "s/EDIT_THIS_DB_HOST/$_THIS_DB_HOST/g" $Files | |
done | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/scripts/$_AEGIR_SCRIPT.sh.txt ./ | |
msg "INFO: Now running Aegir installer for backend and frontend, please wait..." | |
mrun "sleep 3" | |
if [ "$_DEBUG_MODE" = "YES" ] ; then | |
su -s /bin/bash aegir -c "bash $_AEGIR_SCRIPT.sh.txt $_THIS_FRONT --http_service_type='nginx' --db_service_type='mysql' --db_port='3306' --aegir_db_host='$_THIS_DB_HOST' --client_email='$_MY_EMAIL' -y -d" | |
else | |
su -s /bin/bash aegir -c "bash $_AEGIR_SCRIPT.sh.txt $_THIS_FRONT --http_service_type='nginx' --db_service_type='mysql' --db_port='3306' --aegir_db_host='$_THIS_DB_HOST' --client_email='$_MY_EMAIL' -y >/var/aegir/install.log 2>&1" | |
fi | |
mrun "sleep 3" | |
if [ $_HTTP_WILDCARD = "YES" ] ; then | |
sed -i "s/\!empty.*';/'*';/g" /var/aegir/.drush/provision/http/nginx/server.tpl.php &> /dev/null | |
sed -i "s/\!empty.*';/'*';/g" /var/aegir/.drush/provision/http/nginx/vhost.tpl.php &> /dev/null | |
sed -i "s/\!empty.*';/'*';/g" /var/aegir/.drush/provision/http/nginx/vhost_disabled.tpl.php &> /dev/null | |
fi | |
msg "INFO: Running hosting-dispatch (1/3), please wait..." | |
mrun "sleep 3" | |
su -s /bin/bash aegir -c "drush '@hostmaster' hosting-dispatch &> /dev/null" | |
msg "INFO: Running hosting-dispatch (2/3), please wait..." | |
mrun "sleep 8" | |
su -s /bin/bash aegir -c "drush '@hostmaster' hosting-dispatch &> /dev/null" | |
msg "INFO: Running hosting-dispatch (3/3), please wait..." | |
mrun "sleep 8" | |
su -s /bin/bash aegir -c "drush '@hostmaster' hosting-dispatch &> /dev/null" | |
if [ $_HTTP_WILDCARD = "YES" ] && [ -d "/var/aegir/config/includes" ] ; then | |
echo "WILD" > /var/aegir/config/includes/wildcard_listen_http_enabled.txt | |
fi | |
rm -f /var/aegir/$_AEGIR_SCRIPT.sh.txt | |
###--------------------### | |
msg "INFO: Simple check if Aegir Master Instance install is successful" | |
mrun "sleep 3" | |
if [ -e "/var/aegir/config/includes/nginx_advanced_include.conf" ] ; then | |
msg "INFO: Aegir installation almost completed" | |
else | |
msg "FATAL ERROR: Something is wrong, Aegir Master Instance not installed - exit now" | |
msg "FATAL ERROR: Please check /var/aegir/install.log for more information on errors occured" | |
exit 1 | |
fi | |
###--------------------### | |
msg "INFO: Fix for access to global.inc for www-data user issue" | |
mrun "sleep 3" | |
chmod 711 /var/aegir/config/includes &> /dev/null | |
chmod 711 /var/aegir/config &> /dev/null | |
chmod 711 /var/aegir/.drush &> /dev/null | |
mrun "sleep 3" | |
###--------------------### | |
msg "INFO: Fix for advanced Nginx config and Drush path" | |
mrun "sleep 3" | |
ln -s /var/aegir/drush/drush /usr/bin/drush | |
cd /var/aegir/config/includes | |
mv -f global.inc global.inc-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/global.inc.aegir.txt ./ | |
mv -f global.inc.aegir.txt global.inc &> /dev/null | |
force_advanced_nginx_config | |
if [ $_DRUSH_FAMILY = "3" ] ; then | |
cd /var/aegir/drush | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/patches/user.drush.inc.patch ./ | |
patch -p0 < user.drush.inc.patch &> /dev/null | |
chown -R aegir:aegir /var/aegir/drush &> /dev/null | |
fi | |
if [ $_DRUSH_VERSION = "7.x-4.5" ] ; then | |
sed -i "s/which one she wants./which one she wants.\n chdir(\$request['base_project_path'])\;/g" /var/aegir/drush/commands/pm/package_handler/wget.inc &> /dev/null | |
fi | |
cd /var/aegir | |
sed -i "s/access_log/\#access_log/g" /etc/nginx/nginx.conf | |
perl -p -i -e "s/worker_connections\s+1024/worker_connections 4096/g" /etc/nginx/nginx.conf | |
perl -p -i -e "s/worker_processes\s+1\;/worker_processes 4\;\nworker_rlimit_nofile 8192\;/g" /etc/nginx/nginx.conf | |
rm -f /etc/nginx/sites-available/default | |
rm -f /etc/nginx/sites-enabled/default | |
if [ "$_REL_VERSION" = "maverick" ] || [ "$_REL_VERSION" = "natty" ]; then | |
if [ -e "/opt/tmp/$_BOA_REPO_NAME/aegir/conf/nginx.conf" ]; then | |
mv -f /etc/nginx/nginx.conf /etc/nginx/nginx.conf-old &> /dev/null | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/nginx.conf /etc/nginx/nginx.conf | |
fi | |
fi | |
if [ "$_THIS_OS" = "Ubuntu" ] ; then | |
killall -9 nginx &> /dev/null | |
mrun "sleep 3" | |
invoke-rc.d nginx start &> /dev/null | |
else | |
invoke-rc.d nginx reload &> /dev/null | |
fi | |
mrun "sleep 3" | |
msg "INFO: Aegir Master Instance installation completed" | |
mrun "sleep 3" | |
else | |
echo " " | |
if prompt_yes_no "Do you want to upgrade Aegir Master Instance?" ; then | |
true | |
mrun "sleep 3" | |
msg "INFO: Running Aegir Master Instance upgrade" | |
mrun "sleep 3" | |
rm -f /opt/tmp/testecho* | |
invoke-rc.d cron stop &> /dev/null | |
_THIS_HM_ROOT=`cat /var/aegir/.drush/hostmaster.alias.drushrc.php | grep "root'" | cut -d: -f2 | awk '{ print $3}' | sed "s/[\,']//g"` | |
_THIS_HM_SITE=`cat /var/aegir/.drush/hostmaster.alias.drushrc.php | grep "site_path'" | cut -d: -f2 | awk '{ print $3}' | sed "s/[\,']//g"` | |
chown -R aegir $_THIS_HM_ROOT | |
chown -R aegir:www-data $_THIS_HM_SITE/files | |
chmod -R 2770 $_THIS_HM_SITE/files | |
cd /var/aegir | |
cp /opt/tmp/$_BOA_REPO_NAME/aegir/barracuda/AegirUpgrade.sh.txt ./ | |
sed -i "s/EDIT_INSTALLER_VERSION/$_INSTALLER_VERSION/g" /var/aegir/AegirUpgrade.sh.txt | |
sed -i "s/EDIT_BOA_REPO_NAME/$_BOA_REPO_NAME/g" /var/aegir/AegirUpgrade.sh.txt | |
sed -i "s/EDIT_BOA_REPO_GIT_URL/$_BOA_REPO_GIT_URLX/g" /var/aegir/AegirUpgrade.sh.txt | |
sed -i "s/EDIT_DOMAIN/$_THIS_FRONT/g" /var/aegir/AegirUpgrade.sh.txt | |
sed -i "s/EDIT_AEGIR_VERSION/$_AEGIR_VERSION/g" /var/aegir/AegirUpgrade.sh.txt | |
sed -i "s/EDIT_DRUSH_VERSION/$_DRUSH_VERSION/g" /var/aegir/AegirUpgrade.sh.txt | |
sed -i "s/EDIT_DRUSH_FAMILY/$_DRUSH_FAMILY/g" /var/aegir/AegirUpgrade.sh.txt | |
sed -i "s/EDIT_DEBUG_MODE/$_DEBUG_MODE/g" /var/aegir/AegirUpgrade.sh.txt | |
sed -i "s/EDIT_THIS_DB_HOST/$_THIS_DB_HOST/g" /var/aegir/AegirUpgrade.sh.txt | |
sed -i "s/EDIT_HTTP_WILDCARD/$_HTTP_WILDCARD/g" /var/aegir/AegirUpgrade.sh.txt | |
su -s /bin/bash aegir -c "bash AegirUpgrade.sh.txt" | |
cd /var/aegir/config/includes | |
mv -f global.inc global.inc-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
if [ -e "/var/aegir/config/server_master/nginx/pre.d/nginx_wild_ssl.conf" ] ; then | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/global.inc.ssl.aegir.txt ./ | |
mv -f global.inc.ssl.aegir.txt global.inc &> /dev/null | |
else | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/global.inc.aegir.txt ./ | |
mv -f global.inc.aegir.txt global.inc &> /dev/null | |
fi | |
force_advanced_nginx_config | |
if [ $_DRUSH_FAMILY = "3" ] ; then | |
cd /var/aegir/drush | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/patches/user.drush.inc.patch ./ | |
patch -p0 < user.drush.inc.patch &> /dev/null | |
chown -R aegir:aegir /var/aegir/drush &> /dev/null | |
fi | |
if [ $_DRUSH_VERSION = "7.x-4.5" ] ; then | |
sed -i "s/which one she wants./which one she wants.\n chdir(\$request['base_project_path'])\;/g" /var/aegir/drush/commands/pm/package_handler/wget.inc &> /dev/null | |
fi | |
cd /var/aegir | |
rm -f AegirUpgrade.sh.txt | |
if [ -d "/var/aegir/config/server_master/nginx/conf.d" ] ; then | |
if [ ! -d "/var/aegir/config/server_master/nginx/pre.d" ] ; then | |
cd /var/aegir/config/server_master/nginx | |
cp -a conf.d pre.d | |
fi | |
if [ -e "/var/aegir/config/server_master/nginx/pre.d/custom_nginx.conf" ] ; then | |
rm -f /var/aegir/config/server_master/nginx/pre.d/custom_nginx.conf | |
fi | |
fi | |
chmod 711 /var/aegir/.drush &> /dev/null | |
cd /var/aegir/config/includes | |
echo "`date` / `lsb_release -si`.`lsb_release -sc` `uname -m` $_VMFAMILY / Aegir $_AEGIR_VERSION / Barracuda $_INSTALLER_VERSION$_FORCE_GIT_MIRROR / Nginx $_NGINX_VERSION / PHP $_PHP_VERSION / $_DB_SERVER $_THIS_DB_HOST / SpeedWild $_USE_SPEED_BOOSTER-$_HTTP_WILDCARD" >> ./barracuda_log.txt | |
touch installer_version.txt | |
msg "INFO: Aegir Master Instance upgrade completed" | |
else | |
msg "INFO: Aegir Master Instance not upgraded this time" | |
mrun "sleep 3" | |
fi | |
rm -f /var/aegir/*install.sh.txt | |
fi ### end of if [ $_STATUS = "INIT" ] ; then | |
###--------------------### | |
if [ -e "/opt/tmp/$_BOA_REPO_NAME/aegir/conf/mime.types" ] ; then | |
msg "INFO: Fix for mime types in Nginx, please wait..." | |
mrun "sleep 3" | |
cd /etc/nginx | |
mv -f mime.types mime.types-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
cp /opt/tmp/$_BOA_REPO_NAME/aegir/conf/mime.types ./ | |
mkdir -p /var/www/nginx-default | |
cd /var/www/nginx-default | |
cp -f /opt/tmp/$_BOA_REPO_NAME/aegir/conf/uc.html ./ | |
cp -f /opt/tmp/$_BOA_REPO_NAME/aegir/conf/under_construction.jpg ./ | |
mv -f index.html index.html-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
mv -f uc.html index.html &> /dev/null | |
if [ ! -e "/var/run/aegir_upgrade.pid" ] ; then | |
st_runner "invoke-rc.d nginx reload" &> /dev/null | |
fi | |
fi | |
###--------------------### | |
if [ ! -e "/var/aegir/config/server_master/nginx/pre.d/nginx_wild_ssl.conf" ] ; then | |
msg "INFO: Installing default SSL Wildcard Nginx Proxy, please wait..." | |
mrun "sleep 3" | |
_HTTPS_TEST=`netstat -ln | grep :443 2>&1` | |
if [[ $_HTTPS_TEST =~ 443 ]] ; then | |
_HTTPS_TEST=EXIST | |
msg "WARNING!" | |
cat <<EOF | |
We can't enable Wildcard HTTPS Proxy for all your hosted sites, | |
including all Aegir Satellite Instances, because you have already | |
enabled SSL on the IP address used by your Aegir Master Instance. | |
If you wish to use provided now by Barracuda Wildcard HTTPS Proxy, | |
please disable the SSL you enabled, or use the built-in Aegir SSL | |
feature on another IP address available and not used by the Hostmaster, | |
and other hosted sites. | |
We will continue in 30 seconds... | |
EOF | |
mrun "sleep 30" | |
else | |
_HTTPS_TEST=FREE | |
validate_public_ip | |
validate_xtras_ip | |
openssl req -x509 -nodes -days 7300 -subj "/C=US/ST=New York/O=Aegir/OU=Cloud/L=New York/CN=*.$_THISHOST" -newkey rsa:2048 -keyout /etc/ssl/private/nginx-wild-ssl.key -out /etc/ssl/private/nginx-wild-ssl.crt -batch 2> /dev/null | |
cd /var/aegir/config/server_master/nginx/pre.d | |
cp -a /opt/tmp/$_BOA_REPO_NAME/aegir/conf/nginx_wild_ssl.conf ./ | |
if [ $_HTTP_WILDCARD = "YES" ] ; then | |
sed -i "s/127.0.0.1:80/localhost:80/g" /var/aegir/config/server_master/nginx/pre.d/nginx_wild_ssl.conf &> /dev/null | |
else | |
sed -i "s/127.0.0.1:80/$_THISHTIP:80/g" /var/aegir/config/server_master/nginx/pre.d/nginx_wild_ssl.conf &> /dev/null | |
fi | |
sed -i "s/127.0.0.1:443/$_XTRAS_THISHTIP:443/g" /var/aegir/config/server_master/nginx/pre.d/nginx_wild_ssl.conf &> /dev/null | |
if [ -e "/opt/tmp/$_BOA_REPO_NAME/aegir/conf/global.inc.ssl.aegir.txt" ] ; then | |
cd /var/aegir/config/includes | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/global.inc.ssl.aegir.txt ./ | |
mv -f global.inc global.inc-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
mv -f global.inc.ssl.aegir.txt global.inc &> /dev/null | |
fi | |
if [ "$_THIS_OS" = "Ubuntu" ] ; then | |
killall -9 nginx &> /dev/null | |
mrun "sleep 3" | |
invoke-rc.d nginx start &> /dev/null | |
else | |
killall -9 nginx &> /dev/null | |
mrun "sleep 3" | |
invoke-rc.d nginx start &> /dev/null | |
fi | |
fi | |
fi | |
###--------------------### | |
if [ ! -e "/var/aegir/config/server_master/nginx/pre.d/nginx_speed_purge.conf" ] && [ "$_TEST_MODE" = "ON" ] ; then | |
msg "INFO: Installing Speed Booster Purge Server, please wait..." | |
mrun "sleep 3" | |
validate_public_ip | |
cd /var/aegir/config/server_master/nginx/pre.d | |
rm -f speed_purge.conf | |
cp -a /opt/tmp/$_BOA_REPO_NAME/aegir/conf/nginx_speed_purge.conf ./ | |
sed -i "s/EDIT_THISHTIP/$_THISHTIP/g" /var/aegir/config/server_master/nginx/pre.d/nginx_speed_purge.conf &> /dev/null | |
else | |
rm -f /var/aegir/config/server_master/nginx/pre.d/nginx_speed_purge.conf | |
fi | |
###--------------------### | |
if [ "$_XTRAS_LIST" = "ALL" ] || [[ $_XTRAS_LIST =~ SLR ]] ; then | |
if [ ! -d "/opt/solr" ] ; then | |
echo " " | |
if prompt_yes_no "Do you want to install MultiCore Apache Solr Tomcat?" ; then | |
true | |
msg "INFO: Installing MultiCore Apache Solr Tomcat, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
rm -f -r apachesolr* | |
rm -f -r /opt/solr | |
rm -f -r /opt/tomcat6 | |
wget -q -U iCab http://files.aegir.cc/dev/apachesolr.tar.gz | |
tar -xzf apachesolr.tar.gz | |
cd apachesolr | |
mv -f tomcat /etc/init.d/ &> /dev/null | |
mv -f solr /opt/ &> /dev/null | |
mv -f tomcat6 /opt/ &> /dev/null | |
echo "ENABLED=1" > /etc/default/tomcat | |
sed -i "s/\/usr\/lib\/jvm\/java-6-sun\/jre/\/usr\/lib\/jvm\/java-6-openjdk\/jre/g" /etc/init.d/tomcat | |
sed -i "s/sh \/opt\/tomcat6/su -s \/bin\/bash tomcat -c \"sh \/opt\/tomcat6/g" /etc/init.d/tomcat | |
sed -i "s/\.sh/\.sh\"/g" /etc/init.d/tomcat | |
adduser --system --group --home /opt/solr tomcat &> /dev/null | |
touch /opt/solr/fixed.log | |
chown -R tomcat:tomcat /opt/solr | |
chown -R tomcat:tomcat /opt/tomcat6 | |
st_runner "update-rc.d tomcat defaults" &> /dev/null | |
st_runner "invoke-rc.d tomcat start" &> /dev/null | |
msg "INFO: MultiCore Apache Solr Tomcat installation completed" | |
mrun "sleep 2" | |
else | |
msg "INFO: MultiCore Apache Solr Tomcat installation skipped" | |
mrun "sleep 2" | |
fi | |
fi | |
fi | |
if [ -d "/opt/solr" ] && [ -e "/etc/init.d/tomcat" ] ; then | |
if [ ! -e "/opt/solr/fixed.log" ] ; then | |
adduser --system --group --home /opt/solr tomcat &> /dev/null | |
touch /opt/solr/fixed.log | |
st_runner "invoke-rc.d tomcat stop" &> /dev/null | |
chown -R tomcat:tomcat /opt/solr | |
chown -R tomcat:tomcat /opt/tomcat6 | |
sed -i "s/sh \/opt\/tomcat6/su -s \/bin\/bash tomcat -c \"sh \/opt\/tomcat6/g" /etc/init.d/tomcat | |
sed -i "s/\.sh/\.sh\"/g" /etc/init.d/tomcat | |
killall -9 java &> /dev/null | |
st_runner "invoke-rc.d tomcat start" &> /dev/null | |
fi | |
if [ ! -e "/opt/solr/conf/apachesolr-6.x-1.5.log" ] ; then | |
cd /var/opt | |
wget -q -U iCab http://ftp.drupal.org/files/projects/apachesolr-6.x-1.5.tar.gz | |
tar -xzf apachesolr-6.x-1.5.tar.gz &> /dev/null | |
rm -f apachesolr-6.x-1.5.tar.gz | |
cp -af /opt/solr/conf/schema.xml /opt/solr/conf/schema.xml-pre-$_INSTALLER_VERSION-$_NOW | |
cp -af apachesolr/schema.xml /opt/solr/conf/ | |
cp -af /opt/solr/conf/solrconfig.xml /opt/solr/conf/solrconfig.xml-pre-$_INSTALLER_VERSION-$_NOW | |
cp -af apachesolr/solrconfig.xml /opt/solr/conf/ | |
cp -af /opt/solr/conf/protwords.txt /opt/solr/conf/protwords.txt-pre-$_INSTALLER_VERSION-$_NOW | |
cp -af apachesolr/protwords.txt /opt/solr/conf/ | |
touch /opt/solr/conf/apachesolr-6.x-1.5.log | |
chown -R tomcat:tomcat /opt/solr/conf | |
st_runner "invoke-rc.d tomcat stop" &> /dev/null | |
mrun "sleep 3" | |
st_runner "invoke-rc.d tomcat start" &> /dev/null | |
fi | |
fi | |
###--------------------### | |
if [ "$_XTRAS_LIST" = "ALL" ] || [[ $_XTRAS_LIST =~ CHV ]] ; then | |
if [ ! -d "/var/www/chive" ] ; then | |
echo " " | |
if prompt_yes_no "Do you want to install Chive $_DB_SERVER Manager?" ; then | |
true | |
msg "INFO: Installing Chive $_DB_SERVER Manager, please wait..." | |
mrun "sleep 3" | |
cd /var/www | |
wget -q -U iCab http://launchpad.net/chive/0.5/$_CHIVE_VERSION/+download/chive_$_CHIVE_VERSION.tar.gz | |
tar -xzf chive_$_CHIVE_VERSION.tar.gz | |
rm -f chive_$_CHIVE_VERSION.tar.gz | |
chown -R www-data:www-data /var/www/chive | |
_CHIVE_VHOST="/var/aegir/config/server_master/nginx/vhost.d/chive.$_THIS_FRONT" | |
validate_public_ip | |
validate_xtras_ip | |
echo > $_CHIVE_VHOST | |
echo "server {" >> $_CHIVE_VHOST | |
echo " include /var/aegir/config/includes/fastcgi_params.conf;" >> $_CHIVE_VHOST | |
echo " limit_conn gulag 10;" >> $_CHIVE_VHOST | |
echo " listen $_XTRAS_THISHTIP:80;" >> $_CHIVE_VHOST | |
echo " server_name chive.$_THIS_FRONT $_THISHTIP;" >> $_CHIVE_VHOST | |
echo " root /var/www/chive;" >> $_CHIVE_VHOST | |
echo " index index.php index.html;" >> $_CHIVE_VHOST | |
echo " include /var/aegir/config/includes/nginx_compact_include.conf;" >> $_CHIVE_VHOST | |
echo "}" >> $_CHIVE_VHOST | |
echo >> $_CHIVE_VHOST | |
touch /var/log/chive_$_CHIVE_VERSION.log | |
msg "INFO: Chive $_DB_SERVER Manager installation completed" | |
mrun "sleep 2" | |
else | |
msg "INFO: Chive $_DB_SERVER Manager installation skipped" | |
mrun "sleep 2" | |
fi | |
fi | |
fi | |
###--------------------### | |
if [ -d "/var/www/chive" ] ; then | |
if [ ! -e "/var/log/chive_$_CHIVE_VERSION.log" ] ; then | |
msg "INFO: Upgrading Chive $_DB_SERVER Manager, please wait..." | |
mrun "sleep 3" | |
cd /var/www | |
rm -f -r /var/www/chive | |
wget -q -U iCab http://launchpad.net/chive/0.5/$_CHIVE_VERSION/+download/chive_$_CHIVE_VERSION.tar.gz | |
tar -xzf chive_$_CHIVE_VERSION.tar.gz | |
rm -f chive_$_CHIVE_VERSION.tar.gz | |
chown -R www-data:www-data /var/www/chive | |
touch /var/log/chive_$_CHIVE_VERSION.log | |
fi | |
if [ ! -e "/var/log/chive_$_CHIVE_VERSION.vhost.log" ] ; then | |
_CHIVE_VHOST="/var/aegir/config/server_master/nginx/vhost.d/chive.$_THIS_FRONT" | |
validate_public_ip | |
validate_xtras_ip | |
echo > $_CHIVE_VHOST | |
echo "server {" >> $_CHIVE_VHOST | |
echo " include /var/aegir/config/includes/fastcgi_params.conf;" >> $_CHIVE_VHOST | |
echo " limit_conn gulag 10;" >> $_CHIVE_VHOST | |
echo " listen $_XTRAS_THISHTIP:80;" >> $_CHIVE_VHOST | |
echo " server_name chive.$_THIS_FRONT $_THISHTIP;" >> $_CHIVE_VHOST | |
echo " root /var/www/chive;" >> $_CHIVE_VHOST | |
echo " index index.php index.html;" >> $_CHIVE_VHOST | |
echo " include /var/aegir/config/includes/nginx_compact_include.conf;" >> $_CHIVE_VHOST | |
echo "}" >> $_CHIVE_VHOST | |
echo >> $_CHIVE_VHOST | |
touch /var/log/chive_$_CHIVE_VERSION.vhost.log | |
fi | |
fi | |
###--------------------### | |
_CHIVE_VHOST="/var/aegir/config/server_master/nginx/vhost.d/chive.$_THIS_FRONT" | |
if [ -e "$_CHIVE_VHOST" ] ; then | |
sed -i "s/nginx_simple_include.conf/nginx_compact_include.conf/g" $_CHIVE_VHOST | |
fi | |
###--------------------### | |
if [ "$_XTRAS_LIST" = "ALL" ] || [[ $_XTRAS_LIST =~ BDD ]] ; then | |
if [ ! -d "/var/www/sqlbuddy" ] ; then | |
echo " " | |
if prompt_yes_no "Do you want to install SQL Buddy $_DB_SERVER Manager?" ; then | |
true | |
msg "INFO: Installing SQL Buddy $_DB_SERVER Manager, please wait..." | |
mrun "sleep 3" | |
cd /var/www | |
wget -q -U iCab http://www.sqlbuddy.com/download/dl.php -O sqlbuddy_1_3_3.zip | |
unzip -qq sqlbuddy_1_3_3.zip | |
rm -f sqlbuddy_1_3_3.zip | |
chown -R www-data:www-data /var/www/sqlbuddy | |
_SQLBUDDY_VHOST="/var/aegir/config/server_master/nginx/vhost.d/sqlbuddy.$_THIS_FRONT" | |
validate_public_ip | |
validate_xtras_ip | |
echo > $_SQLBUDDY_VHOST | |
echo "server {" >> $_SQLBUDDY_VHOST | |
echo " include /var/aegir/config/includes/fastcgi_params.conf;" >> $_SQLBUDDY_VHOST | |
echo " limit_conn gulag 10;" >> $_SQLBUDDY_VHOST | |
echo " listen $_XTRAS_THISHTIP:80;" >> $_SQLBUDDY_VHOST | |
echo " server_name sqlbuddy.$_THIS_FRONT;" >> $_SQLBUDDY_VHOST | |
echo " root /var/www/sqlbuddy;" >> $_SQLBUDDY_VHOST | |
echo " index index.php index.html;" >> $_SQLBUDDY_VHOST | |
echo " include /var/aegir/config/includes/nginx_compact_include.conf;" >> $_SQLBUDDY_VHOST | |
echo "}" >> $_SQLBUDDY_VHOST | |
echo >> $_SQLBUDDY_VHOST | |
msg "INFO: SQL Buddy $_DB_SERVER Manager installation completed" | |
mrun "sleep 2" | |
else | |
msg "INFO: SQL Buddy $_DB_SERVER Manager installation skipped" | |
mrun "sleep 2" | |
fi | |
fi | |
fi | |
###--------------------### | |
_SQLBUDDY_VHOST="/var/aegir/config/server_master/nginx/vhost.d/sqlbuddy.$_THIS_FRONT" | |
if [ -e "$_SQLBUDDY_VHOST" ] ; then | |
sed -i "s/nginx_simple_include.conf/nginx_compact_include.conf/g" $_SQLBUDDY_VHOST | |
fi | |
###--------------------### | |
if [ "$_XTRAS_LIST" = "ALL" ] || [[ $_XTRAS_LIST =~ CGP ]] ; then | |
if [ ! -e "/var/run/cloud_vhost.pid" ] ; then | |
if [ ! -d "/var/www/cgp" ] ; then | |
echo " " | |
if prompt_yes_no "Do you want to install Collectd Graph Panel?" ; then | |
true | |
msg "INFO: Installing Collectd Graph Panel, please wait..." | |
mrun "sleep 3" | |
st_runner "apt-get -y install collectd" 2> /dev/null | |
cd /var/www | |
git clone http://git.nethuis.nl/pub/cgp.git &> /dev/null | |
sed -i "s/>uncategorized</>Barracuda Server</g" /var/www/cgp/index.php | |
chown -R www-data:www-data /var/www/cgp | |
_CGP_VHOST="/var/aegir/config/server_master/nginx/vhost.d/cgp.$_THIS_FRONT" | |
validate_public_ip | |
validate_xtras_ip | |
echo > $_CGP_VHOST | |
echo "server {" >> $_CGP_VHOST | |
echo " include /var/aegir/config/includes/fastcgi_params.conf;" >> $_CGP_VHOST | |
echo " limit_conn gulag 10;" >> $_CGP_VHOST | |
echo " listen $_XTRAS_THISHTIP:80;" >> $_CGP_VHOST | |
echo " server_name cgp.$_THIS_FRONT;" >> $_CGP_VHOST | |
echo " root /var/www/cgp;" >> $_CGP_VHOST | |
echo " index index.php index.html;" >> $_CGP_VHOST | |
echo " include /var/aegir/config/includes/nginx_compact_include.conf;" >> $_CGP_VHOST | |
echo "}" >> $_CGP_VHOST | |
echo >> $_CGP_VHOST | |
st_runner "update-rc.d collectd defaults" &> /dev/null | |
msg "INFO: Collectd Graph Panel installation completed" | |
mrun "sleep 2" | |
else | |
msg "INFO: Collectd Graph Panel installation skipped" | |
mrun "sleep 2" | |
fi | |
fi | |
fi | |
fi | |
###--------------------### | |
if [ -d "/var/www/cgp" ] && [ "$_VMFAMILY" = "VS" ] && [ ! -d "/boot/grub" ] ; then | |
rm -f /var/aegir/config/server_master/nginx/vhost.d/cgp* | |
st_runner "apt-get -y remove collectd" 2> /dev/null | |
st_runner "apt-get -y purge collectd" 2> /dev/null | |
rm -f -r /var/www/cgp | |
fi | |
_CGP_VHOST="/var/aegir/config/server_master/nginx/vhost.d/cgp.$_THIS_FRONT" | |
if [ -e "$_CGP_VHOST" ] ; then | |
sed -i "s/nginx_simple_include.conf/nginx_compact_include.conf/g" $_CGP_VHOST | |
fi | |
###--------------------### | |
if [ "$_XTRAS_LIST" = "ALL" ] || [[ $_XTRAS_LIST =~ BND ]] ; then | |
if [ ! -e "/usr/sbin/named" ] && [ ! -e "/var/run/cloud_vhost.pid" ] ; then | |
echo " " | |
if prompt_yes_no "Do you want to install Bind9 DNS Server? (experimental only - not recommended)" ; then | |
true | |
msg "INFO: Installing Bind9 DNS Server, please wait..." | |
mrun "sleep 3" | |
if [ -z "$_THISHTIP" ] ; then | |
_LOC_DOM="$_THISHOST" | |
find_correct_ip | |
_THISHTIP="$_LOC_IP" | |
fi | |
st_runner "$_INSTALL bind9" 2> /dev/null | |
cd /etc/bind | |
rm -f named.conf.options | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/named.conf.options ./ | |
sed -i "s/127.0.1.1/$_THISHTIP/g" named.conf.options | |
st_runner "invoke-rc.d bind9 restart" &> /dev/null | |
if [ ! -e "/etc/init.d/bind" ] ; then | |
ln -s /etc/init.d/bind9 /etc/init.d/bind | |
fi | |
echo "aegir ALL=NOPASSWD: /etc/init.d/bind9" >> /etc/sudoers | |
echo "aegir ALL=NOPASSWD: /etc/init.d/bind" >> /etc/sudoers | |
msg "INFO: Bind9 DNS Server installation completed" | |
mrun "sleep 2" | |
else | |
msg "INFO: Bind9 DNS Server installation skipped" | |
mrun "sleep 2" | |
fi | |
fi | |
fi | |
###--------------------### | |
if [ "$_XTRAS_LIST" = "ALL" ] || [[ $_XTRAS_LIST =~ WMN ]] ; then | |
if [ ! -d "/etc/webmin" ] && [ ! -e "/var/run/cloud_vhost.pid" ] ; then | |
echo " " | |
if prompt_yes_no "Do you want to install Webmin Control Panel?" ; then | |
true | |
msg "INFO: Installing Webmin Control Panel, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
echo "deb http://download.webmin.com/download/repository sarge contrib" >> /etc/apt/sources.list | |
wget -q -U iCab http://www.webmin.com/jcameron-key.asc | |
apt-key add jcameron-key.asc &> /dev/null | |
touch /var/log/webmin_new_apt.log | |
st_runner "apt-get update -y --force-yes" 2> /dev/null | |
st_runner "$_INSTALL webmin libxml-simple-perl libcrypt-ssleay-perl" 2> /dev/null | |
update-rc.d webmin defaults &> /dev/null | |
msg "INFO: Webmin Control Panel installation completed" | |
mrun "sleep 2" | |
else | |
msg "INFO: Webmin Control Panel installation skipped" | |
mrun "sleep 2" | |
fi | |
fi | |
fi | |
csf_install () { | |
msg "INFO: Installing csf/lfd firewall, please wait..." | |
mrun "sleep 3" | |
cd /var/opt | |
rm -f /var/xdrago/log/lastFire | |
wget -q -U iCab http://www.configserver.com/free/csf.tgz | |
tar -xzf csf.tgz | |
cd csf | |
st_runner "sh install.sh" 2> /dev/null | |
cd /etc/csf | |
mv -f csf.conf csf.conf-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/csf.conf ./ | |
sed -i "s/notify\@omega8.cc/$_MY_EMAIL/g" /etc/csf/csf.conf | |
sed -i "s/,22,/,$_SSH_PORT,/g" /etc/csf/csf.conf | |
chmod 600 /etc/csf/csf.conf &> /dev/null | |
sed -i "s/Port 22/Port $_SSH_PORT/g" /etc/ssh/sshd_config | |
sed -i "s/30 \* \* \* \* bash/#30 * * * * bash/g" /var/spool/cron/crontabs/root | |
st_runner "invoke-rc.d ssh restart" &> /dev/null | |
st_runner "invoke-rc.d csf restart" &> /dev/null | |
st_runner "invoke-rc.d lfd restart" &> /dev/null | |
echo $_SSH_PORT > /var/log/csf-setup-ssh-port-new.log | |
msg "INFO: csf/lfd firewall installation completed" | |
mrun "sleep 2" | |
touch /var/log/csf_$_INSTALLER_VERSION.log | |
} | |
###--------------------### | |
if [ "$_XTRAS_LIST" = "ALL" ] || [[ $_XTRAS_LIST =~ CSF ]] ; then | |
if [ ! -e "/var/run/cloud_vhost.pid" ] ; then | |
if [ ! -e "/usr/sbin/csf" ] ; then | |
echo " " | |
if prompt_yes_no "Do you want to install csf/lfd firewall?" ; then | |
true | |
csf_install | |
else | |
msg "INFO: csf/lfd firewall installation skipped" | |
mrun "sleep 2" | |
fi | |
fi | |
fi | |
fi | |
if [ -e "/usr/sbin/csf" ] && [ "$_VMFAMILY" = "VS" ] && [ ! -d "/boot/grub" ] ; then | |
invoke-rc.d lfd stop &> /dev/null | |
invoke-rc.d csf stop &> /dev/null | |
invoke-rc.d csf stop &> /dev/null | |
update-rc.d -f csf remove &> /dev/null | |
update-rc.d -f lfd remove &> /dev/null | |
rm -f /etc/cron.d/{csf,lfd}* | |
rm -f /usr/sbin/{csf,lfd} | |
rm -f /etc/init.d/{csf,lfd} | |
rm -f -r /etc/csf | |
fi | |
if [ -e "/usr/sbin/csf" ] ; then | |
if [ ! -e "/var/log/csf_$_INSTALLER_VERSION.log" ] ; then | |
csf_install | |
fi | |
if [ ! -e "/var/log/csf-setup-ssh-port-new.log" ] ; then | |
cd /etc/csf | |
mv -f csf.conf csf.conf-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/csf.conf ./ | |
sed -i "s/,22,/,$_SSH_PORT,/g" /etc/csf/csf.conf | |
sed -i "s/Port 22/Port $_SSH_PORT/g" /etc/ssh/sshd_config | |
touch /var/log/csf-setup-ssh-port-new.log | |
st_runner "invoke-rc.d ssh restart" &> /dev/null | |
st_runner "invoke-rc.d csf restart" &> /dev/null | |
fi | |
if [ -e "/var/xdrago/log/lastFire" ] ; then | |
sed -i "s/30 \* \* \* \* bash/#30 * * * * bash/g" /var/spool/cron/crontabs/root | |
rm -f /var/xdrago/log/lastFire | |
st_runner "invoke-rc.d csf restart" &> /dev/null | |
st_runner "invoke-rc.d lfd restart" &> /dev/null | |
fi | |
fi | |
if [ ! -e "/var/log/sysctl.conf.custom.log" ] ; then | |
cd /etc | |
mv -f sysctl.conf sysctl.conf-pre-$_INSTALLER_VERSION-$_NOW &> /dev/null | |
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/sysctl.conf ./ | |
touch /var/log/sysctl.conf.custom.log | |
fi | |
###--------------------### | |
if [ ! -e "/root/.my.cnf" ] ; then | |
msg "INFO: $_DB_SERVER final setup" | |
mrun "sleep 3" | |
echo " " | |
msg "Please COPY it NOW and set it as your $_DB_SERVER root password during mysql_secure_installation" | |
echo " " | |
echo --------vvvvvvvv-------- | |
echo ------- $PASWD ------- | |
echo --------^^^^^^^^-------- | |
echo " " | |
msg "Please remember, you don't have the root password for $_DB_SERVER set yet." | |
cat <<EOF | |
* You have to hit Enter _without_ entering the password on the first question you will see. | |
* On the second question say Y and then enter your root password '$PASWD' twice. | |
* Then say Y on all remaining questions. | |
EOF | |
echo " " | |
msg "...waiting now 15 sec before running interactive mysql_secure_installation..." | |
echo " " | |
mrun "sleep 15" | |
echo " " | |
mysql_secure_installation | |
echo " " | |
mrun "sleep 3" | |
echo "[client]" >> /root/.my.cnf | |
echo "user=root" >> /root/.my.cnf | |
echo "password=$PASWD" >> /root/.my.cnf | |
chmod 0600 /root/.my.cnf &> /dev/null | |
if [ ! -e "/var/log/check_for_crashed_tables_disabled" ] ; then | |
perl -p -i -e "s/check_for_crashed_tables/\#check_for_crashed_tables/g" /etc/mysql/debian-start | |
touch /var/log/check_for_crashed_tables_disabled | |
st_runner "invoke-rc.d mysql restart" &> /dev/null | |
mrun "sleep 3" | |
fi | |
msg "INFO: $_DB_SERVER setup completed" | |
msg "INFO: You can now log in as root by typing only 'mysql' on the command line" | |
fi ### end of if [ ! -e "/root/.my.cnf" ] ; then | |
###--------------------### | |
mrun "sleep 3" | |
APTEMAIL=${_MY_EMAIL//\@/\\\@} | |
XPTEMAIL=${_MY_EMAIL//\@/\\\\\@} | |
sed -i "s/notify\@omega8.cc/$_MY_EMAIL/g" /etc/csf/csf.conf &> /dev/null | |
sed -i "s/notify\@omega8.cc/$_MY_EMAIL/g" /etc/apticron/apticron.conf &> /dev/null | |
sed -i "s/root/$_MY_EMAIL/g" /etc/apticron/apticron.conf &> /dev/null | |
sed -i "s/help\\\@omega8.cc/$XPTEMAIL/g" /var/xdrago/checksql.cgi &> /dev/null | |
sed -i "s/notify\\\@omega8.cc/$XPTEMAIL/g" /var/xdrago/usage.sh &> /dev/null | |
if [ $_STATUS = "INIT" ] ; then | |
st_runner "sh /usr/sbin/apticron" | |
cd /var/aegir/config/includes | |
echo "`date` / `lsb_release -si`.`lsb_release -sc` `uname -m` $_VMFAMILY / Aegir $_AEGIR_VERSION / Barracuda $_INSTALLER_VERSION$_FORCE_GIT_MIRROR / Nginx $_NGINX_VERSION / PHP $_PHP_VERSION / $_DB_SERVER $_THIS_DB_HOST / SpeedWild $_USE_SPEED_BOOSTER-$_HTTP_WILDCARD" >> ./barracuda_log.txt | |
touch installer_version.txt | |
echo " " | |
_AEGIR_LOGIN_URL=`grep "Aegir is now installed" /var/aegir/install.log 2> /dev/null` | |
msg "ACCESS -> $_AEGIR_LOGIN_URL" | |
echo " " | |
mrun "sleep 3" | |
fi | |
if [ ! -e "/var/log/cron_aegir_off.pid" ] ; then | |
touch /var/log/cron_aegir_off.pid | |
fi | |
msg "CARD: Now charging your credit card for this automated install/upgrade service..." | |
mrun "sleep 3" | |
msg "JOKE: Just kidding! Enjoy your Aegir Hosting System :)" | |
mrun "sleep 3" | |
msg "Final post-install cleaning, please wait..." | |
mrun "sleep 3" | |
tune_memory_limits | |
invoke-rc.d php-fpm reload &> /dev/null | |
if [ $_STATUS = "INIT" ] ; then | |
invoke-rc.d cron restart &> /dev/null | |
echo " " | |
msg "Now waiting 2 minutes before restarting Nginx..." | |
echo " " | |
msg "Note: you may need to restart Nginx again with command: " | |
msg " service nginx restart" | |
msg "before you will be able to visit Aegir URL the first time." | |
echo " " | |
mrun "sleep 99" | |
invoke-rc.d nginx restart &> /dev/null | |
else | |
invoke-rc.d nginx reload &> /dev/null | |
fi | |
mkdir -p /data/conf/arch | |
mv -f /data/conf/global.inc-pre* /data/conf/arch/ &> /dev/null | |
mv -f /data/conf/global.inc-before* /data/conf/arch/ &> /dev/null | |
mv -f /data/conf/global.inc-missing* /data/conf/arch/ &> /dev/null | |
rm -f /tmp/cache.inc | |
rm -f -r /var/opt/* | |
rm -f -r /opt/tmp/* | |
rm -f /var/run/octopus_barracuda.pid | |
chmod 700 /root | |
invoke-rc.d cron restart &> /dev/null | |
msg "BYE!" | |
exit 0 | |
###----------------------------------------### | |
### | |
### Barracuda Aegir Installer | |
### Copyright (C) 2010-2011 Omega8.cc | |
### noc@omega8.cc www.omega8.cc | |
### | |
###----------------------------------------### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment