format condition

This commit is contained in:
Michael RICOIS 2016-12-02 10:38:11 +01:00
parent 212d4f27db
commit 620a4fc712
2 changed files with 32 additions and 64 deletions

View File

@ -8,16 +8,14 @@ MARIADB_VERSION="10.1"
PHPMYADMIN_VERSION="4.6.3" PHPMYADMIN_VERSION="4.6.3"
# --- Add a file action.upgrade to perfom a system upgrade # --- Add a file action.upgrade to perfom a system upgrade
if [ -f $DIR/action.upgrade ] if [ -f $DIR/action.upgrade ]; then
then
sudo apt-get update sudo apt-get update
sudo apt-get -y upgrade sudo apt-get -y upgrade
sudo rm -rf $DIR/action.upgrade sudo rm -rf $DIR/action.upgrade
fi fi
# --- Installation Wkhtmltopdf # --- Installation Wkhtmltopdf
if [ ! -f /usr/local/bin/wkhtmltopdf ] if [ ! -f /usr/local/bin/wkhtmltopdf ]; then
then
sudo apt-get install libxrender1 libfontconfig1 sudo apt-get install libxrender1 libfontconfig1
wget -q http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz wget -q http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
tar xJf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz tar xJf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
@ -26,11 +24,9 @@ then
fi fi
# --- Database # --- Database
if [ $VARGANTDEV -eq 1 ] if [ $VARGANTDEV -eq 1 ]; then
then
# --- Installation MariaDB # --- Installation MariaDB
if [ ! -f /etc/mysql/vagrant ] if [ ! -f /etc/mysql/vagrant ]; then
then
sudo apt-get install software-properties-common sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb [arch=amd64,i386] http://ftp.igh.cnrs.fr/pub/mariadb/repo/10.1/ubuntu trusty main' sudo add-apt-repository 'deb [arch=amd64,i386] http://ftp.igh.cnrs.fr/pub/mariadb/repo/10.1/ubuntu trusty main'
@ -45,8 +41,7 @@ then
fi fi
else else
# --- Installation MySQL Server # --- Installation MySQL Server
if [ ! -f /etc/mysql/vagrant ] if [ ! -f /etc/mysql/vagrant ]; then
then
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $MYSQL_PASS" sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $MYSQL_PASS"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $MYSQL_PASS" sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $MYSQL_PASS"
sudo apt-get -y install mysql-server mysql-client sudo apt-get -y install mysql-server mysql-client
@ -58,16 +53,14 @@ else
fi fi
# --- PHP # --- PHP
if [ ! -f /usr/bin/php5 ] if [ ! -f /usr/bin/php5 ]; then
then
# Get apache2.4 from backports # Get apache2.4 from backports
sudo cp -f $DIRDATA/apt/preferences /etc/apt/preferences sudo cp -f $DIRDATA/apt/preferences /etc/apt/preferences
# Install # Install
sudo apt-get update sudo apt-get update
sudo apt-get -y install htop unzip apache2 php5-fpm php5-cli php5-apcu php5-curl php5-xmlrpc php5-xsl php5-mysqlnd sudo apt-get -y install htop unzip apache2 php5-fpm php5-cli php5-apcu php5-curl php5-xmlrpc php5-xsl php5-mysqlnd
if [ $VARGANTDEV -eq 1 ] if [ $VARGANTDEV -eq 1 ]; then
then
sudo apt-get -y install php5-xdebug sudo apt-get -y install php5-xdebug
fi fi
sudo a2enmod autoindex deflate expires headers rewrite actions proxy proxy_fcgi sudo a2enmod autoindex deflate expires headers rewrite actions proxy proxy_fcgi
@ -75,16 +68,14 @@ then
sudo a2enconf phpfcgi sudo a2enconf phpfcgi
# --- Configuration PHP / CLI # --- Configuration PHP / CLI
if [ -f /etc/php5/cli/php.ini ] if [ -f /etc/php5/cli/php.ini ]; then
then
sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php5/cli/php.ini sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php5/cli/php.ini
sudo sed -i -e 's/;mbstring.internal_encoding = UTF-8/mbstring.internal_encoding = UTF-8/g' /etc/php5/cli/php.ini sudo sed -i -e 's/;mbstring.internal_encoding = UTF-8/mbstring.internal_encoding = UTF-8/g' /etc/php5/cli/php.ini
sudo sed -i -e 's/;date.timezone =/date.timezone = Europe\/Paris/g' /etc/php5/cli/php.ini sudo sed -i -e 's/;date.timezone =/date.timezone = Europe\/Paris/g' /etc/php5/cli/php.ini
fi fi
# --- Configuration PHP FPM # --- Configuration PHP FPM
if [ -f /etc/php5/fpm/php.ini ] if [ -f /etc/php5/fpm/php.ini ]; then
then
sudo sed -i -e 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php5/fpm/php.ini sudo sed -i -e 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php5/fpm/php.ini
sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php5/fpm/php.ini sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php5/fpm/php.ini
sudo sed -i -e 's/;mbstring.internal_encoding = UTF-8/mbstring.internal_encoding = UTF-8/g' /etc/php5/fpm/php.ini sudo sed -i -e 's/;mbstring.internal_encoding = UTF-8/mbstring.internal_encoding = UTF-8/g' /etc/php5/fpm/php.ini
@ -101,8 +92,7 @@ then
fi fi
# --- ChartDirector # --- ChartDirector
if [ ! -f /usr/lib/php5/20121212/chartdir.lic ] if [ ! -f /usr/lib/php5/20121212/chartdir.lic ]; then
then
sudo cp -R $DIRDATA/ChartDirector/lib/fonts /usr/lib/php5/20121212/ sudo cp -R $DIRDATA/ChartDirector/lib/fonts /usr/lib/php5/20121212/
sudo chown -R 777 /usr/lib/php5/20121212/fonts sudo chown -R 777 /usr/lib/php5/20121212/fonts
sudo cp $DIRDATA/ChartDirector/lib/libchartdir.so /usr/lib/php5/20121212/ sudo cp $DIRDATA/ChartDirector/lib/libchartdir.so /usr/lib/php5/20121212/
@ -115,19 +105,16 @@ then
fi fi
# --- Composer # --- Composer
if [ ! -f /usr/local/bin/composer ] if [ ! -f /usr/local/bin/composer ]; then
then
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
fi fi
# --- Installation phpMyAdmin # --- Installation phpMyAdmin
PHPMYADMIN_DIR="phpMyAdmin-$PHPMYADMIN_VERSION-all-languages" PHPMYADMIN_DIR="phpMyAdmin-$PHPMYADMIN_VERSION-all-languages"
PHPMYADMIN_URL="https://files.phpmyadmin.net/phpMyAdmin" PHPMYADMIN_URL="https://files.phpmyadmin.net/phpMyAdmin"
if [ ! -d "/home/vhosts/$PHPMYADMIN_DIR" ] if [ ! -d "/home/vhosts/$PHPMYADMIN_DIR" ]; then
then
wget -q "$PHPMYADMIN_URL/$PHPMYADMIN_VERSION/$PHPMYADMIN_DIR.tar.xz" -O "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" wget -q "$PHPMYADMIN_URL/$PHPMYADMIN_VERSION/$PHPMYADMIN_DIR.tar.xz" -O "/home/vagrant/$PHPMYADMIN_DIR.tar.xz"
if [ -f "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" ] if [ -f "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" ]; then
then
tar xJvf "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" --directory /home/vhosts/ tar xJvf "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" --directory /home/vhosts/
mysql -hlocalhost -uroot -p$MYSQL_PASS < /home/vhosts/$PHPMYADMIN_DIR/sql/create_tables.sql mysql -hlocalhost -uroot -p$MYSQL_PASS < /home/vhosts/$PHPMYADMIN_DIR/sql/create_tables.sql
mysql -hlocalhost -uroot -p$MYSQL_PASS < $DIRDATA/Apps/phpmyadmin.sql mysql -hlocalhost -uroot -p$MYSQL_PASS < $DIRDATA/Apps/phpmyadmin.sql
@ -138,8 +125,7 @@ then
fi fi
# --- Configuration Apache # --- Configuration Apache
if [ ! -f /etc/apache2/conf-available/httpd.conf ] if [ ! -f /etc/apache2/conf-available/httpd.conf ]; then
then
sudo echo "ServerName 127.0.0.1" > /etc/apache2/conf-available/httpd.conf sudo echo "ServerName 127.0.0.1" > /etc/apache2/conf-available/httpd.conf
sudo a2enconf httpd sudo a2enconf httpd
fi fi
@ -163,8 +149,7 @@ sed -i -e "s/VERSION/$PHPMYADMIN_VERSION/" $DIR/vhosts/phpmyadmin.conf
# --- test.sd.dev # --- test.sd.dev
cp -f $DIRDATA/Apache/test.conf $DIR/vhosts/test.conf cp -f $DIRDATA/Apache/test.conf $DIR/vhosts/test.conf
if [ ! -d /home/vhosts/test ] if [ ! -d /home/vhosts/test ]; then
then
sudo mkdir /home/vhosts/test sudo mkdir /home/vhosts/test
fi fi
@ -178,8 +163,7 @@ for f in *.conf; do
if [ $f = "default-ssl.conf" ]; then if [ $f = "default-ssl.conf" ]; then
continue continue
fi fi
if [ -f $f ] if [ -f $f ]; then
then
sudo cp -vf $f /etc/apache2/sites-available/; sudo cp -vf $f /etc/apache2/sites-available/;
VHOSTS+=" $f" VHOSTS+=" $f"
fi fi

View File

@ -8,16 +8,14 @@ MARIADB_VERSION="10.1"
PHPMYADMIN_VERSION="4.6.3" PHPMYADMIN_VERSION="4.6.3"
# --- Add a file action.upgrade to perfom a system upgrade # --- Add a file action.upgrade to perfom a system upgrade
if [ -f $DIR/action.upgrade ] if [ -f $DIR/action.upgrade ]; then
then
sudo apt-get update sudo apt-get update
sudo apt-get -y upgrade sudo apt-get -y upgrade
sudo rm -rf $DIR/action.upgrade sudo rm -rf $DIR/action.upgrade
fi fi
# --- Installation Wkhtmltopdf # --- Installation Wkhtmltopdf
if [ ! -f /usr/local/bin/wkhtmltopdf ] if [ ! -f /usr/local/bin/wkhtmltopdf ]; then
then
wget -q http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz wget -q http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
tar xJf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz tar xJf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
cp -R wkhtmltox/* /usr/local/ cp -R wkhtmltox/* /usr/local/
@ -25,11 +23,9 @@ then
fi fi
# --- Database # --- Database
if [ $VARGANTDEV -eq 1 ] if [ $VARGANTDEV -eq 1 ]; then
then
# --- Installation MariaDB # --- Installation MariaDB
if [ ! -f /etc/mysql/vagrant ] if [ ! -f /etc/mysql/vagrant ]; then
then
sudo apt-get install software-properties-common sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386] http://ftp.igh.cnrs.fr/pub/mariadb/repo/10.1/ubuntu xenial main' sudo add-apt-repository 'deb [arch=amd64,i386] http://ftp.igh.cnrs.fr/pub/mariadb/repo/10.1/ubuntu xenial main'
@ -44,8 +40,7 @@ then
fi fi
else else
# --- Installation MySQL Server # --- Installation MySQL Server
if [ ! -f /etc/mysql/vagrant ] if [ ! -f /etc/mysql/vagrant ]; then
then
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $MYSQL_PASS" sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $MYSQL_PASS"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $MYSQL_PASS" sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $MYSQL_PASS"
sudo apt-get -y install mysql-server mysql-client sudo apt-get -y install mysql-server mysql-client
@ -57,13 +52,11 @@ else
fi fi
# --- PHP # --- PHP
if [ ! -f /usr/bin/php5 ] if [ ! -f /usr/bin/php5 ]; then
then
# Install # Install
sudo apt-get update sudo apt-get update
sudo apt-get -y install htop unzip apache2 php7.0-fpm php7.0-cli php7.0-apcu php7.0-curl php7.0-xmlrpc php7.0-xsl php7.0-mysql sudo apt-get -y install htop unzip apache2 php7.0-fpm php7.0-cli php7.0-apcu php7.0-curl php7.0-xmlrpc php7.0-xsl php7.0-mysql
if [ $VARGANTDEV -eq 1 ] if [ $VARGANTDEV -eq 1 ]; then
then
sudo apt-get -y install php-xdebug sudo apt-get -y install php-xdebug
fi fi
sudo a2enmod autoindex deflate expires headers rewrite actions proxy proxy_fcgi sudo a2enmod autoindex deflate expires headers rewrite actions proxy proxy_fcgi
@ -71,16 +64,14 @@ then
sudo a2enconf phpfcgi sudo a2enconf phpfcgi
# --- Configuration PHP / CLI # --- Configuration PHP / CLI
if [ -f /etc/php/7.0/cli/php.ini ] if [ -f /etc/php/7.0/cli/php.ini ]; then
then
sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php7.0/cli/php.ini sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php7.0/cli/php.ini
sudo sed -i -e 's/;mbstring.internal_encoding = UTF-8/mbstring.internal_encoding = UTF-8/g' /etc/php7.0/cli/php.ini sudo sed -i -e 's/;mbstring.internal_encoding = UTF-8/mbstring.internal_encoding = UTF-8/g' /etc/php7.0/cli/php.ini
sudo sed -i -e 's/;date.timezone =/date.timezone = Europe\/Paris/g' /etc/php7.0/cli/php.ini sudo sed -i -e 's/;date.timezone =/date.timezone = Europe\/Paris/g' /etc/php7.0/cli/php.ini
fi fi
# --- Configuration PHP FPM # --- Configuration PHP FPM
if [ -f /etc/php/7.0/fpm/php.ini ] if [ -f /etc/php/7.0/fpm/php.ini ]; then
then
sudo sed -i -e 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php/7.0/fpm/php.ini sudo sed -i -e 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php/7.0/fpm/php.ini
sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php7.0/fpm/php.ini sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php7.0/fpm/php.ini
sudo sed -i -e 's/;mbstring.internal_encoding = UTF-8/mbstring.internal_encoding = UTF-8/g' /etc/php/7.0/fpm/php.ini sudo sed -i -e 's/;mbstring.internal_encoding = UTF-8/mbstring.internal_encoding = UTF-8/g' /etc/php/7.0/fpm/php.ini
@ -97,8 +88,7 @@ then
fi fi
# --- ChartDirector # --- ChartDirector
if [ ! -f /usr/lib/php5/20121212/chartdir.lic ] if [ ! -f /usr/lib/php5/20121212/chartdir.lic ]; then
then
#sudo cp -R $DIRDATA/ChartDirector/lib/fonts /usr/lib/php5/20121212/ #sudo cp -R $DIRDATA/ChartDirector/lib/fonts /usr/lib/php5/20121212/
#sudo chown -R 777 /usr/lib/php5/20121212/fonts #sudo chown -R 777 /usr/lib/php5/20121212/fonts
#sudo cp $DIRDATA/ChartDirector/lib/libchartdir.so /usr/lib/php5/20121212/ #sudo cp $DIRDATA/ChartDirector/lib/libchartdir.so /usr/lib/php5/20121212/
@ -111,19 +101,16 @@ then
fi fi
# --- Composer # --- Composer
if [ ! -f /usr/local/bin/composer ] if [ ! -f /usr/local/bin/composer ]; then
then
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
fi fi
# --- Installation phpMyAdmin # --- Installation phpMyAdmin
PHPMYADMIN_DIR="phpMyAdmin-$PHPMYADMIN_VERSION-all-languages" PHPMYADMIN_DIR="phpMyAdmin-$PHPMYADMIN_VERSION-all-languages"
PHPMYADMIN_URL="https://files.phpmyadmin.net/phpMyAdmin" PHPMYADMIN_URL="https://files.phpmyadmin.net/phpMyAdmin"
if [ ! -d "/home/vhosts/$PHPMYADMIN_DIR" ] if [ ! -d "/home/vhosts/$PHPMYADMIN_DIR" ]; then
then
wget -q "$PHPMYADMIN_URL/$PHPMYADMIN_VERSION/$PHPMYADMIN_DIR.tar.xz" -O "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" wget -q "$PHPMYADMIN_URL/$PHPMYADMIN_VERSION/$PHPMYADMIN_DIR.tar.xz" -O "/home/vagrant/$PHPMYADMIN_DIR.tar.xz"
if [ -f "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" ] if [ -f "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" ]; then
then
tar xJvf "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" --directory /home/vhosts/ tar xJvf "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" --directory /home/vhosts/
mysql -hlocalhost -uroot -p$MYSQL_PASS < /home/vhosts/$PHPMYADMIN_DIR/sql/create_tables.sql mysql -hlocalhost -uroot -p$MYSQL_PASS < /home/vhosts/$PHPMYADMIN_DIR/sql/create_tables.sql
mysql -hlocalhost -uroot -p$MYSQL_PASS < $DIRDATA/Apps/phpmyadmin.sql mysql -hlocalhost -uroot -p$MYSQL_PASS < $DIRDATA/Apps/phpmyadmin.sql
@ -134,8 +121,7 @@ then
fi fi
# --- Configuration Apache # --- Configuration Apache
if [ ! -f /etc/apache2/conf-available/httpd.conf ] if [ ! -f /etc/apache2/conf-available/httpd.conf ]; then
then
sudo echo "ServerName 127.0.0.1" > /etc/apache2/conf-available/httpd.conf sudo echo "ServerName 127.0.0.1" > /etc/apache2/conf-available/httpd.conf
sudo a2enconf httpd sudo a2enconf httpd
fi fi
@ -159,8 +145,7 @@ sed -i -e "s/VERSION/$PHPMYADMIN_VERSION/" $DIR/vhosts/phpmyadmin.conf
# --- test.sd.dev # --- test.sd.dev
cp -f $DIRDATA/Apache/test.conf $DIR/vhosts/test.conf cp -f $DIRDATA/Apache/test.conf $DIR/vhosts/test.conf
if [ ! -d /home/vhosts/test ] if [ ! -d /home/vhosts/test ]; then
then
sudo mkdir /home/vhosts/test sudo mkdir /home/vhosts/test
fi fi
@ -174,8 +159,7 @@ for f in *.conf; do
if [ $f = "default-ssl.conf" ]; then if [ $f = "default-ssl.conf" ]; then
continue continue
fi fi
if [ -f $f ] if [ -f $f ]; then
then
sudo cp -vf $f /etc/apache2/sites-available/; sudo cp -vf $f /etc/apache2/sites-available/;
VHOSTS+=" $f" VHOSTS+=" $f"
fi fi