Linux BASH Scripts
Last updated on
30 April 2025
For those wanting a quick start to using the Drupal Toolkit, the following Linux BASH scripts are provided for each installation method. These scripts provide a command-line interface to assist you in downloading, extracting, and installing all requirements.
#!/bin/sh
#set -x
#
# Downloads and prepares all components needed for eXtensible Catalog Drupal Toolkit demo site
#
DRUPAL_VERSION=6.25
CURRENT_DIR=`pwd`
get_web_directory() {
echo -n 'What is the Apache HTTP server web directory? (/var/www): '
read WWW_DIR
if [ "$WWW_DIR" = "" ]; then
WWW_DIR=/var/www
fi
}
get_drupal_name() {
echo -n 'What will be the directory name of your new Drupal? (xc-6.x-1.2): '
read DRUPAL_NAME
if [ "$DRUPAL_NAME" = "" ]; then
DRUPAL_NAME=xc-6.x-1.2
fi
}
get_solr_parent_dir() {
echo -n 'In which directory to put Apache Solr? ('$HOME'/solr): '
read SOLR_PARENT_DIR
if [ "$SOLR_PARENT_DIR" = "" ]; then
SOLR_PARENT_DIR=$HOME/solr
fi
}
get_solr_version() {
echo "Select Apache Solr version:"
echo " [1] = 1.4.1"
echo " [2] = 3.1.0"
echo " [3] = 3.2.0"
echo " [4] = 3.3.0"
echo "Selection: "
read NUMBER
SOLR_VERSION=3.3.0
case "$NUMBER" in
'1') SOLR_VERSION=1.4.1;;
'2') SOLR_VERSION=3.1.0;;
'3') SOLR_VERSION=3.2.0;;
'4') SOLR_VERSION=3.3.0;;
esac
}
get_download_directory() {
echo -n 'The directory where the script will download the necessay applications ('$HOME'/download/xc-6.x-1.2): '
read DOWNLOAD_DIR
if [ "$DOWNLOAD_DIR" = "" ]; then
DOWNLOAD_DIR=$HOME/download/xc-6.x-1.2
fi
}
get_mysql_settings() {
echo -n 'The name of MySQL database for the new Drupal: (xc_6x12) '
read DRUPAL_DB_NAME
if [ "$DRUPAL_DB_NAME" = "" ]; then
DRUPAL_DB_NAME=xc_6x12
fi
echo -n 'A MySQL user name for the Drupal database: (xc_user) '
read DRUPAL_DB_USER
if [ "$DRUPAL_DB_USER" = "" ]; then
DRUPAL_DB_USER=xc_user
fi
echo -n "The password of MySQL user for the Drupal database: (xCpa55) "
read DRUPAL_DB_PASS
if [ "$DRUPAL_DB_PASS" = "" ]; then
DRUPAL_DB_PASS=xCpa55
fi
echo -n 'The admin user of MySQL (input hidden): '
stty -echo
read MYSQL_USER
stty echo
echo ""
if [ "$MYSQL_USER" = "" ]; then
echo "Please enter the admin user name"
exit 1
fi
echo -n 'The password of MySQL admin (input hidden): '
stty -echo
read MYSQL_PASS
stty echo
echo ""
if [ "$MYSQL_PASS" = "" ]; then
echo "Please enter the admin password"
exit 1
fi
}
read_variables() {
echo "Please answer the following questions:"
echo ""
get_web_directory
get_drupal_name
get_solr_parent_dir
get_solr_version
get_download_directory
get_mysql_settings
}
set_variables() {
WWW_DIR=/var/www
DRUPAL_NAME=xc-6.x-1.2
SOLR_PARENT_DIR=$HOME/solr
SOLR_VERSION=3.3.0
DOWNLOAD_DIR=$HOME/download/xc-6.x-1.2
DRUPAL_DB_NAME=xc_6x12
DRUPAL_DB_USER=xc_user
DRUPAL_DB_PASS=xCpa55
MYSQL_USER=
MYSQL_PASS=
}
flush() {
echo "Your settings"
echo ""
echo 'Web root directory:' $WWW_DIR
echo 'Drupal name:' $DRUPAL_NAME
echo 'Solr parent directory:' $SOLR_PARENT_DIR
echo 'Solr version:' $SOLR_VERSION
echo 'Download directory:' $DOWNLOAD_DIR
echo 'The name of MySQL database for the new Drupal:' $DRUPAL_DB_NAME
echo 'The MySQL username for the Drupal database:' $DRUPAL_DB_USER
echo 'The password of MySQL user for the Drupal database:' $DRUPAL_DB_PASS
}
droptables() {
# this hack is from http://www.thingy-ma-jig.co.uk/blog/10-10-2006/mysql-drop-all-tables
mysqldump -u $MYSQL_USER -p$MYSQL_PASS --add-drop-table --no-data $DRUPAL_DB_NAME | grep ^DROP | mysql -u $MYSQL_USER -p$MYSQL_PASS $DRUPAL_DB_NAME
}
createdb() {
echo "check whether the database exists"
db_exists=`mysql -u $MYSQL_USER -p$MYSQL_PASS -e "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '$DRUPAL_DB_NAME'" | wc -c`
if [ $db_exists = 0 ]; then
echo "** create Drupal database $DRUPAL_DB_NAME..."
mysqladmin -u $MYSQL_USER -p$MYSQL_PASS create $DRUPAL_DB_NAME
else
echo "** Drupal database $DRUPAL_DB_NAME exists, drop tables..."
echo -n 'Are you sure, that you want to drop tables? (y/n) '
read do_drop
if [ $do_drop = y ]; then
droptables
else
echo 'The script does not drop tables'
fi
fi
create_user=0
echo "check whether the database user exists and has privilege"
user_exists=`mysql -u $MYSQL_USER -p$MYSQL_PASS -e "SELECT user FROM mysql.user WHERE user = '$DRUPAL_DB_USER'" | wc -c`
if [ $user_exists = 0 ]; then
create_user=1
else
user_has_privilage=`mysql -u $MYSQL_USER -p$MYSQL_PASS -e "SELECT User FROM mysql.db WHERE db = '$DRUPAL_DB_NAME' AND user = '$DRUPAL_DB_USER'" | wc -c`
if [ $user_has_privilage = 0 ]; then
create_user=1
fi
fi
if [ $create_user = 1 ]; then
echo "** create MySQL user $DRUPAL_DB_USER..."
mysql -u $MYSQL_USER -p$MYSQL_PASS -e "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES, CREATE TEMPORARY TABLES ON $DRUPAL_DB_NAME.* TO '$DRUPAL_DB_USER'@'localhost' IDENTIFIED BY '$DRUPAL_DB_PASS';FLUSH PRIVILEGES;" $DRUPAL_DB_NAME
else
echo 'The user already exists and has appropriate privilege'
fi
}
# download and extract Drupal and setup filesystem
drupal_download() {
if [ ! -e $DOWNLOAD_DIR ]; then
mkdir -p $DOWNLOAD_DIR
fi
cd $DOWNLOAD_DIR
# get actual Drupal
if [ ! -e drupal-$DRUPAL_VERSION.tar.gz ]; then
echo "** downloading Drupal... $DRUPAL_VERSION"
wget http://ftp.drupal.org/files/projects/drupal-$DRUPAL_VERSION.tar.gz
fi
if [ ! -d $WWW_DIR/$DRUPAL_NAME ]; then
# uncompress
echo '** extracting Drupal...'
tar -zxf drupal-$DRUPAL_VERSION.tar.gz
# move to the web directory
mv drupal-$DRUPAL_VERSION $WWW_DIR/$DRUPAL_NAME
fi
cd $WWW_DIR/$DRUPAL_NAME
echo '** prepare Drupal setting files...'
if [ ! -e sites/default/settings.php ]; then
cp sites/default/default.settings.php sites/default/settings.php
fi
chmod a+w sites/default/
chmod a+w sites/default/settings.php
cd sites/all
if [ ! -d modules ]; then
mkdir modules
fi
if [ ! -d themes ]; then
mkdir themes
fi
if [ ! -d libraries ]; then
mkdir libraries
fi
cd $CURRENT_DIR
}
# download XC profile
drupal_profile() {
# setup profile
echo "** setup profile..."
cd $WWW_DIR/$DRUPAL_NAME/profiles/
if [ ! -d xc_installation ]; then
git clone --branch master http://git.drupal.org/project/xc_installation.git
fi
cd $CURRENT_DIR
}
# download necessary modules to $DOWNLOAD_DIR
drupal_modules() {
# prepare module and theme directories
echo '** prepare module and theme directories...'
if [ ! -e $DOWNLOAD_DIR ]; then
mkdir $DOWNLOAD_DIR
fi
cd $DOWNLOAD_DIR
if [ ! -d $WWW_DIR/$DRUPAL_NAME/sites/all/modules/addthis ]; then
echo "** downloading addthis module..."
VERSION=6.x-3.0-beta1
if [ ! -e addthis-$VERSION.tar.gz ]; then
wget http://ftp.drupal.org/files/projects/addthis-$VERSION.tar.gz
fi
tar -zxf addthis-$VERSION.tar.gz
mv addthis $WWW_DIR/$DRUPAL_NAME/sites/all/modules
fi
if [ ! -d $WWW_DIR/$DRUPAL_NAME/sites/all/modules/admin_menu ]; then
echo "** downloading admin_menu module..."
VERSION=6.x-1.8
if [ ! -e admin_menu-$VERSION.tar.gz ]; then
wget http://ftp.drupal.org/files/projects/admin_menu-$VERSION.tar.gz
fi
tar -zxf admin_menu-$VERSION.tar.gz
mv admin_menu $WWW_DIR/$DRUPAL_NAME/sites/all/modules
fi
if [ ! -d $WWW_DIR/$DRUPAL_NAME/sites/all/modules/fieldset_helper ]; then
echo '** downloading fieldset_helper module...'
VERSION=6.x-1.0
if [ ! -e fieldset_helper-$VERSION.tar.gz ]; then
wget http://ftp.drupal.org/files/projects/fieldset_helper-$VERSION.tar.gz
fi
tar -zxf fieldset_helper-$VERSION.tar.gz
mv fieldset_helper $WWW_DIR/$DRUPAL_NAME/sites/all/modules
fi
if [ ! -d $WWW_DIR/$DRUPAL_NAME/sites/all/modules/lightbox2 ]; then
echo '** downloading lightbox2 module...'
VERSION=6.x-1.11
if [ ! -e lightbox2-$VERSION.tar.gz ]; then
wget http://ftp.drupal.org/files/projects/lightbox2-$VERSION.tar.gz
fi
tar -zxf lightbox2-$VERSION.tar.gz
mv lightbox2 $WWW_DIR/$DRUPAL_NAME/sites/all/modules
fi
if [ ! -d $WWW_DIR/$DRUPAL_NAME/sites/all/modules/print ]; then
echo '** downloading print module...'
VERSION=6.x-1.12
if [ ! -e print-$VERSION.tar.gz ]; then
wget http://ftp.drupal.org/files/projects/print-$VERSION.tar.gz
fi
tar -zxf print-$VERSION.tar.gz
mv print $WWW_DIR/$DRUPAL_NAME/sites/all/modules
fi
MODULE=jquery_ui_dialog
if [ ! -d $WWW_DIR/$DRUPAL_NAME/sites/all/modules/$MODULE ]; then
# download jquery ui dialog from Git repository
echo "** downloading $MODULE module..."
cd $WWW_DIR/$DRUPAL_NAME/sites/all/modules/
if [ ! -d jquery_ui_dialog ]; then
git clone --branch master git://github.com/EugenMayer/jquery_ui_dialog.git
fi
cd $CURRENT_DIR
fi
MODULE=jquery_ui
if [ ! -d $WWW_DIR/$DRUPAL_NAME/sites/all/modules/$MODULE ]; then
echo "** downloading $MODULE module..."
VERSION=6.x-1.5
if [ ! -e $MODULE-$VERSION.tar.gz ]; then
wget http://ftp.drupal.org/files/projects/$MODULE-$VERSION.tar.gz
fi
tar -zxf $MODULE-$VERSION.tar.gz
mv $MODULE $WWW_DIR/$DRUPAL_NAME/sites/all/modules
fi
MODULE=jquery_update
if [ ! -d $WWW_DIR/$DRUPAL_NAME/sites/all/modules/$MODULE ]; then
echo "** downloading $MODULE module..."
VERSION=6.x-2.0-alpha1
if [ ! -e $MODULE-$VERSION.tar.gz ]; then
wget http://ftp.drupal.org/files/projects/$MODULE-$VERSION.tar.gz
fi
tar -zxf $MODULE-$VERSION.tar.gz
mv $MODULE $WWW_DIR/$DRUPAL_NAME/sites/all/modules
fi
LIB=jquery.ui
if [ ! -d $WWW_DIR/$DRUPAL_NAME/sites/all/libraries/$LIB ]; then
echo "** downloading $LIB library..."
VERSION=1.6
if [ ! -e $LIB-$VERSION.zip ]; then
wget http://jquery-ui.googlecode.com/files/$LIB-$VERSION.zip
fi
unzip $LIB-$VERSION.zip
mv $LIB-$VERSION $LIB
mv $LIB $WWW_DIR/$DRUPAL_NAME/sites/all/libraries
fi
if [ ! -d $WWW_DIR/$DRUPAL_NAME/sites/all/themes/xc_theme ]; then
echo "** downloading theme xc_theme..."
VERSION=6.x-1.2
if [ ! -e xc_theme-$VERSION.tar.gz ]; then
wget http://ftp.drupal.org/files/projects/xc_theme-$VERSION.tar.gz
fi
tar -zxf xc_theme-$VERSION.tar.gz
mv xc_theme $WWW_DIR/$DRUPAL_NAME/sites/all/themes
fi
MODULE=xc
if [ ! -d $WWW_DIR/$DRUPAL_NAME/sites/all/modules/$MODULE ]; then
echo "** downloading $MODULE module..."
VERSION=6.x-1.2
if [ ! -e $MODULE-$VERSION.tar.gz ]; then
wget http://ftp.drupal.org/files/projects/$MODULE-$VERSION.tar.gz
fi
tar -zxf $MODULE-$VERSION.tar.gz
mv $MODULE $WWW_DIR/$DRUPAL_NAME/sites/all/modules
fi
# download XC from Git
# if [ ! -d $WWW_DIR/$DRUPAL_NAME/sites/all/modules/xc ]; then
# cd $WWW_DIR/$DRUPAL_NAME/sites/all/modules
# echo "** downloading xc module..."
# git clone --branch 6.x-1.x http://git.drupal.org/project/xc.git
# fi
# apply fieldset_helper patch
cd $WWW_DIR/$DRUPAL_NAME/sites/all/modules/fieldset_helper
pwd
cp ../xc/hook_fieldset_helper_path_alter-823318-4.patch .
cp fieldset_helper.module fieldset_helper.module.bak
patch -p1 fieldset_helper.module hook_fieldset_helper_path_alter-823318-4.patch
cd $CURRENT_DIR
}
# download, extract and prepare Solr
solr_download() {
if [ ! -e $DOWNLOAD_DIR ]; then
mkdir $DOWNLOAD_DIR
fi
cd $DOWNLOAD_DIR
echo '** checking Apache Solr...'
if [ ! -e apache-solr-$SOLR_VERSION.tgz ]; then
wget http://www.apache.org/dist/lucene/solr/$SOLR_VERSION/apache-solr-$SOLR_VERSION.tgz
fi
solr_instance=$SOLR_PARENT_DIR/apache-solr-$SOLR_VERSION/example
echo '** extracting Solr...'
if [ ! -e apache-solr-$SOLR_VERSION ]; then
tar -zxf apache-solr-$SOLR_VERSION.tgz
# SOLR_PARENT_DIR
if [ ! -e $SOLR_PARENT_DIR ]; then
mkdir $SOLR_PARENT_DIR
fi
cp -r apache-solr-$SOLR_VERSION $SOLR_PARENT_DIR/apache-solr-$SOLR_VERSION
conf_dir=$solr_instance/solr/conf
resources=$WWW_DIR/$DRUPAL_NAME/sites/all/modules/xc/xc_solr/resources
# save original config files
cp $WWW_DIR/$DRUPAL_NAME/sites/all/modules/xc/xc_solr/resources/solr.* $solr_instance
if [ ! -e $conf_dir/solrconfig-orig.xml ]; then
mv $conf_dir/solrconfig.xml $conf_dir/solrconfig-orig.xml
mv $conf_dir/schema.xml $conf_dir/schema-orig.xml
fi
# copy Solr configuration file
if [ -e $resources/solrconfig-for-$SOLR_VERSION.xml ]; then
cp $resources/solrconfig-for-$SOLR_VERSION.xml $conf_dir/solrconfig.xml
else
cp $resources/solrconfig.xml $conf_dir
fi
# copy Solr schema file
if [ -e $resources/schema-for-$SOLR_VERSION.xml ]; then
cp $resources/schema-for-$SOLR_VERSION.xml $conf_dir/schema.xml
else
cp $resources/schema.xml $conf_dir
fi
# copy jar files
SOLR_DIR=$SOLR_PARENT_DIR/apache-solr-$SOLR_VERSION
mkdir $solr_instance/solr/lib
SOLR_LIB=$solr_instance/solr/lib
case "$SOLR_VERSION" in
'1.4.0')
;;
'3.1.0')
cp $SOLR_DIR/dist/apache-solr-analysis-extras-$SOLR_VERSION.jar $SOLR_LIB
cp $SOLR_DIR/contrib/analysis-extras/lib/icu4j-4_6.jar $SOLR_LIB
cp $SOLR_DIR/contrib/analysis-extras/lucene-libs/lucene-icu-$SOLR_VERSION.jar $SOLR_LIB
;;
'3.2.0')
cp $SOLR_DIR/dist/apache-solr-analysis-extras-$SOLR_VERSION.jar $SOLR_LIB
cp $SOLR_DIR/contrib/analysis-extras/lib/icu4j-4_6.jar $SOLR_LIB
cp $SOLR_DIR/contrib/analysis-extras/lucene-libs/lucene-icu-$SOLR_VERSION.jar $SOLR_LIB
;;
'3.3.0')
cp $SOLR_DIR/dist/apache-solr-analysis-extras-$SOLR_VERSION.jar $SOLR_LIB
cp $SOLR_DIR/contrib/analysis-extras/lib/icu4j-4_8.jar $SOLR_LIB
cp $SOLR_DIR/contrib/analysis-extras/lucene-libs/lucene-icu-$SOLR_VERSION.jar $SOLR_LIB
;;
esac
fi
cd $solr_instance
chmod +x solr.s*
cd $CURRENT_DIR
}
# start Solr
solr_start() {
if [ "$SOLR_PARENT_DIR" = "" ]; then
get_solr_parent_dir
get_solr_version
fi
solr_instance=$SOLR_PARENT_DIR/apache-solr-$SOLR_VERSION/example
echo '** Starting Solr...'
cd $solr_instance
./solr.sh start
cd $CURRENT_DIR
}
# stop Solr
solr_stop() {
if [ "$SOLR_PARENT_DIR" = "" ]; then
get_solr_parent_dir
get_solr_version
fi
solr_instance=$SOLR_PARENT_DIR/apache-solr-$SOLR_VERSION/example
echo '** Stoping Solr...'
cd $solr_instance
./solr.sh stop
cd $CURRENT_DIR
}
welcome() {
echo 'Welcome to eXtensible Catalog Drupal Toolkit installation'
echo ''
}
# all things together
all() {
echo '**********************************'
echo '** installing XC Drupal Toolkit **'
echo '**********************************'
welcome
read_variables
createdb
drupal_download
drupal_profile
drupal_modules
solr_download
solr_start
echo '*******************************************'
echo '** installing XC Drupal Toolkit finished **'
echo '*******************************************'
}
# profile - use with profile installation
profile() {
echo '**********************************'
echo '** installing XC Drupal Toolkit **'
echo '**********************************'
welcome
read_variables
createdb
drupal_download
drupal_profile
drupal_modules
solr_download
solr_start
echo '*******************************************'
echo '** installing XC Drupal Toolkit finished **'
echo '*******************************************'
}
# only drupal
drupal() {
echo '**********************************'
echo '** installing XC Drupal Toolkit **'
echo '**********************************'
welcome
read_variables
createdb
drupal_download
drupal_profile
drupal_modules
echo '*******************************************'
echo '** installing XC Drupal Toolkit finished **'
echo '*******************************************'
}
help() {
welcome
# echo "Usage: $0 {all|drupal|createdb|solr_start|solr_stop|solr_spellcheck|help}"
echo "Usage: $0 {all|drupal|createdb|droptables|solr_start|solr_stop|help}"
echo " all - prepare Drupal and Apache Solr files for XC"
echo " drupal - prepare Drupal files for XC"
echo " createdb - create database for Drupal"
echo " droptables - drop all tables from Drupal database"
echo " solr_start - start Apache Solr"
echo " solr_stop - stop Apache Solr"
echo " help - this help info"
# echo " solr_spellcheck - create spellcheck index for Apache Solr"
echo ""
echo "If you just start, select the 'all' task. Please adjust the configuration section of this script."
}
case "$1" in
createdb)
createdb
;;
all)
all
;;
drupal)
drupal
;;
solr_start)
solr_start
;;
solr_stop)
solr_stop
;;
droptables)
droptables
;;
help)
help
;;
*)
help
esac
exit $?
DRUPAL_NAME=xc-6.x-1.2
DISTRO_VERSION=6.x-1.2
SOLR_VERSION=3.3.0
JQUERY_UI_VERSION=1.6
download() {
if [ "$HAS_WGET" = "1" ]; then
wget -q $1
elif [ "$HAS_CURL" = "1" ]; then
curl -O $1
fi
}
download_requirement_check() {
HAS_WGET=`command -v wget >/dev/null && echo "1" || echo "0"`
HAS_CURL=`command -v curl >/dev/null && echo "1" || echo "0"`
if [ "$HAS_WGET" = "0" -a "$HAS_CURL" = "0" ]; then
echo "Please install either wget or curl"
echo ""
echo "Or download these files manually:"
echo "http://ftp.drupal.org/files/projects/xc_installation-$DISTRO_VERSION-core.tar.gz"
echo "http://jquery-ui.googlecode.com/files/jquery.ui-1.6.zip"
echo "http://www.apache.org/dist/lucene/solr/$SOLR_VERSION/apache-solr-$SOLR_VERSION.tgz"
exit;
fi
}
requirement_check() {
HAS_PATCH=`command -v patch >/dev/null && echo "1" || echo "0"`
HAS_GIT=`command -v git >/dev/null && echo "1" || echo "0"`
HAS_JAVA=`command -v java >/dev/null && echo "1" || echo "0"`
if [ "$HAS_PATCH" = "0" -a "$HAS_GIT" = "0" ]; then
echo "To install the software correctly we have to modify some files in contibuted modules."
echo "This process requires the 'patch' or 'git' tools. Please install them first."
exit;
fi
if [ "$HAS_JAVA" = "0" ]; then
echo "To run Solr Java is a must have. Please install it."
exit;
fi
}
download_all() {
if [ ! -e xc_installation-$DISTRO_VERSION-core.tar.gz ]; then
download_requirement_check
echo "Downloading distribution"
download http://ftp.drupal.org/files/projects/xc_installation-$DISTRO_VERSION-core.tar.gz
fi
if [ ! -e jquery.ui-$JQUERY_UI_VERSION.zip ]; then
download_requirement_check
echo "Downloading jQuery UI"
download http://jquery-ui.googlecode.com/files/jquery.ui-$JQUERY_UI_VERSION.zip
fi
if [ ! -e apache-solr-$SOLR_VERSION.tgz ]; then
download_requirement_check
echo "Downloading Apache Solr"
download http://www.apache.org/dist/lucene/solr/$SOLR_VERSION/apache-solr-$SOLR_VERSION.tgz
fi
}
rm -rf $DRUPAL_NAME
rm -rf apache-solr-$SOLR_VERSION-xc-6.x-1.2
requirement_check
download_all
CWD=`pwd`
echo "Prepare Drupal"
tar xzf xc_installation-$DISTRO_VERSION-core.tar.gz
mv drupal-6.22 $DRUPAL_NAME
cd $DRUPAL_NAME
if [ ! -e sites/default/settings.php ]; then
cp sites/default/default.settings.php sites/default/settings.php
fi
chmod a+w sites/default/
chmod a+w sites/default/settings.php
# move modules and theme to sites/all
mv profiles/xc_installation/modules sites/all/modules
mv profiles/xc_installation/themes sites/all/themes
cd sites/all
if [ ! -d libraries ]; then
mkdir libraries
fi
# patching fieldset_helper
echo "Patching fieldset_helper"
cd modules/fieldset_helper
pwd
cp ../xc/xc_util/patches/hook_fieldset_helper_path_alter-823318-4.patch .
cp fieldset_helper.module fieldset_helper.module.bak
patch -p1 fieldset_helper.module hook_fieldset_helper_path_alter-823318-4.patch
# go home directory
cd $CWD
# patching autocomplete
echo "Patching autocomplete"
cd $DRUPAL_NAME
pwd
cp sites/all/modules/xc/xc_util/patches/xc-autocomplete.patch .
cp misc/autocomplete.js misc/autocomplete.js.bak
patch -p1 misc/autocomplete.js xc-autocomplete.patch
rm xc-autocomplete.patch
# go home directory
cd $CWD
# jquery.ui
unzip -q jquery.ui-$JQUERY_UI_VERSION.zip
mv jquery.ui-$JQUERY_UI_VERSION jquery.ui
mv jquery.ui $DRUPAL_NAME/sites/all/libraries
echo "The preparation was successfull"
echo "The Solr part"
solr_instance=apache-solr-$SOLR_VERSION/example
echo '** extracting Solr...'
tar -zxf apache-solr-$SOLR_VERSION.tgz
conf_dir=$solr_instance/solr/conf
resources=$DRUPAL_NAME/sites/all/modules/xc/xc_solr/resources
# save original config files
cp $resources/solr.* $solr_instance
if [ ! -e $conf_dir/solrconfig-orig.xml ]; then
mv $conf_dir/solrconfig.xml $conf_dir/solrconfig-orig.xml
mv $conf_dir/schema.xml $conf_dir/schema-orig.xml
fi
# copy Solr configuration file
if [ -e $resources/solrconfig-for-$SOLR_VERSION.xml ]; then
cp $resources/solrconfig-for-$SOLR_VERSION.xml $conf_dir/solrconfig.xml
else
cp $resources/solrconfig.xml $conf_dir
fi
# copy Solr schema file
if [ -e $resources/schema-for-$SOLR_VERSION.xml ]; then
cp $resources/schema-for-$SOLR_VERSION.xml $conf_dir/schema.xml
else
cp $resources/schema.xml $conf_dir
fi
# copy jar files
SOLR_DIR=apache-solr-$SOLR_VERSION
SOLR_LIB=$solr_instance/solr/lib
mkdir $SOLR_LIB
cp $SOLR_DIR/dist/apache-solr-analysis-extras-$SOLR_VERSION.jar $SOLR_LIB
cp $SOLR_DIR/contrib/analysis-extras/lib/icu4j-4_8.jar $SOLR_LIB
cp $SOLR_DIR/contrib/analysis-extras/lucene-libs/lucene-icu-$SOLR_VERSION.jar $SOLR_LIB
cd $solr_instance
chmod +x solr.s*
cd $CWD
mv $SOLR_DIR $SOLR_DIR-xc-6.x-1.2
echo -n 'In which directory to put Apache Solr? ('$HOME'/solr): '
read SOLR_PARENT_DIR
if [ "$SOLR_PARENT_DIR" = "" ]; then
SOLR_PARENT_DIR=$HOME/solr
fi
if [ ! -e $SOLR_PARENT_DIR ]; then
mkdir $SOLR_PARENT_DIR
fi
if [ -e $SOLR_PARENT_DIR/$SOLR_DIR-xc-6.x-1.2 ]; then
rm -rf $SOLR_PARENT_DIR/$SOLR_DIR-xc-6.x-1.2
fi
mv $SOLR_DIR-xc-6.x-1.2 $SOLR_PARENT_DIR
echo -n 'What is the Apache HTTP server web directory? (/var/www): '
read WWW_DIR
if [ "$WWW_DIR" = "" ]; then
WWW_DIR=/var/www
fi
if [ -e $WWW_DIR/$DRUPAL_NAME ]; then
rm -rf $WWW_DIR/$DRUPAL_NAME
fi
mv $DRUPAL_NAME $WWW_DIR
echo "Start Solr"
cd $SOLR_PARENT_DIR/$SOLR_DIR-xc-6.x-1.2/example
./solr.sh start
cd $CWD
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion