mirror of
https://github.com/YunoHost-Apps/svgedit_ynh.git
synced 2024-09-03 20:26:24 +02:00
58 lines
1.6 KiB
Bash
Executable file
58 lines
1.6 KiB
Bash
Executable file
#!/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_url=$(ynh_app_setting_get "$app" path)
|
|
is_public=$(ynh_app_setting_get "$app" is_public)
|
|
|
|
# Remove trailing "/" for next commands
|
|
path_url=${path_url%/}
|
|
|
|
# Check needed packages
|
|
if ! ynh_package_is_installed "wget" ; then
|
|
apt-get install -y wget
|
|
fi
|
|
if ! ynh_package_is_installed "unzip" ; then
|
|
apt-get install -y unzip
|
|
fi
|
|
|
|
# Copy source files
|
|
src_path=/var/www/$app
|
|
sudo mkdir -p $src_path
|
|
mkdir ../sources/
|
|
cd ../sources/
|
|
wget -q https://github.com/SVG-Edit/svgedit/releases/download/svg-edit-2.8.1/svg-edit-2.8.1.zip
|
|
unzip svg-edit-2.8.1.zip
|
|
cd -
|
|
sudo rm -rf $src_path/*
|
|
sudo cp -a ../sources/svg-edit-2.8.1/. $src_path
|
|
rm -rf ../sources/svg-edit-2.8.1/ ../sources/svg-edit-2.8.1.zip
|
|
touch $src_path/config.js $src_path/custom.css
|
|
|
|
# Set permissions to app files
|
|
# you may need to make some file and/or directory writeable by www-data (nginx user)
|
|
sudo chown -R root: $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_url@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
|