seperated iipsrv from mirador and add some more questions

This commit is contained in:
rnsrk 2021-11-18 22:30:54 +01:00
parent 5a0db4ac69
commit 65989d2473

View file

@ -324,6 +324,7 @@ then
break;; break;;
[Nn]* ) [Nn]* )
echo -e "${GREEN}Okay, to visit your website later on, you have to type http://localhost/${WEBSITENAME}"; echo -e "${GREEN}Okay, to visit your website later on, you have to type http://localhost/${WEBSITENAME}";
echo -e "${RED}If you install IIP Image Server , you need http://${WEBSITENAME} as a host or you get cross origin problems!${NC}";
break;; break;;
* ) echo "Please answer yes or no.";; * ) echo "Please answer yes or no.";;
esac esac
@ -446,156 +447,148 @@ then
fi fi
# create database user and database # create database user and database
echo echo -e "${YELLOW}Do you want to create a database and a database user?"
echo -e "${YELLOW}Create database and user for Drupal. Please note your inputs, they will be needed in a moment." echo -e "${YELLOW}If you have a database and database user, please ensure you know the credentials!"
CORRECTDATABASE=false
CORRECTUSER=false while true; do
FINISHED=false read -p "(y/n): " CREATEDBANDDBUSER
while [[ $CORRECTDATABASE == false ]] && [[ $CORRECTUSER == false ]]; do case $CREATEDBANDDBUSER in
while [[ $FINISHED == false ]]; do [Yy]* )
echo -e "${YELLOW}Enter name of the Database, you want to create:${NC}"
read DB
if [[ ! -z "`mysql -qfsBe "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='${DB}'" 2>&1`" ]]; then
echo echo
echo -e "${RED}Database already exists!" echo -e "${YELLOW}Create database and user for Drupal. Please note your inputs, they will be needed in a moment."
echo -e "Should I drop it and recreate? Attention: All data will be lost and can not be recovered!${NC}" CORRECTDATABASE=false
while true; do CORRECTUSER=false
read -p "(recreate/keep/rename/abort): " SURE FINISHED=false
case $SURE in while [[ $CORRECTDATABASE == false ]] && [[ $CORRECTUSER == false ]]; do
[recreate]* ) while [[ $FINISHED == false ]]; do
mysql -e "DROP DATABASE ${DB};" echo -e "${YELLOW}Enter name of the Database, you want to create:${NC}"
read DB
if [[ ! -z "`mysql -qfsBe "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='${DB}'" 2>&1`" ]]; then
echo
echo -e "${RED}Database already exists!"
echo -e "Should I drop it and recreate? Attention: All data will be lost and can not be recovered!${NC}"
while true; do
read -p "(recreate/keep/retry/abort): " SURE
case $SURE in
[recreate]* )
mysql -e "DROP DATABASE ${DB};"
mysql -e "CREATE DATABASE ${DB} ;"
echo -e "${GREEN}Recreated database ${DB}."
FINISHED=true
break;;
[keep]* )
echo -e "${GREEN}Okay keep old database..."
FINISHED=true
break;;
[retry]* )
echo -e "${GREEN}Okay, then..."
break;;
[abort]* )
echo -e "${GREEN}Okay, bye"
exit;;
* ) echo "Please answer y[es], n[o], rename or abort!";;
esac
done
else
mysql -e "CREATE DATABASE ${DB} ;" mysql -e "CREATE DATABASE ${DB} ;"
echo -e "${GREEN}Recreated database ${DB}." echo -e "${GREEN}Created database ${DB}."
FINISHED=true FINISHED=true
break;; CORRECTDATABASE=true
[keep]* ) fi
echo -e "${GREEN}Okay keep old database..." done
FINISHED=true FINISHED=false
break;; while [[ $FINISHED == false ]]; do
[retry]* )
echo -e "${GREEN}Okay, then..."
break;;
[abort]* )
echo -e "${GREEN}Okay, bye"
exit;;
* ) echo "Please answer y[es], n[o], rename or abort!";;
esac
done
else
mysql -e "CREATE DATABASE ${DB} ;"
echo -e "${GREEN}Created database ${DB}."
FINISHED=true
CORRECTDATABASE=true
fi
done
FINISHED=false
while [[ $FINISHED == false ]]; do
echo
echo -e "${YELLOW}Enter name of the user you want to create:${NC}"
read USER
echo -e "${YELLOW}Enter passwort of that user:${NC}"
read USERPW
echo
echo -e "${GREEN}Database username: ${USER}"
echo -e "Database user password: ${USERPW}"
echo -e "${YELLOW}Is that correct?${NC}"
while true; do
read -p "(y/n): " SURE
case $SURE in
[Yy]* )
if [[ ! -z "`mysql -qfsBe "SELECT User FROM mysql.user WHERE User = '${USER}'" 2>&1`" ]];
then
echo echo
echo -e "${RED}User already exists!" echo -e "${YELLOW}Enter name of the user you want to create:${NC}"
echo -e "Should I drop it and recreate or keep existing user?${NC}" read USER
echo -e "${YELLOW}Enter passwort of that user:${NC}"
read USERPW
echo
echo -e "${GREEN}Database username: ${USER}"
echo -e "Database user password: ${USERPW}"
echo -e "${YELLOW}Is that correct?${NC}"
while true; do while true; do
read -p "(recreate/keep): " SURE read -p "(y/n): " SURE
case $SURE in case $SURE in
[recreate]* ) [Yy]* )
mysql -e "DROP USER ${DB}@'localhost';" if [[ ! -z "`mysql -qfsBe "SELECT User FROM mysql.user WHERE User = '${USER}'" 2>&1`" ]];
then
echo
echo -e "${RED}User already exists!"
echo -e "Should I drop it and recreate or keep existing user?${NC}"
while true; do
read -p "(recreate/keep): " SURE
case $SURE in
[recreate]* )
mysql -e "DROP USER ${DB}@'localhost';"
mysql -e "CREATE USER ${DB}@localhost IDENTIFIED BY '${USERPW}';"
mysql -e "GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'localhost';"
mysql -e "FLUSH PRIVILEGES;"
echo -e "${GREEN}Recreated User ${USER}."
FINISHED=true
CORRECTUSER=true
break;;
[keep]* )
unset USERPW
echo
echo -e "${GREEN}Okay keep existing user."
while [[ -z ${USERPW} ]]; do
echo -e "${YELLOW}What is the password of this user?"
echo -e "${RED}Be sure that the password is correct!${NC}"
read USERPW
while true; do
echo
echo -e "${GREEN}User password is: ${USERPW}"
echo -e "${YELLOW}Is this correct?${NC}"
read -p "(y/n): " SURE
case $SURE in
[Yy]* )
CORRECTUSER=true
break;;
[Nn]* )
unset USERPW
break;;
[abort]* )
echo -e "${GREEN}Okay, bye"
exit;;
* ) echo "Please answer y[es], n[o] or abort!";;
esac
done
done
FINISHED=true
break;;
* ) echo "Please answer y[es] or keep.";;
esac
done
else
mysql -e "CREATE USER ${DB}@localhost IDENTIFIED BY '${USERPW}';" mysql -e "CREATE USER ${DB}@localhost IDENTIFIED BY '${USERPW}';"
mysql -e "GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'localhost';" mysql -e "GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'localhost';"
mysql -e "FLUSH PRIVILEGES;" mysql -e "FLUSH PRIVILEGES;"
echo -e "${GREEN}Recreated User ${USER}." echo
echo -e "${GREEN}Created User ${USER}."
FINISHED=true FINISHED=true
CORRECTUSER=true CORRECTUSER=true
fi
break;; break;;
[keep]* ) [Nn]* )
unset USERPW echo -e "${GREEN}Okay then..."
echo
echo -e "${GREEN}Okay keep existing user."
while [[ -z ${USERPW} ]]; do
echo -e "${YELLOW}What is the password of this user?"
echo -e "${RED}Be sure that the password is correct!${NC}"
read USERPW
while true; do
echo
echo -e "${GREEN}User password is: ${USERPW}"
echo -e "${YELLOW}Is this correct?${NC}"
read -p "(y/n): " SURE
case $SURE in
[Yy]* )
CORRECTUSER=true
break;;
[Nn]* )
unset USERPW
break;;
[abort]* )
echo -e "${GREEN}Okay, bye"
exit;;
* ) echo "Please answer y[es], n[o] or abort!";;
esac
done
done
FINISHED=true
break;; break;;
* ) echo "Please answer y[es] or keep.";; * ) echo -e "${RED}Please answer y[es] or n[o].";;
esac esac
done done
else done
mysql -e "CREATE USER ${DB}@localhost IDENTIFIED BY '${USERPW}';" done
mysql -e "GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'localhost';" echo
mysql -e "FLUSH PRIVILEGES;" echo -e "${GREEN}Created ${DB} database with ${USER}@localhost identified by ${USERPW}."
echo sleep 1
echo -e "${GREEN}Created User ${USER}."
FINISHED=true
CORRECTUSER=true
fi
break;;
[Nn]* )
echo -e "${GREEN}Okay then..."
break;;
* ) echo -e "${RED}Please answer y[es] or n[o].";;
esac
done
done
done
echo
echo -e "${GREEN}Created ${DB} database with ${USER}@localhost identified by ${USERPW}."
sleep 1
# install drupal with drush
echo
echo -e "${GREEN}You are ready to install Drupal! It will be installed under /var/www/html/$WEBSITENAME."
echo -e "${YELLOW}Should I start?${NC}"
while true; do
read -p "(y/n): " INSTALLDRUPAL
case $INSTALLDRUPAL in
[Yy]* )
echo -e "${GREEN}Okay, I will start installation!"
break;; break;;
[Nn]* ) [Nn]* )
echo -e "${GREEN}Okay bye." break;;
exit;;
* ) echo "Please answer y[es] or n[o].";; * ) echo "Please answer y[es] or n[o].";;
esac esac
done done
cd /var/www/html/
if ! command -v composer &> /dev/null if ! command -v composer &> /dev/null
then then
echo echo
@ -616,26 +609,45 @@ then
done done
fi fi
# install drupal with drush
echo echo
echo -e "${RED}Composer will scold you for being root, do not worry, we take care of this later - answer always \"y\".${NC}" echo -e "${GREEN}You are ready to install Drupal! It will be installed under /var/www/html/$WEBSITENAME."
echo echo -e "${YELLOW}Should I download and install Drupal?${NC}"
composer create-project drupal/recommended-project $WEBSITENAME while true; do
chown -R www-data:www-data $WEBSITENAME read -p "(y/n/skip): " INSTALLDRUPAL
chmod 775 -R $WEBSITENAME case $INSTALLDRUPAL in
[Yy]* )
echo -e "${GREEN}Okay, I will start installation!"
cd /var/www/html/
echo
echo -e "${RED}Composer will scold you for being root, do not worry, we take care of this later - answer always \"y\".${NC}"
echo
composer create-project drupal/recommended-project $WEBSITENAME
chown -R www-data:www-data $WEBSITENAME
chmod 775 -R $WEBSITENAME
echo echo
echo -e "${GREEN}Installing WissKI with some modules (you have to activate them later).${NC}" echo -e "${GREEN}Installing WissKI with some modules (you have to activate them later).${NC}"
echo echo
cd /var/www/html/$WEBSITENAME cd /var/www/html/$WEBSITENAME
composer require drupal/colorbox drupal/devel drush/drush drupal/imagemagick drupal/image_effects 'drupal/inline_entity_form:1.x-dev@dev' 'drupal/wisski:^3.0@RC' composer require drupal/colorbox drupal/devel drush/drush drupal/imagemagick drupal/image_effects 'drupal/inline_entity_form:1.x-dev@dev' 'drupal/wisski:3.x-dev@dev'
cd web/modules/contrib/wisski cd web/modules/contrib/wisski
echo
echo -e "${GREEN}Autoload WissKI dependencies.${NC}"
echo
composer update
cd /var/www/html/$WEBSITENAME
echo
echo -e "${GREEN}Autoload WissKI dependencies.${NC}"
echo
composer update
cd /var/www/html/$WEBSITENAME
break;;
[Nn]* )
echo -e "${GREEN}Okay bye."
exit;;
[skip]* )
echo -e "${GREEN}Okay skipping."
break;;
* ) echo "Please answer y[es] or n[o].";;
esac
done
echo echo
echo -e "${YELLOW}Do you like to get colorbox library?${NC}" echo -e "${YELLOW}Do you like to get colorbox library?${NC}"
@ -661,22 +673,21 @@ while true; do
done done
echo echo
echo -e "${YELLOW}Do you like to get mirador library with the IIP Image Server?${NC}" echo -e "${YELLOW}Do like to install the IIP Image Server?${NC}"
echo -e "${YELLOW}This will download and install the IIP Image Server at /fcgi-bin/iipsrv.fcgi,${NC}"
echo -e "${YELLOW}create a iipsrv configuration file at /etc/apache2/mods-available/iipsrv.conf,${NC}"
echo -e "${YELLOW}and enable the iipsrv mod.${NC}"
echo echo
while true; do while true; do
read -p "(y/n): " INSTALLMIRADOR read -p "(y/n): " INSTALLIIPSRV
case ${INSTALLMIRADOR} in case ${INSTALLIIPSRV} in
[Yy]* ) [Yy]* )
mkdir -p web/libraries
## get mirador
wget http://wisskieu.nasarek.org/sites/default/files/assets/mirador.zip -P web/libraries/
unzip web/libraries/mirador.zip -d web/libraries/ &> /dev/null
sudo apt-get install \ sudo apt-get install \
autoconf \ autoconf \
automake \ automake \
iipimage-server \ git \
iipimage-doc \ libapache2-mod-fcgid \
libfreetype6-dev \ libfreetype6-dev \
libjpeg-dev \ libjpeg-dev \
libopenjp2-7 \ libopenjp2-7 \
@ -689,7 +700,8 @@ while true; do
libtool \ libtool \
libmemcached11 \ libmemcached11 \
libmemcached-dev \ libmemcached-dev \
imagemagick -y imagemagick \
pkg-config -y
# the directory of the script # the directory of the script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@ -718,12 +730,64 @@ while true; do
./autogen.sh && \ ./autogen.sh && \
./configure && \ ./configure && \
make make
cp src/iipsrv.fcgi /usr/lib/iipimage-server/iipsrv.fcgi mkdir -p /fcgi-bin
cp src/iipsrv.fcgi /fcgi-bin/iipsrv.fcgi
cd ${DIR} cd ${DIR}
FCGICONFIG=$'<IfModule mod_fcgid.c>
ScriptAlias /fcgi-bin/ "/fcgi-bin/"
<Location "/fcgi-bin/">
AllowOverride None
Options None
Require all granted
<IfModule mod_mime.c>
AddHandler fcgid-script .fcgi
</IfModule>
</Location>
# Set our environment variables for the IIP server
FcgidInitialEnv VERBOSITY "1"
FcgidInitialEnv LOGFILE "/var/log/iipsrv.log"
FcgidInitialEnv MAX_IMAGE_CACHE_SIZE "10"
FcgidInitialEnv JPEG_QUALITY "90"
FcgidInitialEnv MAX_CVT "5000"
FcgidInitialEnv MEMCACHED_SERVERS "localhost"
# Define the idle timeout as unlimited and the number of
# processes we want
FcgidConnectTimeout 20
FcgidIdleTimeout 0
FcgidMaxProcessesPerClass 1
</IfModule>'
echo "${FCGICONFIG}" > /etc/apache2/mods-available/iipsrv.conf
a2enmod iipsrv
systemctl restart apache2 &> /dev/null systemctl restart apache2 &> /dev/null
echo echo
echo -e "${GREEN}Sucessfully intalled IIPImage server." echo -e "${GREEN}Sucessfully intalled IIPImage server."
echo -e "You reach him at http://localhost/iipsrv/iipsrv.fcgi${NC}" echo -e "You reach him at http://$WEBSITENAME/fcgi-bin/iipsrv.fcgi${NC}"
break;;
[Nn]* )
echo
echo -e "${GREEN}Okay, but you need an IIP Image Server for Mirador, "
echo -e "${GREEN}ensure that you have one running at http://$WEBSITENAME/fcgi-bin/iipsrv.fcgi${NC}"
break;;
* ) echo "Please answer y[es] or n[o].";;
esac
done
echo
echo -e "${YELLOW}Do you like to get mirador library with the IIP Image Server?${NC}"
echo
while true; do
read -p "(y/n): " INSTALLMIRADOR
case ${INSTALLMIRADOR} in
[Yy]* )
mkdir -p web/libraries
## get mirador
wget http://wisskieu.nasarek.org/sites/default/files/assets/mirador.zip -P web/libraries/
unzip web/libraries/mirador.zip -d web/libraries/ &> /dev/null
break;; break;;
[Nn]* ) [Nn]* )
echo echo