mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 07:50:11 +01:00
util: minor fixes in postinstall.sh.in
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
63dd22f1e5
commit
cc4e2d6f6a
@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
INDEXER=`which indexer 2>/dev/null`
|
INDEXER=$(which indexer 2>/dev/null)
|
||||||
SEARCHD=`which searchd 2>/dev/null`
|
SEARCHD=$(which searchd 2>/dev/null)
|
||||||
CRON_ORIG="/tmp/crontab.piler.orig"
|
CRON_ORIG="/tmp/crontab.piler.orig"
|
||||||
CRON_TMP="/tmp/crontab.piler"
|
CRON_TMP="/tmp/crontab.piler"
|
||||||
PILERCONF_TMP="/tmp/config.piler.88"
|
PILERCONF_TMP="/tmp/config.piler.88"
|
||||||
@ -18,7 +18,7 @@ load_default_values() {
|
|||||||
DATAROOTDIR=__DATAROOTDIR
|
DATAROOTDIR=__DATAROOTDIR
|
||||||
|
|
||||||
KEYTMPFILE="piler.key"
|
KEYTMPFILE="piler.key"
|
||||||
KEYFILE="$SYSCONFDIR/piler/piler.key"
|
KEYFILE="${SYSCONFDIR}/piler/piler.key"
|
||||||
|
|
||||||
HOSTNAME=$(hostname --fqdn)
|
HOSTNAME=$(hostname --fqdn)
|
||||||
|
|
||||||
@ -29,10 +29,10 @@ load_default_values() {
|
|||||||
MYSQL_ROOT_PASSWORD=""
|
MYSQL_ROOT_PASSWORD=""
|
||||||
MYSQL_SOCKET=""
|
MYSQL_SOCKET=""
|
||||||
|
|
||||||
SPHINXCFG="/usr/local/etc/piler/sphinx.conf"
|
SPHINXCFG="${SYSCONFDIR}/piler/sphinx.conf"
|
||||||
|
|
||||||
WWWGROUP="apache"
|
WWWGROUP="apache"
|
||||||
DOCROOT="/var/www/piler"
|
DOCROOT="/var/piler/www"
|
||||||
|
|
||||||
SMARTHOST=""
|
SMARTHOST=""
|
||||||
SMARTHOST_PORT=25
|
SMARTHOST_PORT=25
|
||||||
@ -42,12 +42,12 @@ load_default_values() {
|
|||||||
|
|
||||||
|
|
||||||
make_certificate() {
|
make_certificate() {
|
||||||
if [ ! -f $SYSCONFDIR/piler/piler.pem ]; then
|
if [[ ! -f "${SYSCONFDIR}/piler/piler.pem" ]]; then
|
||||||
echo -n "Making an ssl certificate ... "
|
echo -n "Making an ssl certificate ... "
|
||||||
openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -subj "$SSL_CERT_DATA" -keyout "$SYSCONFDIR/piler/piler.pem" -out 1.cert -sha1
|
openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -subj "$SSL_CERT_DATA" -keyout "${SYSCONFDIR}/piler/piler.pem" -out 1.cert -sha1
|
||||||
cat 1.cert >> "$SYSCONFDIR/piler/piler.pem"
|
cat 1.cert >> "${SYSCONFDIR}/piler/piler.pem"
|
||||||
chmod 640 "$SYSCONFDIR/piler/piler.pem"
|
chmod 640 "${SYSCONFDIR}/piler/piler.pem"
|
||||||
chgrp "$PILERUSER" "$SYSCONFDIR/piler/piler.pem"
|
chgrp "$PILERUSER" "${SYSCONFDIR}/piler/piler.pem"
|
||||||
rm 1.cert
|
rm 1.cert
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ display_install_intro() {
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
askYN "Continue? [Y/N]" "N"
|
askYN "Continue? [Y/N]" "N"
|
||||||
if [ "$response" != "yes" ]; then
|
if [[ "$response" != "yes" ]]; then
|
||||||
echo "Aborted."
|
echo "Aborted."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
@ -71,9 +71,9 @@ display_install_intro() {
|
|||||||
|
|
||||||
|
|
||||||
check_user() {
|
check_user() {
|
||||||
user=$1
|
user="$1"
|
||||||
|
|
||||||
if [ x`whoami` != x$user ]; then echo "ERROR: postinstaller must be run as ${user} user"; exit 1; fi
|
if [[ $(whoami) != "$user" ]]; then echo "ERROR: postinstaller must be run as ${user} user"; exit 1; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -187,52 +187,52 @@ askYN() {
|
|||||||
preinstall_check() {
|
preinstall_check() {
|
||||||
check_user root
|
check_user root
|
||||||
|
|
||||||
if [ "x$INDEXER" = "x" ]; then "ERROR: cannot find sphinx indexer"; echo ""; exit ; fi
|
if [[ "$INDEXER" == "" ]]; then "ERROR: cannot find sphinx indexer"; echo ""; exit ; fi
|
||||||
|
|
||||||
if [ "x$SEARCHD" = "x" ]; then "ERROR: cannot find sphinx searchd"; echo ""; exit 0; fi
|
if [[ "$SEARCHD" == "" ]]; then "ERROR: cannot find sphinx searchd"; echo ""; exit 0; fi
|
||||||
|
|
||||||
if [ -f $KEYFILE ]; then echo "ERROR: found existing keyfile ($KEYFILE), aborting install"; echo ""; exit 0; fi
|
if [[ -f "$KEYFILE" ]]; then echo "ERROR: found existing keyfile (${KEYFILE}), aborting install"; echo ""; exit 0; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gather_webserver_data() {
|
gather_webserver_data() {
|
||||||
askNonBlank "Please enter the webserver groupname" "$WWWGROUP"
|
askNonBlank "Please enter the webserver groupname" "$WWWGROUP"
|
||||||
WWWGROUP=$response
|
WWWGROUP="$response"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gather_mysql_account() {
|
gather_mysql_account() {
|
||||||
|
|
||||||
if [ -e /var/lib/mysql/mysql.sock ]; then MYSQL_SOCKET="/var/lib/mysql/mysql.sock"; fi
|
if [[ -e /var/lib/mysql/mysql.sock ]]; then MYSQL_SOCKET="/var/lib/mysql/mysql.sock"; fi
|
||||||
if [ -e /var/run/mysqld/mysqld.sock ]; then MYSQL_SOCKET="/var/run/mysqld/mysqld.sock"; fi
|
if [[ -e /var/run/mysqld/mysqld.sock ]]; then MYSQL_SOCKET="/var/run/mysqld/mysqld.sock"; fi
|
||||||
|
|
||||||
askNonBlank "Please enter mysql hostname" "$MYSQL_HOSTNAME"
|
askNonBlank "Please enter mysql hostname" "$MYSQL_HOSTNAME"
|
||||||
MYSQL_HOSTNAME=$response
|
MYSQL_HOSTNAME="$response"
|
||||||
|
|
||||||
if [ $MYSQL_HOSTNAME = "localhost" ]; then
|
if [[ $MYSQL_HOSTNAME == "localhost" ]]; then
|
||||||
askNonBlank "Please enter mysql socket path" "$MYSQL_SOCKET"
|
askNonBlank "Please enter mysql socket path" "$MYSQL_SOCKET"
|
||||||
MYSQL_SOCKET=$response
|
MYSQL_SOCKET="$response"
|
||||||
else
|
else
|
||||||
MYSQL_SOCKET=""
|
MYSQL_SOCKET=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
askNonBlank "Please enter mysql database" "$MYSQL_DATABASE"
|
askNonBlank "Please enter mysql database" "${MYSQL_DATABASE}"
|
||||||
MYSQL_DATABASE=$response
|
MYSQL_DATABASE="$response"
|
||||||
|
|
||||||
askNonBlank "Please enter mysql user name" "$MYSQL_USERNAME"
|
askNonBlank "Please enter mysql user name" "${MYSQL_USERNAME}"
|
||||||
MYSQL_USERNAME=$response
|
MYSQL_USERNAME="$response"
|
||||||
|
|
||||||
askNoEcho "Please enter mysql password for $MYSQL_USERNAME" ""
|
askNoEcho "Please enter mysql password for ${MYSQL_USERNAME}" ""
|
||||||
MYSQL_PASSWORD=$response
|
MYSQL_PASSWORD="$response"
|
||||||
|
|
||||||
askNonBlankNoEcho "Please enter mysql root password" ""
|
askNonBlankNoEcho "Please enter mysql root password" ""
|
||||||
MYSQL_ROOT_PASSWORD=$response
|
MYSQL_ROOT_PASSWORD="$response"
|
||||||
|
|
||||||
s=`echo "use information_schema; select TABLE_NAME from TABLES where TABLE_SCHEMA='$MYSQL_DATABASE'" | mysql -h $MYSQL_HOSTNAME -u root --password=$MYSQL_ROOT_PASSWORD`
|
s=$(echo "use information_schema; select TABLE_NAME from TABLES where TABLE_SCHEMA='${MYSQL_DATABASE}'" | mysql -h "$MYSQL_HOSTNAME" -u root --password="$MYSQL_ROOT_PASSWORD")
|
||||||
if [ $? -eq 0 ];
|
if [ $? -eq 0 ];
|
||||||
then
|
then
|
||||||
echo "mysql connection successful"; echo;
|
echo "mysql connection successful"; echo;
|
||||||
if [ `echo $s | grep -c metadata` -eq 1 ]; then echo "ERROR: Detected metadata table in $MYSQL_DATABASE. Aborting"; exit 0; fi
|
if [ $(echo $s | grep -c metadata) -eq 1 ]; then echo "ERROR: Detected metadata table in ${MYSQL_DATABASE}. Aborting"; exit 0; fi
|
||||||
else
|
else
|
||||||
echo "ERROR: failed to connect to mysql";
|
echo "ERROR: failed to connect to mysql";
|
||||||
gather_mysql_account
|
gather_mysql_account
|
||||||
@ -243,53 +243,53 @@ gather_mysql_account() {
|
|||||||
|
|
||||||
gather_sphinx_data() {
|
gather_sphinx_data() {
|
||||||
askNonBlank "Please enter the path of sphinx.conf" "$SPHINXCFG"
|
askNonBlank "Please enter the path of sphinx.conf" "$SPHINXCFG"
|
||||||
SPHINXCFG=$response
|
SPHINXCFG="$response"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gather_smtp_relay_data() {
|
gather_smtp_relay_data() {
|
||||||
ask "Please enter smtp relay" "$SMARTHOST"
|
ask "Please enter smtp relay" "$SMARTHOST"
|
||||||
SMARTHOST=$response
|
SMARTHOST="$response"
|
||||||
|
|
||||||
ask "Please enter smtp relay port" "$SMARTHOST_PORT"
|
ask "Please enter smtp relay port" "$SMARTHOST_PORT"
|
||||||
SMARTHOST_PORT=$response
|
SMARTHOST_PORT="$response"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
make_cron_entries() {
|
make_cron_entries() {
|
||||||
|
|
||||||
crontab -u $PILERUSER -l > $CRON_ORIG
|
crontab -u "$PILERUSER" -l > "$CRON_ORIG"
|
||||||
|
|
||||||
grep PILERSTART $CRON_ORIG > /dev/null 2>&1
|
grep PILERSTART "$CRON_ORIG" > /dev/null 2>&1
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
cat /dev/null > $CRON_ORIG
|
cat /dev/null > "$CRON_ORIG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
grep PILEREND $CRON_ORIG > /dev/null 2>&1
|
grep PILEREND "$CRON_ORIG" > /dev/null 2>&1
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
cat /dev/null > $CRON_ORIG
|
cat /dev/null > "$CRON_ORIG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
rm -f $CRON_TMP
|
rm -f "$CRON_TMP"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "### PILERSTART" >> $CRON_TMP
|
echo "### PILERSTART" >> "$CRON_TMP"
|
||||||
echo "5,35 * * * * $LIBEXECDIR/piler/indexer.delta.sh" >> $CRON_TMP
|
echo "5,35 * * * * ${LIBEXECDIR}/piler/indexer.delta.sh" >> "$CRON_TMP"
|
||||||
echo "30 2 * * * $LIBEXECDIR/piler/indexer.main.sh" >> $CRON_TMP
|
echo "30 2 * * * ${LIBEXECDIR}/piler/indexer.main.sh" >> "$CRON_TMP"
|
||||||
echo "15,45 * * * * $LIBEXECDIR/piler/indexer.attachment.sh" >> $CRON_TMP
|
echo "15,45 * * * * ${LIBEXECDIR}/piler/indexer.attachment.sh" >> "$CRON_TMP"
|
||||||
echo "*/15 * * * * $INDEXER --quiet tag1 --rotate --config $SYSCONFDIR/piler/sphinx.conf" >> $CRON_TMP
|
echo "*/15 * * * * ${INDEXER} --quiet tag1 --rotate --config ${SYSCONFDIR}/piler/sphinx.conf" >> "$CRON_TMP"
|
||||||
echo "*/15 * * * * $INDEXER --quiet note1 --rotate --config $SYSCONFDIR/piler/sphinx.conf" >> $CRON_TMP
|
echo "*/15 * * * * ${INDEXER} --quiet note1 --rotate --config ${SYSCONFDIR}/piler/sphinx.conf" >> "$CRON_TMP"
|
||||||
echo "30 6 * * * /usr/bin/php $LIBEXECDIR/piler/generate_stats.php --webui $DOCROOT >/dev/null" >> $CRON_TMP
|
echo "30 6 * * * /usr/bin/php ${LIBEXECDIR}/piler/generate_stats.php --webui ${DOCROOT} >/dev/null" >> "$CRON_TMP"
|
||||||
echo "*/5 * * * * /usr/bin/find $DOCROOT/tmp -type f -name i.\* -exec rm -f {} \;" >> $CRON_TMP
|
echo "*/5 * * * * /usr/bin/find ${DOCROOT}/tmp -type f -name i.\* -exec rm -f {} \;" >> "$CRON_TMP"
|
||||||
echo "### PILEREND" >> $CRON_TMP
|
echo "### PILEREND" >> "$CRON_TMP"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
make_new_key() {
|
make_new_key() {
|
||||||
dd if=/dev/urandom bs=56 count=1 of=$KEYTMPFILE 2>/dev/null
|
dd if=/dev/urandom bs=56 count=1 of="$KEYTMPFILE" 2>/dev/null
|
||||||
|
|
||||||
if [ `stat -c '%s' $KEYTMPFILE` -ne 56 ]; then echo "could not read 56 bytes from /dev/urandom to $KEYTMPFILE"; exit 1; fi
|
if [ $(stat -c '%s' "$KEYTMPFILE") -ne 56 ]; then echo "could not read 56 bytes from /dev/urandom to ${KEYTMPFILE}"; exit 1; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -299,35 +299,35 @@ show_summary() {
|
|||||||
echo "INSTALLATION SUMMARY:"
|
echo "INSTALLATION SUMMARY:"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo "piler user: $PILERUSER"
|
echo "piler user: ${PILERUSER}"
|
||||||
echo "keyfile: $KEYFILE"
|
echo "keyfile: ${KEYFILE}"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo "mysql host: $MYSQL_HOSTNAME"
|
echo "mysql host: ${MYSQL_HOSTNAME}"
|
||||||
echo "mysql socket: $MYSQL_SOCKET"
|
echo "mysql socket: ${MYSQL_SOCKET}"
|
||||||
echo "mysql database: $MYSQL_DATABASE"
|
echo "mysql database: ${MYSQL_DATABASE}"
|
||||||
echo "mysql username: $MYSQL_USERNAME"
|
echo "mysql username: ${MYSQL_USERNAME}"
|
||||||
echo "mysql password: *******"
|
echo "mysql password: *******"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo "sphinx indexer: $INDEXER"
|
echo "sphinx indexer: ${INDEXER}"
|
||||||
echo "sphinx config file: $SPHINXCFG"
|
echo "sphinx config file: ${SPHINXCFG}"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo "vhost docroot: $DOCROOT"
|
echo "vhost docroot: ${DOCROOT}"
|
||||||
echo "www group: $WWWGROUP"
|
echo "www group: ${WWWGROUP}"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo "smtp relay host: $SMARTHOST"
|
echo "smtp relay host: ${SMARTHOST}"
|
||||||
echo "smtp relay port: $SMARTHOST_PORT"
|
echo "smtp relay port: ${SMARTHOST_PORT}"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo "piler crontab:"
|
echo "piler crontab:"
|
||||||
cat $CRON_TMP
|
cat "$CRON_TMP"
|
||||||
echo; echo;
|
echo; echo;
|
||||||
|
|
||||||
askYN "Correct? [Y/N]" "N"
|
askYN "Correct? [Y/N]" "N"
|
||||||
if [ $response != "yes" ]; then
|
if [[ $response != "yes" ]]; then
|
||||||
echo "Aborted."
|
echo "Aborted."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
@ -338,114 +338,112 @@ show_summary() {
|
|||||||
execute_post_install_tasks() {
|
execute_post_install_tasks() {
|
||||||
|
|
||||||
askYN "Continue and modify system? [Y/N]" "N"
|
askYN "Continue and modify system? [Y/N]" "N"
|
||||||
if [ $response != "yes" ]; then
|
if [[ "$response" != "yes" ]]; then
|
||||||
echo "Aborted."
|
echo "Aborted."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo;
|
echo;
|
||||||
echo -n "Creating mysql database... ";
|
echo -n "Creating mysql database... ";
|
||||||
sed -e "s%MYSQL_HOSTNAME%$MYSQL_HOSTNAMEg%" -e "s%MYSQL_DATABASE%$MYSQL_DATABASE%g" -e "s%MYSQL_USERNAME%$MYSQL_USERNAME%g" -e "s%MYSQL_PASSWORD%$MYSQL_PASSWORD%g" $DATAROOTDIR/piler/db-mysql-root.sql.in | mysql -h $MYSQL_HOSTNAME -u root --password=$MYSQL_ROOT_PASSWORD
|
sed -e "s%MYSQL_HOSTNAME%${MYSQL_HOSTNAME}%g" -e "s%MYSQL_DATABASE%${MYSQL_DATABASE}%g" -e "s%MYSQL_USERNAME%${MYSQL_USERNAME}%g" -e "s%MYSQL_PASSWORD%${MYSQL_PASSWORD}%g" "${DATAROOTDIR}/piler/db-mysql-root.sql.in" | mysql -h "$MYSQL_HOSTNAME" -u root --password="$MYSQL_ROOT_PASSWORD"
|
||||||
mysql -h $MYSQL_HOSTNAME -u $MYSQL_USERNAME --password=$MYSQL_PASSWORD $MYSQL_DATABASE < $DATAROOTDIR/piler/db-mysql.sql
|
mysql -h "$MYSQL_HOSTNAME" -u "$MYSQL_USERNAME" --password="$MYSQL_PASSWORD" "$MYSQL_DATABASE" < "${DATAROOTDIR}/piler/db-mysql.sql"
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
||||||
echo -n "Writing sphinx configuration... ";
|
echo -n "Writing sphinx configuration... ";
|
||||||
sed -e "s%MYSQL_HOSTNAME%$MYSQL_HOSTNAME%" -e "s%MYSQL_DATABASE%$MYSQL_DATABASE%" -e "s%MYSQL_USERNAME%$MYSQL_USERNAME%" -e "s%MYSQL_PASSWORD%$MYSQL_PASSWORD%" $SYSCONFDIR/piler/sphinx.conf.dist > $SPHINXCFG
|
sed -e "s%MYSQL_HOSTNAME%${MYSQL_HOSTNAME}%" -e "s%MYSQL_DATABASE%${MYSQL_DATABASE}%" -e "s%MYSQL_USERNAME%${MYSQL_USERNAME}%" -e "s%MYSQL_PASSWORD%${MYSQL_PASSWORD}%" "${SYSCONFDIR}/piler/sphinx.conf.dist" > "$SPHINXCFG"
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
||||||
echo -n "Initializing sphinx indices... ";
|
echo -n "Initializing sphinx indices... ";
|
||||||
su $PILERUSER -c "indexer --all --config $SPHINXCFG"
|
su "$PILERUSER" -c "indexer --all --config ${SPHINXCFG}"
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
||||||
|
|
||||||
echo -n "installing cron entries for $PILERUSER... "
|
echo -n "installing cron entries for ${PILERUSER}... "
|
||||||
crontab -u $PILERUSER $CRON_TMP
|
crontab -u "$PILERUSER" "$CRON_TMP"
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
||||||
|
|
||||||
echo -n "installing keyfile ($KEYTMPFILE) to $KEYFILE... "
|
echo -n "installing keyfile (${KEYTMPFILE}) to ${KEYFILE}... "
|
||||||
cp $KEYTMPFILE $KEYFILE
|
cp "$KEYTMPFILE" "$KEYFILE"
|
||||||
chgrp $PILERUSER $KEYFILE
|
chgrp "$PILERUSER" "$KEYFILE"
|
||||||
chmod 640 $KEYFILE
|
chmod 640 "$KEYFILE"
|
||||||
rm -f $KEYTMPFILE
|
rm -f "$KEYTMPFILE"
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
||||||
make_certificate
|
make_certificate
|
||||||
|
|
||||||
cat <<SOCKHELPER > $SOCKET_HELPER_SCRIPT
|
cat <<SOCKHELPER > "$SOCKET_HELPER_SCRIPT"
|
||||||
\$a=\$ARGV[0];
|
\$a=\$ARGV[0];
|
||||||
\$a=~s/\//\\\\\//g;
|
\$a=~s/\//\\\\\//g;
|
||||||
print \$a;
|
print \$a;
|
||||||
SOCKHELPER
|
SOCKHELPER
|
||||||
|
|
||||||
MYSQL_SOCKET=`perl $SOCKET_HELPER_SCRIPT $MYSQL_SOCKET`
|
MYSQL_SOCKET=$(perl "$SOCKET_HELPER_SCRIPT" "$MYSQL_SOCKET")
|
||||||
|
|
||||||
sed -e "s/mysqlpwd=verystrongpassword/mysqlpwd=$MYSQL_PASSWORD/" -e "s/tls_enable=0/tls_enable=1/" -e "s/mysqlsocket=\/var\/run\/mysqld\/mysqld.sock/mysqlsocket=$MYSQL_SOCKET/" $SYSCONFDIR/piler/piler.conf.dist > $PILERCONF_TMP
|
sed -e "s/mysqlpwd=verystrongpassword/mysqlpwd=${MYSQL_PASSWORD}/" -e "s/tls_enable=0/tls_enable=1/" -e "s/mysqlsocket=\/var\/run\/mysqld\/mysqld.sock/mysqlsocket=${MYSQL_SOCKET}/" "${SYSCONFDIR}/piler/piler.conf.dist" > "$PILERCONF_TMP"
|
||||||
cat $PILERCONF_TMP > $SYSCONFDIR/piler/piler.conf
|
cat "$PILERCONF_TMP" > "${SYSCONFDIR}/piler/piler.conf"
|
||||||
rm -f $PILERCONF_TMP
|
rm -f "$PILERCONF_TMP"
|
||||||
|
|
||||||
chmod 755 $LOCALSTATEDIR/piler/stat
|
chmod 755 "${LOCALSTATEDIR}/piler/stat"
|
||||||
|
|
||||||
if [ -d webui ]; then
|
if [[ -d webui ]]; then
|
||||||
echo -n "Copying www files to $DOCROOT... "
|
echo -n "Copying www files to ${DOCROOT}... "
|
||||||
mkdir -p $DOCROOT || exit 1
|
mkdir -p "$DOCROOT" || exit 1
|
||||||
cp -R webui/* $DOCROOT
|
cp -R webui/* "$DOCROOT"
|
||||||
cp -R webui/.htaccess $DOCROOT
|
cp webui/.htaccess "$DOCROOT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d /var/www/piler.yourdomain.com ]; then
|
if [[ -d /var/www/piler.yourdomain.com ]]; then
|
||||||
mv /var/www/piler.yourdomain.com $DOCROOT
|
mv /var/www/piler.yourdomain.com "$DOCROOT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ -d $DOCROOT ]; then webui_install; fi
|
if [ -d "$DOCROOT" ]; then webui_install; fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
webui_install() {
|
webui_install() {
|
||||||
|
|
||||||
chmod 770 $DOCROOT/tmp $DOCROOT/images
|
chmod 770 "${DOCROOT}/tmp" "${DOCROOT}/images"
|
||||||
chown $PILERUSER $DOCROOT/tmp
|
chown "$PILERUSER" "${DOCROOT}/tmp"
|
||||||
chgrp $WWWGROUP $DOCROOT/tmp
|
chgrp "$WWWGROUP" "${DOCROOT}/tmp"
|
||||||
|
|
||||||
echo "<?php" > $DOCROOT/config-site.php
|
echo "<?php" > "${DOCROOT}/config-site.php"
|
||||||
echo >> $DOCROOT/config-site.php
|
echo >> "${DOCROOT}/config-site.php"
|
||||||
|
|
||||||
echo "\$config['SITE_NAME'] = '$HOSTNAME';" >> $DOCROOT/config-site.php
|
echo "\$config['SITE_NAME'] = '$HOSTNAME';" >> "${DOCROOT}/config-site.php"
|
||||||
echo "\$config['SITE_URL'] = 'http://' . \$config['SITE_NAME'] . '/';" >> $DOCROOT/config-site.php
|
echo "\$config['SITE_URL'] = 'http://' . \$config['SITE_NAME'] . '/';" >> "${DOCROOT}/config-site.php"
|
||||||
echo "\$config['DIR_BASE'] = '$DOCROOT/';" >> $DOCROOT/config-site.php
|
echo "\$config['DIR_BASE'] = '$DOCROOT/';" >> "${DOCROOT}/config-site.php"
|
||||||
|
|
||||||
echo >> $DOCROOT/config-site.php
|
echo >> "${DOCROOT}/config-site.php"
|
||||||
|
|
||||||
echo "\$config['SMTP_DOMAIN'] = '$HOSTNAME';" >> $DOCROOT/config-site.php
|
echo "\$config['SMTP_DOMAIN'] = '$HOSTNAME';" >> "${DOCROOT}/config-site.php"
|
||||||
echo "\$config['SMTP_FROMADDR'] = 'no-reply@$HOSTNAME';" >> $DOCROOT/config-site.php
|
echo "\$config['SMTP_FROMADDR'] = 'no-reply@$HOSTNAME';" >> "${DOCROOT}/config-site.php"
|
||||||
echo "\$config['ADMIN_EMAIL'] = 'admin@$HOSTNAME';" >> $DOCROOT/config-site.php
|
echo "\$config['ADMIN_EMAIL'] = 'admin@$HOSTNAME';" >> "${DOCROOT}/config-site.php"
|
||||||
|
|
||||||
echo >> $DOCROOT/config-site.php
|
echo >> "${DOCROOT}/config-site.php"
|
||||||
|
|
||||||
echo "\$config['DB_DRIVER'] = 'mysql';" >> $DOCROOT/config-site.php
|
echo "\$config['DB_DRIVER'] = 'mysql';" >> "${DOCROOT}/config-site.php"
|
||||||
echo "\$config['DB_PREFIX'] = '';" >> $DOCROOT/config-site.php
|
echo "\$config['DB_PREFIX'] = '';" >> "${DOCROOT}/config-site.php"
|
||||||
echo "\$config['DB_HOSTNAME'] = '$MYSQL_HOSTNAME';" >> $DOCROOT/config-site.php
|
echo "\$config['DB_HOSTNAME'] = '$MYSQL_HOSTNAME';" >> "${DOCROOT}/config-site.php"
|
||||||
echo "\$config['DB_USERNAME'] = '$MYSQL_USERNAME';" >> $DOCROOT/config-site.php
|
echo "\$config['DB_USERNAME'] = '$MYSQL_USERNAME';" >> "${DOCROOT}/config-site.php"
|
||||||
echo "\$config['DB_PASSWORD'] = '$MYSQL_PASSWORD';" >> $DOCROOT/config-site.php
|
echo "\$config['DB_PASSWORD'] = '$MYSQL_PASSWORD';" >> "${DOCROOT}/config-site.php"
|
||||||
echo "\$config['DB_DATABASE'] = '$MYSQL_DATABASE';" >> $DOCROOT/config-site.php
|
echo "\$config['DB_DATABASE'] = '$MYSQL_DATABASE';" >> "${DOCROOT}/config-site.php"
|
||||||
|
|
||||||
echo >> $DOCROOT/config-site.php
|
echo >> "${DOCROOT}/config-site.php"
|
||||||
|
|
||||||
echo "\$config['SMARTHOST'] = '$SMARTHOST';" >> $DOCROOT/config-site.php
|
echo "\$config['SMARTHOST'] = '$SMARTHOST';" >> "${DOCROOT}/config-site.php"
|
||||||
echo "\$config['SMARTHOST_PORT'] = $SMARTHOST_PORT;" >> $DOCROOT/config-site.php
|
echo "\$config['SMARTHOST_PORT'] = $SMARTHOST_PORT;" >> "${DOCROOT}/config-site.php"
|
||||||
|
|
||||||
echo >> $DOCROOT/config-site.php
|
echo >> "${DOCROOT}/config-site.php"
|
||||||
|
|
||||||
echo "?>" >> $DOCROOT/config-site.php
|
|
||||||
|
|
||||||
echo "Done."
|
echo "Done."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
clean_up_temp_stuff() {
|
clean_up_temp_stuff() {
|
||||||
rm -f $CRON_TMP
|
rm -f "$CRON_TMP"
|
||||||
|
|
||||||
echo; echo "Done post installation tasks."; echo
|
echo; echo "Done post installation tasks."; echo
|
||||||
}
|
}
|
||||||
@ -476,5 +474,3 @@ show_summary
|
|||||||
execute_post_install_tasks
|
execute_post_install_tasks
|
||||||
|
|
||||||
clean_up_temp_stuff
|
clean_up_temp_stuff
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user