-
Notifications
You must be signed in to change notification settings - Fork 0
/
mydombox.sh
executable file
·54 lines (42 loc) · 2.02 KB
/
mydombox.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
set -e
echo 'Check for mydombox.conf'
if [ -f /etc/mydombox/mydombox.conf ]
then
echo 'Editing /etc/mydombox/mydombox.conf...'
sed -i "s,mysqlhostname,${MYSQL_HOSTNAME:-localhost}," /etc/mydombox/mydombox.conf
sed -i "s,mysqlport,${MYSQL_PORT:-3306}," /etc/mydombox/mydombox.conf
sed -i "s,mysqluser,${MYSQL_USER:-mydombox}," /etc/mydombox/mydombox.conf
sed -i "s,mysqlpassword,${MYSQL_PASSWORD:-mydomboxpwd}," /etc/mydombox/mydombox.conf
fi
echo 'Check for db.php'
if [ -f /var/www/html/mydombox-mobile/inc/db.php ]
then
echo 'Editing /var/www/html/mydombox-mobile/inc/db.php...'
sed -i "s,mysqlhostname,${MYSQL_HOSTNAME:-localhost}," /var/www/html/mydombox-mobile/inc/db.php
sed -i "s,mysqlport,${MYSQL_PORT:-3306}," /var/www/html/mydombox-mobile/inc/db.php
sed -i "s,mysqluser,${MYSQL_USER:-mydombox}," /var/www/html/mydombox-mobile/inc/db.php
sed -i "s,mysqlpassword,${MYSQL_PASSWORD:-mydomboxpwd}," /var/www/html/mydombox-mobile/inc/db.php
fi
#DATABASE_EXIST=$(mysql -u ${MYSQL_HOSTNAME:-localhost} -pmydomboxpwd -e "show databases;" | grep "^mydombox" | wc -l)
#
#if [ $DATABASE_EXIST -eq 0 ]
#then
# mysql -u root -pmydomboxpwd < /etc/mydombox/database/Create_mydombox_0-6-2.sql
#fi
#VERSION=$( mysql -u root mydombox -pmydomboxpwd -e "SELECT MAX(db_version) FROM database_version;" |awk -F\| '{ print $1 }' | grep -v db_version)
#if [ "${VERSION}" = "0.5.0" ]
#then
# mysql -u root -pmydomboxpwd < /etc/mydombox/database/Migration_mydombox_0-5-0_to_0-6-0.sql
#fi
#if [ "${VERSION}" = "0.6.0" ]
#then
# mysql -u root -pmydomboxpwd < /etc/mydombox/database/Migration_mydombox_0-6-0_to_0-6-1.sql
#fi
#if [ "${VERSION}" = "0.6.1" ]
#then
# mysql -u root -pmydomboxpwd < /etc/mydombox/database/Migration_mydombox_0-6-1_to_0-6-2.sql
#fi
#mysql -u root -pmydomboxpwd < /etc/mydombox/database/Populate_mydombox_0-6-0.sql
#mysql -u root -pmydomboxpwd -e "grant all privileges on mydombox.* to mydombox@localhost identified by 'mydomboxpwd';"
/usr/sbin/mydombox /etc/mydombox/mydombox.conf