#!/bin/bash # Source app helpers and functions source /usr/share/yunohost/helpers # Exit on command errors and treat unset variables as an error set -eu # Retrieve arguments domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) is_public=$(ynh_app_setting_get "$app" is_public) author=$(ynh_app_setting_get "$app" author) title=$(ynh_app_setting_get "$app" title) # is_public is now a boolean field if [ "$is_public" = "Yes" ]; then is_public=1 fi #force location to be / or /foo location=${path:-/} # Document root document_root=/var/www/$app sudo mkdir -p $document_root # Nginx configuration sed -i "s@YNH_LOCATION@$location@g" ../conf/nginx.conf sed -i "s@YNH_DOCUMENT_ROOT@$document_root/output/@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf # Store settings from manifest ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path ynh_app_setting_set $app is_public $is_public ynh_app_setting_set $app author $author # Install python dependencies sudo apt-get install -y python-pip python-virtualenv python-dev libldap2-dev libsasl2-dev libssl-dev # Upgrade pelican pip install --upgrade pelican markdown # Set permissions sudo chmod 775 -R $document_root sudo chown -hR www-data:www-data $document_root # Make app public if necessary [[ $is_public -eq 1 ]] \ && ynh_app_setting_set "$app" unprotected_uris "/" # Reload Nginx and regenerate SSOwat conf sudo service nginx reload