forked from speckcommerce/speck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspeckinstall.sh
executable file
·61 lines (56 loc) · 1.55 KB
/
speckinstall.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
55
56
57
58
59
60
61
echo "database name - this script assumes the database already exists (ctrl-c to abort)"
echo -n "(leave blank for 'speck'): "
read dbname
if [ -z "$dbname" ]; then
dbname='speck'
fi
echo "SQL user - this use must already exist and have permissions to create/modify tables in '$dbname' (ctrl-c to abort)"
echo -n "(leave blank for 'speck'): "
read user
if [ -z "$user" ]; then
user='speck'
fi
echo "password for SQL user '$user'"
echo -n "(leave blank for 'speck'): "
read pass
if [ -z "$pass" ]; then
pass='speck'
fi
export dir=`pwd`
cd $dir && git submodule update --init
cd $dir/vendor
ls -d */ | tr ' ' '\n' > $dir/devmodules/tempdirlist
cat $dir/devmodules/tempdirlist | while read line; do
cd $dir/vendor/$line
if [ -r ".git" ]
then
git clone $dir/vendor/$line $dir/devmodules/$line
cd $dir/devmodules/$line && git pull origin master && git checkout master
if [ -d data ]
then
cd $dir/devmodules/$line/data
if [ -r 'schema.sql' ]
then
cat 'schema.sql' | mysql -u$user -p$pass $dbname
fi
fi
fi
done
cat $dir/devmodules/tempdirlist | while read line; do
cd $dir/vendor/$line
if [ -r ".git" ]
then
cd $dir/devmodules/$line
if [ -d data ]
then
cd $dir/devmodules/$line/data
if [ -r 'alter.sql' ]
then
cat 'alter.sql' | mysql -u$user -p$pass $dbname
fi
fi
fi
done
rm $dir/devmodules/tempdirlist
cd $dir
php dbconfig.php $user $pass $dbname