mirror of
https://github.com/YunoHost-Apps/cheky_ynh.git
synced 2024-09-03 18:16:00 +02:00
51 lines
1.3 KiB
Bash
51 lines
1.3 KiB
Bash
#!/bin/bash
|
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
set -eu
|
|
|
|
# See comments in install script
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
# 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)
|
|
admin=$(ynh_app_setting_get "$app" admin)
|
|
is_public=$(ynh_app_setting_get "$app" is_public)
|
|
language=$(ynh_app_setting_get "$app" language)
|
|
|
|
# Remove trailing "/" for next commands
|
|
path=${path%/}
|
|
|
|
# Download sources
|
|
sudo wget -q https://github.com/Blount/Cheky/archive/3.3.zip -O Cheky.zip
|
|
|
|
# Uncompress
|
|
sudo unzip -qq Cheky.zip -d ..
|
|
|
|
# Copy source files
|
|
src_path=/var/www/$app
|
|
sudo mkdir -p $src_path
|
|
sudo cp -a ../Cheky*/. $src_path
|
|
|
|
# Set permissions to app files
|
|
# you may need to make some file and/or directory writeable by www-data (nginx user)
|
|
sudo chown -R www-data: $src_path
|
|
|
|
# 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
|
|
|
|
# If app is public, add url to SSOWat conf as skipped_uris
|
|
if [[ $is_public -eq 1 ]]; then
|
|
# See install script
|
|
ynh_app_setting_set "$app" unprotected_uris "/"
|
|
fi
|
|
|
|
# Reload nginx service
|
|
sudo service nginx reload
|