aboutsummaryrefslogtreecommitdiffstats
path: root/.debianinstall/debian-setup.sh
diff options
context:
space:
mode:
Diffstat (limited to '.debianinstall/debian-setup.sh')
-rw-r--r--.debianinstall/debian-setup.sh38
1 files changed, 27 insertions, 11 deletions
diff --git a/.debianinstall/debian-setup.sh b/.debianinstall/debian-setup.sh
index 9e9b3fc1a..2982b82eb 100644
--- a/.debianinstall/debian-setup.sh
+++ b/.debianinstall/debian-setup.sh
@@ -150,7 +150,7 @@ function install_sendmail {
function install_php {
# openssl and mbstring are included in libapache2-mod-php
print_info "installing php..."
- nocheck_install "libapache2-mod-php php php-pear php-curl php-gd php-mbstring php-xml php-zip"
+ nocheck_install "libapache2-mod-php php php-pear php-curl php-gd php-mbstring php-xml php-zip php-intl php-bcmath"
phpversion=$(php -v|grep --only-matching --perl-regexp "(PHP )\d+\.\\d+\.\\d+"|cut -c 5-7)
sed -i "s/^upload_max_filesize =.*/upload_max_filesize = 100M/g" /etc/php/$phpversion/apache2/php.ini
sed -i "s/^post_max_size =.*/post_max_size = 100M/g" /etc/php/$phpversion/apache2/php.ini
@@ -160,8 +160,8 @@ function install_composer {
print_info "We check if Composer is already downloaded"
if [ ! -f /usr/local/bin/composer ]
then
- EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
+ EXPECTED_CHECKSUM="`wget -qO- https://composer.github.io/installer.sig`"
+ wget https://getcomposer.org/installer -O composer-setup.php
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
@@ -171,6 +171,7 @@ function install_composer {
fi
php composer-setup.php --quiet
RESULT=$?
+ composer --version
rm composer-setup.php
# exit $RESULT
# We install Composer globally
@@ -181,7 +182,7 @@ function install_composer {
fi
cd $install_path
export COMPOSER_ALLOW_SUPERUSER=1;
- /usr/local/bin/composer install --no-dev
+ /usr/local/bin/composer install --no-dev --quiet
/usr/local/bin/composer show
export COMPOSER_ALLOW_SUPERUSER=0;
}
@@ -256,12 +257,18 @@ function create_zotserver_db {
then
Q1="CREATE DATABASE IF NOT EXISTS $db_name;"
Q2="GRANT USAGE ON *.* TO $db_user@localhost IDENTIFIED BY '$db_pass';"
- Q3="GRANT ALL PRIVILEGES ON $name.* to $db_user@localhost identified by '$db_pass';"
+ Q3="GRANT ALL PRIVILEGES ON $db_name.* to $db_user@localhost identified by '$db_pass';"
Q4="FLUSH PRIVILEGES;"
SQL="${Q1}${Q2}${Q3}${Q4}"
mysql -uroot -p$mysqlpass -e "$SQL"
else
echo "database $db_name does exist already"
+ Q1="CREATE DATABASE IF NOT EXISTS $db_name;"
+ Q2="GRANT USAGE ON *.* TO $db_user@localhost IDENTIFIED BY '$db_pass';"
+ Q3="GRANT ALL PRIVILEGES ON $db_name.* to $db_user@localhost identified by '$db_pass';"
+ Q4="FLUSH PRIVILEGES;"
+ SQL="${Q1}${Q2}${Q3}${Q4}"
+ mysql -uroot -p$mysqlpass -e "$SQL"
fi
}
@@ -301,10 +308,19 @@ function install_run_selfhost {
# https://carol.selfhost.de/update?username=123456&password=supersafe
#
# the prefered way
- wget --output-document=$selfhostdir/$selfhostscript http://jonaspasche.de/selfhost-updater
- echo "router" > $selfhostdir/device
- echo "$selfhost_user" > $selfhostdir/user
- echo "$selfhost_pass" > $selfhostdir/pass
+ if [ ! -f $selfhostdir/$selfhostscript ]
+ then
+ wget --output-document=$selfhostdir/$selfhostscript https://jonaspasche.de/selfhost-updater
+ if [ ! -s $selfhostdir/$selfhostscript ]
+ then
+ die "Failed to download selfHOST file for dynDNS"
+ fi
+ echo "router" > $selfhostdir/device
+ echo "$selfhost_user" > $selfhostdir/user
+ echo "$selfhost_pass" > $selfhostdir/pass
+ print_info "Wrote file to update dynamic IP. File: $selfhostdir/$selfhostscript"
+ fi
+ print_info "executing $selfhostdir/$selfhostscript update..."
bash $selfhostdir/$selfhostscript update
fi
}
@@ -380,7 +396,7 @@ function install_letsencrypt {
then
die "Failed to install let's encrypt: 'le_email' is empty in $configfile"
fi
- nocheck_install "certbot python-certbot-apache"
+ nocheck_install "certbot python3-certbot-apache"
print_info "run certbot ..."
certbot --apache -w $install_path -d $le_domain -m $le_email --agree-tos --non-interactive --redirect --hsts --uir
service apache2 restart
@@ -435,7 +451,7 @@ function configure_cron_daily {
echo "echo \" \"" >> /var/www/$cron_job
echo "echo \"\$(date) - stopping apache and mysql...\"" >> /var/www/$cron_job
echo "service apache2 stop" >> /var/www/$cron_job
- echo "/etc/init.d/mysql stop # to avoid inconsistencies" >> /var/www/$cron_job
+ echo "systemctl stop mysql.service # to avoid inconsistencies" >> /var/www/$cron_job
echo "#" >> /var/www/$cron_job
echo "echo \"\$(date) - renew certificate...\"" >> /var/www/$cron_job
echo "certbot renew --noninteractive" >> /var/www/$cron_job