1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pelican_ynh.git synced 2024-09-03 19:46:35 +02:00

Update install

This commit is contained in:
Ylies Chahi 2017-08-13 01:32:04 +02:00 committed by GitHub
parent 9a432e1ed8
commit ddaed7491b

View file

@ -13,15 +13,21 @@ domain=$YNH_APP_ARG_DOMAIN
path=$YNH_APP_ARG_PATH path=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
author=$YNH_APP_ARG_AUTHOR author=$YNH_APP_ARG_AUTHOR
title=$YNH_APP_ARG_TITLE
# Remove trailing slash to path
path=${path%/}
#force location to be / or /foo
location=${path:-/}
# Check domain/path availability # Check domain/path availability
sudo yunohost app checkurl "${domain}${path}" -a "$app" \ sudo yunohost app checkurl $domain$path -a $app \
|| exit 1 || (echo "Path not available: $domain$path" && exit 1)
DESTDIR="/var/www/${app}" # Document root
[[ -d "$DESTDIR" ]] && ynh_die \ document_root=/var/www/$app
"The destination directory '${DESTDIR}' already exists.\ sudo mkdir -p $document_root
You should safely delete it before installing this app." sudo cp -a ../sources/* $document_root
# Store settings from manifest # Store settings from manifest
ynh_app_setting_set $app domain $domain ynh_app_setting_set $app domain $domain
@ -34,19 +40,25 @@ sudo apt-get install -y python-pip python-virtualenv python-dev libldap2-dev lib
# Install pelican # Install pelican
pip install pelican markdown pip install pelican markdown
mkdir -p ${DESTDIR}
# cd ${DESTDIR}
# git clone https://github.com/YliesC/website.git .
# Configure Nginx # Generate the blog
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf" sudo sed -i "s@https://example.fr@https://$domain@g" publishconf.py
sed -i "s@{PATH}@${path}@g" ../conf/nginx.conf sudo sed -i "s@YNH_APP_AUTHOR@$author@g" publishconf.py
sed -i "s@{LOCATION}@${path:-/}@g" ../conf/nginx.conf sudo sed -i "s@YNH_APP_SITENAME@$title@g" publishconf.py
sed -i "s@{DESTDIR}@${DESTDIR}@g" ../conf/nginx.conf pelican -s publishconf.py
sed -i "s@{POOLNAME}@${app}@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf "$nginx_conf"
sudo nginx -t && sudo service nginx reload # Set permissions
sudo chmod 775 -R $document_root
sudo chown -hR www-data:www-data $document_root
# Nginx configuration
sed -i "s@YNH_LOCATION@$location@g" ../conf/nginx.conf
sed -i "s@YNH_DOCUMENT_ROOT@$document_root/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Make app public if necessary
[[ $is_public -eq 1 ]] \ [[ $is_public -eq 1 ]] \
&& ynh_app_setting_set "$app" unprotected_uris "/" && ynh_app_setting_set "$app" unprotected_uris "/"
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload