Skip to content

Commit 1ca4e44

Browse files
author
Michael Kreitzer
committed
1.0.11 Refactor/Updates
- 000-setup_environment.sh updated grep command to use a count comparison when checking if aliases exist in .bash_aliases - 000-setup_environment.sh replaced 'freetype*' with specific 'libfreetype6-dev' in php pre-requisites - 400-setup_mysql.sh added if condition to avoid overwrite existing mysql data with that of a fresh install - 500-setup_php.sh moved sed replace commands into seperate condition to handle old php-farm pulls
1 parent 5a8cc87 commit 1ca4e44

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

scripts/000-setup_environment.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ rm -f /etc/profile.d/00-aliases.sh
4040
cp /vagrant/files/profile.d/* /etc/profile.d/
4141

4242
# Next line needed so that root will have access to these aliases
43-
if [ ! -f /root/.bash_aliases ] || ! grep -q "for f in \/etc\/profile.d\/\*-aliases.sh; do source \$f; done" /root/.bash_aliases ; then
43+
if [ ! -f /root/.bash_aliases ] || [ $(grep -c "for f in /etc/profile.d/\*aliases.sh; do source \$f; done" /root/.bash_aliases) -eq 0 ] ; then
4444
echo 'for f in /etc/profile.d/*-aliases.sh; do source $f; done' >> /root/.bash_aliases
4545
fi
4646

4747
#Setup PHP compile pre-requisites
4848
apt-get install -y build-essential libbz2-dev libmysqlclient-dev libxpm-dev libmcrypt-dev \
4949
libcurl4-gnutls-dev libxml2-dev libjpeg-dev libpng12-dev libssl-dev pkg-config libreadline-dev \
50-
curl autoconf libicu-dev libxslt-dev freetype* 2>&1
50+
curl autoconf libicu-dev libxslt-dev libfreetype6-dev 2>&1
5151

5252
# Workaround to allow custom scripts added to path with sudo
5353
if ! grep -q "^#Defaults[[:blank:]]*secure_path" /etc/sudoers ; then

scripts/400-setup_mysql.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ if [ ! -f /etc/init.d/mysql* ]; then
4141
sed -i "s/bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
4242
sed -i "s/max_allowed_packet.*/max_allowed_packet = 64M/" /etc/mysql/my.cnf
4343
sed -i "s/datadir.*/datadir = \/srv\/mysql\/data/" /etc/mysql/my.cnf
44-
echo "Copying mysql databases from /var/lib/mysql/ to /srv/mysql/data ..."
45-
cp -r /var/lib/mysql/* /srv/mysql/data
44+
if [ ! -d /srv/mysql/data/mysql ]; then
45+
echo "Copying mysql databases from /var/lib/mysql/ to /srv/mysql/data ..."
46+
cp -r /var/lib/mysql/* /srv/mysql/data
47+
else
48+
echo "Not moving mysql databases from /var/lib/mysql/ to /srv/mysql/data since data is already present there"
49+
fi
4650

4751
service mysql start
4852

scripts/500-setup_php.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ function setup_phpfarm() {
4141
cd /opt
4242
if [ ! -d /opt/phpfarm ]; then
4343
git clone https://github.com/DemacMedia/phpfarm.git phpfarm
44-
45-
# Patch phpfarm options files until I can get a PR put on there to fix these at source:
44+
else
45+
# Patch old phpfarm options:
4646
if [[ $(/opt/phpfarm/custom/options-5.4.sh | grep 'freetype') == '' ]]; then
4747
sed -i "s/--with-png-dir/--with-png-dir \\\\\n--with-freetype-dir=\/usr\/include\/freetype2 \\\\\n--enable-gd-native-ttf/" /opt/phpfarm/custom/options-5.4.sh
4848
fi

0 commit comments

Comments
 (0)