-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall
executable file
·124 lines (103 loc) · 3.67 KB
/
install
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
## Begin Script
clear
echo "Welcome to the VuFind Setup Script."
echo "This will setup the MySQL Database as well as the necessary system libraries"
echo ""
## Setup paths for vufind.sh file
CURRPATH=`pwd`
DEFAULT_VUFIND=' VUFIND_HOME="/usr/local/vufind"'
VUFIND=" VUFIND_HOME=\"$CURRPATH\""
sed -e "s!${DEFAULT_VUFIND}!${VUFIND}!" vufind.sh > vufind.new
mv vufind.new vufind.sh
## MySQL Database Setup
echo "The first step is to install the MySQL Database."
echo ""
## Prompt for Database values
read -p "New Database Name [vufind]: " MYSQLDB
read -p "New Database User [vufind]: " MYSQLNEWUSER
read -p "New User Password: " -s MYSQLNEWPASS
echo ""
read -p "MySQL Host [localhost]: " MYSQLHOST
read -p "MySQL Root User [root]: " MYSQLUSER
read -p "MySQL Root Password: " -s MYSQLPASS
echo ""
## Set Defaults if selected
if [ -z $MYSQLDB ]; then
MYSQLDB=vufind
fi
if [ -z $MYSQLNEWUSER ]; then
MYSQLNEWUSER=vufind
fi
if [ -z $MYSQLHOST ]; then
MYSQLHOST=localhost
fi
if [ -z $MYSQLUSER ]; then
MYSQLUSER=root
fi
## Process creating mysql user and database
mysqladmin -h $MYSQLHOST -u $MYSQLUSER -p$MYSQLPASS create $MYSQLDB
mysql -h $MYSQLHOST -u $MYSQLUSER -p$MYSQLPASS -e "GRANT SELECT,INSERT,UPDATE,DELETE ON $MYSQLDB.* TO '$MYSQLNEWUSER'@'$MYSQLHOST' IDENTIFIED BY '$MYSQLNEWPASS' WITH GRANT OPTION"
mysql -h $MYSQLHOST -u $MYSQLUSER -p$MYSQLPASS -e "FLUSH PRIVILEGES"
mysql -h $MYSQLHOST -u $MYSQLUSER -p$MYSQLPASS -D $MYSQLDB < mysql.sql
## Edit web/conf/config.ini
if [ -z $MYSQLNEWPASS ]; then
sed -e "s!mysql://root@localhost/vufind!mysql://${MYSQLNEWUSER}@${MYSQLHOST}/${MYSQLDB}!" web/conf/config.ini > web/conf/config.ini.new
else
sed -e "s!mysql://root@localhost/vufind!mysql://${MYSQLNEWUSER}:${MYSQLNEWPASS//&/\\&}@${MYSQLHOST}/${MYSQLDB}!" web/conf/config.ini > web/conf/config.ini.new
fi
mv web/conf/config.ini.new web/conf/config.ini
## Rename the vufind.ini file to match the database name
if [ $MYSQLDB != "vufind" ]; then
mv web/conf/vufind.ini web/conf/$MYSQLDB.ini
fi
echo "The MySQL Database has now been created."
echo ""
echo "Now installing the System Libraries ..."
## Install PEAR Packages
pear upgrade pear
pear install --onlyreqdeps DB
pear install --onlyreqdeps DB_DataObject
pear install --onlyreqdeps Structures_DataGrid-beta
pear install --onlyreqdeps Structures_DataGrid_DataSource_DataObject-beta
pear install --onlyreqdeps Structures_DataGrid_DataSource_Array-beta
pear install --onlyreqdeps Structures_DataGrid_Renderer_HTMLTable-beta
pear install --onlyreqdeps HTTP_Client
pear install --onlyreqdeps HTTP_Request
pear install --onlyreqdeps Log
pear install --onlyreqdeps Mail
pear install --onlyreqdeps Mail_Mime
pear install --onlyreqdeps Net_SMTP
pear install --onlyreqdeps Pager
pear install --onlyreqdeps XML_Serializer-beta
pear install --onlyreqdeps Console_ProgressBar-beta
pear install --onlyreqdeps File_Marc-alpha
pear channel-discover pear.horde.org
pear channel-update pear.horde.org
pear install Horde/Horde_Yaml-beta
# Install Smarty into PHP Include Directory
PHPDIR=`pear config-get php_dir`
SMARTYDIR="$PHPDIR/Smarty"
SMARTYVER="2.6.26"
SMARTYFILE="Smarty-$SMARTYVER"
if [ ! -d $SMARTYDIR ]
then
wget http://www.smarty.net/files/$SMARTYFILE.tar.gz -O $SMARTYFILE.tar.gz
if [ ! -f $SMARTYFILE.tar.gz ]
then
echo "Unable to download Smarty templates (file=$SMARTYFILE.tar.gz)."
exit 1
fi
tar -zxf $SMARTYFILE.tar.gz
if [ "$?" -ne "0" ]
then
echo "Unable to extract archive $SMARTYFILE.tar.gz."
rm $SMARTYFILE.tar.gz
exit 1
fi
mkdir $SMARTYDIR
mv $SMARTYFILE/libs/* $SMARTYDIR
rm $SMARTYFILE.tar.gz
rm -rf $SMARTYFILE
fi
echo "VuFind Setup is now Complete"