1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/strut_ynh.git synced 2024-09-03 20:26:33 +02:00

Merge pull request #15 from YunoHost-Apps/testing

Testing
This commit is contained in:
Maniack Crudelis 2019-07-18 19:11:09 +02:00 committed by GitHub
commit a6037247a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 276 additions and 188 deletions

View file

@ -1,26 +1,68 @@
strut_ynh
===============
# Strut for YunoHost
Strut package for YunoHost
[![Integration level](https://dash.yunohost.org/integration/strut.svg)](https://dash.yunohost.org/appci/app/strut)
[![Install Strut with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=strut)
## IMPORTANT NOTE ABOUT THIS PACKAGE
This package doesn't contained the exact sources of the upstream https://github.com/tantaman/Strut.
> *This package allow you to install Strut quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
## Overview
Quick description of this app.
**Shipped version:** 20171224-1
## Screenshots
![](https://f.cloud.github.com/assets/1009003/515405/f1003c6a-be74-11e2-84b9-14776c652afb.png)
## Demo
* [Official demo](http://strut.io/editor/index.html)
## Configuration
## Documentation
* YunoHost documentation: If specific documentation is needed, feel free to contribute.
## YunoHost specific features
#### Multi-users support
#### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/strut%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/strut/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/strut%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/strut/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/strut%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/strut/)
## Limitations
## Additional information
* This package doesn't contained the exact sources of the upstream https://github.com/tantaman/Strut.
Initial Strut software includes Google Analytics and is bind to Imgur to upload images. This kind of trackers or external services are not accepted by the package team of YunoHost. So this trackers are removed from sources, a pull request has been done and merged but has finally be removed from the strut upstream with no explanation. In more, Strut developers don't deliver builded versions. To build a version it needs grunt, that can't be removed easily.
To avoid to take time to build this html/js app, this package setups a builded version of Strut with the patch that remove Google Analytics and Imgur dependencies. It is a build of this version https://github.com/tantaman/Strut/commits/6761b141ee7aa622916e2d23cced84ee95618cce . So it's not the more recent version.
## Links
## Official Website: http://strut.io
* Report a bug: https://github.com/YunoHost-Apps/strut_ynh/issues
* Strut website: http://strut.io
* Strut repository: https://github.com/MohannadNaj/Strut
* YunoHost website: https://yunohost.org/
## About Strut
---
[![Facelift](https://f.cloud.github.com/assets/1009003/515405/f1003c6a-be74-11e2-84b9-14776c652afb.png)](http://strut.io)
Developers info
----------------
#### A GUI / Authoring Tool for ImpressJS and Bespoke.js ####
Don't know what ImpressJS is? Check out the ImpressJS demo presentation: https://impress.github.io/impress.js/#/bored
### Start using Strut! http://strut.io/editor/
(works in Firefox, Chrome and Safari with basic support for IE10)
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/strut_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
sudo yunohost app install https://github.com/YunoHost-Apps/strut_ynh/tree/testing --debug
or
sudo yunohost app upgrade strut -u https://github.com/YunoHost-Apps/strut_ynh/tree/testing --debug
```

View file

@ -1,5 +1,3 @@
# See here for more informations
# https://github.com/YunoHost/package_check#syntax-check_process-file
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
@ -13,29 +11,18 @@
setup_private=1
setup_public=1
upgrade=1
# upgrade=1 from_commit=03c3ea18cf117127749a860afe538bc6070a8e0b
upgrade=1 from_commit=f6565f66d82fa077d752226f8b8267018f7b91d8
backup_restore=1
multi_instance=1
incorrect_path=1
port_already_use=0
change_url=1
;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
# Level 4:
Level 4=1
# Level 5:
Level 5=auto
Level 6=auto
Level 7=auto
# Level 8=1
# Level 9=1
Level 10=0
;;; Options
Email=ljf+ynh-strut@grimaud.me
Notification=down
#;;; Upgrade options
# ; commit=03c3ea18cf117127749a860afe538bc6070a8e0b
# name=Update package to level 7
# manifest_arg=domain=DOMAIN&path=PATH&is_public=Yes&
;;; Upgrade options
; commit=f6565f66d82fa077d752226f8b8267018f7b91d8
name=May 27, 2018
manifest_arg=domain=DOMAIN&path=PATH&is_public=Yes&

View file

@ -1,10 +1,18 @@
location __PATH__ {
alias __FINALPATH__/;
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
# Path to source
alias __FINALPATH__/ ;
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
index index.html;
try_files $uri $uri/ /index.html;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}

View file

@ -6,7 +6,7 @@
"url": "http://strut.io",
"license": "AGPL-3.0",
"requirements": {
"yunohost": ">= 2.7.2"
"yunohost": ">= 3.5.0"
},
"description": {
"en": "Strut is a slide editor creating impress.js presentations.",

View file

@ -19,7 +19,6 @@
- [ ] **Approval (LGTM)** :
- [ ] **Approval (LGTM)** :
- **CI succeeded** :
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/strut_ynh%20-BRANCH-%20(Official)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/strut_ynh%20-BRANCH-%20(Official)/) *Please replace '-BRANCH-' in this link for a PR from a local branch.*
or
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/strut_ynh%20PR-NUM-%20(Official_fork)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/strut_ynh%20PR-NUM-%20(Official_fork)/) *Replace '-NUM-' by the PR number in this link for a PR from a forked repository.*
[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/strut_ynh%20PR-NUM-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/strut_ynh%20PR-NUM-/)
*Please replace '-NUM-' in this link by the PR number.*
When the PR is marked as ready to merge, you have to wait for 3 days before really merging it.

1
scripts/_common.sh Normal file
View file

@ -0,0 +1 @@
#!/bin/bash

View file

@ -1,45 +0,0 @@
log() {
echo "${1}"
}
info() {
log "[INFO] ${1}"
}
warn() {
log "[WARN] ${1}"
}
err() {
log "[ERR] ${1}"
}
to_logs() {
# When yunohost --verbose or bash -x
if $_ISVERBOSE; then
cat
else
cat > /dev/null
fi
}
read_json () {
sudo python3 -c "import sys, json;print(json.load(open('$1'))['$2'])"
}
read_manifest () {
if [ -f '../manifest.json' ] ; then
read_json '../manifest.json' "$1"
else
read_json '../settings/manifest.json' "$1"
fi
}
abort_if_up_to_date () {
version=$(read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" 'version' 2> /dev/null || echo '20160501-7')
last_version=$(read_manifest 'version')
if [ "${version}" = "${last_version}" ]; then
info "Up-to-date, nothing to do"
ynh_die "" 0
fi
}

View file

@ -5,33 +5,45 @@
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain)
domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Backing up the main app directory..."
ynh_backup "$final_path"
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Backing up nginx web server configuration..."
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
source _future.sh
# source _common.sh
source /usr/share/yunohost/helpers
#=================================================
@ -22,13 +22,12 @@ new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK THE SYNTAX OF THE PATHS
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
test -n "$old_path" || old_path="/"
test -n "$new_path" || new_path="/"
new_path=$(ynh_normalize_url_path $new_path)
old_path=$(ynh_normalize_url_path $old_path)
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
@ -46,50 +45,48 @@ then
change_path=1
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
#ynh_backup_before_upgrade # Backup the current version of the app
#ynh_clean_setup () {
# ynh_restore_upgradebackup # restore it if the upgrade fails
#}
#ynh_abort_if_errors # Exit if an error occurs during the execution of the script
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating nginx web server configuration..." --weight=2
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the nginx config file
if [ $change_path -eq 1 ]
then
# Replace locations starting with old_path
# Look for every location possible patterns (see https://nginx.org/en/docs/http/ngx_http_core_module.html#location)
sed --in-place "s@location\( \(=\|~\|~\*\|\^~\)\)\? $old_path@location\1 $new_path@" "$nginx_conf_path"
# Replace path in "return" directives
sed --in-place "s@return \([[:digit:]]\{3\}\) $old_path@return \1 $new_path@" "$nginx_conf_path"
# Make a backup of the original nginx config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for nginx helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated nginx config
ynh_add_nginx_config
fi
# Change the domain for nginx
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# ...
#=================================================
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..."
systemctl reload nginx
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -1,21 +1,25 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
#source _common.sh
# source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
@ -25,45 +29,64 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=2
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register $app $domain $path_url
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_app_setting_set $app is_public $is_public
ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_app_setting_set $app final_path $final_path
ynh_script_progression --message="Setting up source files..." --weight=4
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
# For this app sources are in app subdirectory
tmp_dir=$(mktemp -d)
ynh_clean_setup () {
ynh_secure_remove "$tmp_dir"
}
ynh_setup_source "$tmp_dir"
ynh_setup_source --dest_dir="$tmp_dir"
mv "$tmp_dir/dist" "$final_path"
# Imgur is deactivated on the specific upstream selected, but this text is still here
# Don't use a patch because it's minified js
ynh_replace_string "are currently uploaded to imgur.*re working on changing this" "size is limited" "$final_path/scripts/amd-app.js"
ynh_secure_remove "$tmp_dir"
ynh_secure_remove --file="$tmp_dir"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring nginx web server..." --weight=4
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# PATCH SOURCE
#=================================================
# Imgur is deactivated on the specific upstream selected, but this text is still here
# Don't use a patch because it's minified js
ynh_replace_string --match_string="are currently uploaded to imgur.*re working on changing this" --replace_string="size is limited" --target_file="$final_path/scripts/amd-app.js"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set strong right permissions to app files
# Set permissions to app files
chown -R root:www-data "$final_path"
chmod -R 640 "$final_path"
find "$final_path" -type d -print0 | xargs -0 chmod 750
@ -71,14 +94,23 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..."
# Make app public if necessary or protect it
# Make app public if necessary
if [ $is_public -eq 1 ]
then
ynh_app_setting_set $app skipped_uris "/"
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
fi
#=================================================
# RELOAD NGINX
#=================================================
systemctl reload nginx
ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -6,29 +6,39 @@
# IMPORT GENERIC HELPERS
#=================================================
# source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=2
# Remove the app directory securely
ynh_secure_remove "$final_path"
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing nginx web server configuration..."
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -6,44 +6,51 @@
# IMPORT GENERIC HELPERS
#=================================================
#source ../settings/scripts/_common.sh
# source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit on command errors and treat access to unset variables as an error
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=3
ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}"
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die "There is already a directory: $final_path "
conf="/etc/nginx/conf.d/$domain.d/$app.conf"
test ! -f $conf \
|| ynh_die "There is already a nginx conf file at this path: $conf "
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE BACKUP FILES
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
#=================================================
# RESTORE USER RIGHTS
@ -59,5 +66,12 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..."
systemctl reload nginx
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -6,64 +6,71 @@
# IMPORT GENERIC HELPERS
#=================================================
source _future.sh
# source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=3
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
is_public=$(ynh_app_setting_get $app is_public)
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# Check version
#=================================================
abort_if_up_to_date
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
# CHECK VERSION
#=================================================
ynh_backup_before_upgrade # Backup the current version of the app
ynh_clean_setup () {
ynh_restore_upgradebackup # restore it if the upgrade fails
}
ynh_abort_if_errors # Exit if an error occurs during the execution of the script
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
if [ "${version}" = "20160501-7" ]; then
public_site=$(ynh_app_setting_get $app public_site)
public_site=$(ynh_app_setting_get --app=$app --key=public_site)
# Fix is_public as a boolean value
if [ "$public_site" = "Yes" ]; then
ynh_app_setting_set $app is_public 1
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$public_site" = "No" ]; then
ynh_app_setting_set $app is_public 0
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
ynh_app_setting_delete $app public_site
# If final_path doesn't exist, create it
if [ -z $final_path ]; then
if [ -z "$final_path" ]; then
final_path=/var/www/$app
ynh_app_setting_set $app final_path $final_path
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=6
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
path_url=$(ynh_normalize_url_path $path_url)
path_url=$(ynh_normalize_url_path --path_url=$path_url)
#=================================================
# STANDARD UPGRADE STEPS
@ -71,31 +78,48 @@ path_url=$(ynh_normalize_url_path $path_url)
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
# Download, check integrity, uncompress and patch the source from app.src
# For this app sources are in app subdirectory
tmp_dir=$(mktemp -d)
ynh_setup_source "$tmp_dir"
# Dist is the compiled version. Other directories are source code and tools to build the program
cp -R "$tmp_dir/dist/." "$final_path/"
# Imgur is deactivated on the specific upstream selected, but this text is still here
# Don't use a patch because it's minified js
ynh_replace_string "are currently uploaded to imgur.*re working on changing this" "size is limited" "$final_path/scripts/amd-app.js"
ynh_secure_remove "$tmp_dir"
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=4
# Download, check integrity, uncompress and patch the source from app.src
# For this app sources are in app subdirectory
tmp_dir=$(mktemp -d)
ynh_setup_source --dest_dir="$tmp_dir"
# Dist is the compiled version. Other directories are source code and tools to build the program
cp -a "$tmp_dir/dist/." "$final_path/"
ynh_secure_remove --file="$tmp_dir"
fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..."
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# PATCH SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
# Imgur is deactivated on the specific upstream selected, but this text is still here
# Don't use a patch because it's minified js
ynh_replace_string --match_string="are currently uploaded to imgur.*re working on changing this" --replace_string="size is limited" --target_file="$final_path/scripts/amd-app.js"
fi
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set strong right permissions
# Set permissions on app files
chown -R root:www-data "$final_path"
chmod -R 640 "$final_path"
find "$final_path" -type d -print0 | xargs -0 chmod 750
@ -103,16 +127,23 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=5
# Make app public if necessary or protect it
# Make app public if necessary
if [ $is_public -eq 1 ]
then
ynh_app_setting_set $app skipped_uris "/"
else
ynh_app_setting_set $app protected_uris "/"
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
fi
#=================================================
# RELOAD NGINX
#=================================================
systemctl reload nginx
ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last