2016-08-21 01:03:46 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
version='1.1.0'
|
|
|
|
|
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Retrieve app settings
|
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
|
|
path=$(ynh_app_setting_get "$app" path)
|
|
|
|
|
|
|
|
# Remove trailing "/" for next commands
|
|
|
|
path=${path%/}
|
|
|
|
|
|
|
|
# Copy source files
|
|
|
|
src_path=/var/www/$app
|
|
|
|
sudo mkdir -p $src_path
|
|
|
|
sudo unzip -qq ../sources/humhub-$version.zip
|
|
|
|
sudo cp -a humhub-$version/. $src_path
|
|
|
|
|
|
|
|
# Set permissions to app files
|
2016-08-22 00:09:13 +02:00
|
|
|
sudo chown -R www-data: $src_path
|
2016-08-21 01:03:46 +02:00
|
|
|
|
|
|
|
# Cron
|
2016-08-22 00:02:33 +02:00
|
|
|
echo "30 * * * * $src_path/protected/yii cron hourly >/dev/null 2>&1" > cron
|
|
|
|
echo "00 18 * * * $src_path/protected/yii cron daily >/dev/null 2>&1" > cron
|
2016-08-21 01:03:46 +02:00
|
|
|
sudo mv cron /etc/cron.d/${app}
|
|
|
|
sudo chown root /etc/cron.d/${app}
|
|
|
|
|
|
|
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
|
|
|
nginx_conf=../conf/nginx.conf
|
|
|
|
sed -i "s@YNH_WWW_PATH@$path@g" $nginx_conf
|
|
|
|
sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf
|
|
|
|
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
|
|
|
|
|
|
|
# Reload nginx service
|
|
|
|
sudo service nginx reload
|