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

Merge pull request #13 from YunoHost-Apps/testing

Testing
This commit is contained in:
Maniack Crudelis 2019-07-08 22:54:39 +02:00 committed by GitHub
commit c1341eacab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 298 additions and 100 deletions

View file

@ -1,13 +1,60 @@
# Shell In A Box for YunoHost # Shell In A Box for YunoHost
Shell In A Box implements a web server that can export arbitrary command line tools to a web based terminal emulator. This emulator is accessible to any JavaScript and CSS enabled web browser and does not require any additional browser plugins. Most typically, login shells would be exported this way: [![Integration level](https://dash.yunohost.org/integration/shellinabox.svg)](https://dash.yunohost.org/appci/app/shellinabox)
[![Install Shell In A Box with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=shellinabox)
https://github.com/shellinabox/shellinabox > *This package allow you to install Shell In A Box 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.*
### Install ## Overview
`$ sudo yunohost app install https://github.com/YunoHost-Apps/shellinabox_ynh.git` Shell In A Box implements a web server that can export arbitrary command line tools to a web based terminal emulator. This emulator is accessible to any JavaScript and CSS enabled web browser and does not require any additional browser plugins.
### Update **Shipped version:** Current Debian version.
`$ sudo yunohost app upgrade --verbose shellinabox -u https://github.com/YunoHost-Apps/shellinabox_ynh.git` ## Screenshots
![](https://raw.githubusercontent.com/shellinabox/shellinabox/master/misc/preview.gif)
## Configuration
## Documentation
* Official documentation: https://code.google.com/archive/p/shellinabox/wikis/shellinaboxd_man.wiki
* 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/shellinabox%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/shellinabox/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/shellinabox%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/shellinabox/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/shellinabox%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/shellinabox/)
## Limitations
## Additional information
## Links
* Report a bug: https://github.com/YunoHost-Apps/shellinabox_ynh/issues
* Shell In A Box website: https://github.com/shellinabox/shellinabox
* Shell In A Box repository: https://github.com/shellinabox/shellinabox
* YunoHost website: https://yunohost.org/
---
Developers info
----------------
**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/shellinabox_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
sudo yunohost app install https://github.com/YunoHost-Apps/shellinabox_ynh/tree/testing --debug
or
sudo yunohost app upgrade shellinabox -u https://github.com/YunoHost-Apps/shellinabox_ynh/tree/testing --debug
```

View file

@ -1,5 +1,4 @@
;; Test complet ;; Test complet
auto_remove=1
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld" (DOMAIN)
path="/path" (PATH) path="/path" (PATH)
@ -16,19 +15,9 @@
multi_instance=0 multi_instance=0
incorrect_path=1 incorrect_path=1
port_already_use=0 port_already_use=0
change_url=0 change_url=1
;;; Levels ;;; Levels
Level 1=auto Level 5=auto
Level 2=auto
Level 3=auto
Level 4=na
# Level 5: https://github.com/YunoHost-Apps/shellinabox_ynh/issues/3
Level 5=1
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none

View file

@ -1,4 +1,7 @@
location __PATH__ { #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
# Force usage of https
if ($scheme = http) { if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
@ -9,11 +12,12 @@ location __PATH__ {
proxy_buffering off; proxy_buffering off;
tcp_nodelay on; tcp_nodelay on;
access_log off; access_log off;
# Allow shellinabox to use 'eval' without blocking the execution. But keep a warning. # Allow shellinabox to use 'eval' without blocking the execution. But keep a warning.
add_header Content-Security-Policy-Report-Only "script-src https: 'unsafe-eval'"; more_set_headers Content-Security-Policy-Report-Only "script-src https: 'unsafe-eval'";
more_clear_input_headers 'Accept-Encoding';
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
more_clear_input_headers 'Accept-Encoding';
} }

View file

@ -6,7 +6,7 @@
"en": "Web based AJAX terminal emulator", "en": "Web based AJAX terminal emulator",
"fr": "Émulateur de terminal web" "fr": "Émulateur de terminal web"
}, },
"version": "1.1.0", "version": "1.1.0~ynh1",
"url": "https://github.com/shellinabox/shellinabox", "url": "https://github.com/shellinabox/shellinabox",
"license": "GPL-2.0", "license": "GPL-2.0",
"maintainer": { "maintainer": {
@ -14,12 +14,11 @@
"email": "kload@kload.fr" "email": "kload@kload.fr"
}, },
"requirements": { "requirements": {
"yunohost": ">= 2.7.2" "yunohost": ">= 3.5.0"
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [
"nginx", "nginx"
"shellinabox"
], ],
"arguments": { "arguments": {
"install": [ "install": [

View file

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

View file

@ -2,38 +2,47 @@
#================================================= #=================================================
# GENERIC START # GENERIC START
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit on command errors and treat access to unset variables as an error
set -eu
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
source /usr/share/yunohost/helpers 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 # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Backing up the main app directory..."
ynh_backup "/etc/shellinabox" ynh_backup --src_path="/etc/shellinabox"
ynh_backup "/etc/default/shellinabox" ynh_backup --src_path="/etc/default/shellinabox"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # 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

106
scripts/change_url Normal file
View file

@ -0,0 +1,106 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping shellinabox..."
ynh_systemd_action --service_name=shellinabox --action=stop
#=================================================
# 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
# 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
#=================================================
# GENERIC FINALISATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting shellinabox..."
ynh_systemd_action --service_name=shellinabox --action=start
#=================================================
# 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="Change of URL completed for $app" --last

View file

@ -27,35 +27,34 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..."
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path # 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 # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set $app domain $domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set $app path $path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_script_progression --message="Configuring firewall..." --weight=2
# Find a free port # Find a free port
port=$(ynh_find_port 4200) port=$(ynh_find_port --port=4200)
ynh_app_setting_set $app port $port ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
# INSTALL SHELLINABOX # INSTALL SHELLINABOX
#================================================= #=================================================
ynh_script_progression --message="Installing shellinabox..." --weight=7
ynh_package_update ynh_package_update
ynh_package_install shellinabox ynh_package_install shellinabox
@ -63,6 +62,7 @@ ynh_package_install shellinabox
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring nginx web server..." --weight=2
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -72,22 +72,23 @@ ynh_add_nginx_config
#================================================= #=================================================
# CONFIGURE SHELLINABOX # CONFIGURE SHELLINABOX
#================================================= #=================================================
ynh_script_progression --message="Configuring shellinabox..." --weight=2
cp ../conf/shellinabox /etc/default/shellinabox cp ../conf/shellinabox /etc/default/shellinabox
ynh_replace_string "__PORT__" "$port" "/etc/default/shellinabox" ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="/etc/default/shellinabox"
# Allow the service to log in syslog # Allow the service to log in syslog
ynh_replace_string " -- -q --background" " -- --background" "/etc/init.d/shellinabox" ynh_replace_string --match_string=" -- -q --background" --replace_string=" -- --background" --target_file="/etc/init.d/shellinabox"
systemctl daemon-reload systemctl daemon-reload
systemctl restart shellinabox ynh_systemd_action --service_name=shellinabox --action=restart
#================================================= #=================================================
# STORE THE CHECKSUM OF THE CONFIG FILE # STORE THE CHECKSUM OF THE CONFIG FILE
#================================================= #=================================================
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "/etc/default/shellinabox" ynh_store_file_checksum --file="/etc/default/shellinabox"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -100,5 +101,12 @@ yunohost service add $app
#================================================= #=================================================
# RELOAD NGINX # 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="Installation of $app completed" --last

View file

@ -11,11 +11,12 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get $app port) port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -23,21 +24,30 @@ port=$(ynh_app_setting_get $app port)
# REMOVE SERVICE FROM ADMIN PANEL # REMOVE SERVICE FROM ADMIN PANEL
#================================================= #=================================================
if yunohost service status | grep -q $app # Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status $app >/dev/null 2>&1
then then
echo "Remove $app service" ynh_script_progression --message="Removing $app service..."
yunohost service remove $app yunohost service remove $app
fi fi
#================================================= #=================================================
# REMOVE SHELLINABOX # REMOVE SHELLINABOX
#================================================= #=================================================
ynh_script_progression --message="Removing shellinabox..." --weight=20
ynh_package_autopurge shellinabox ynh_package_autopurge shellinabox
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing nginx web server configuration..."
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -2,35 +2,37 @@
#================================================= #=================================================
# GENERIC START # GENERIC START
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit on command errors and treat access to unset variables as an error
set -eu
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
source /usr/share/yunohost/helpers 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 # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get --app=$app --key=path)
port=$(ynh_app_setting_get $app port) port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..."
ynh_webpath_available $domain $path_url \ ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die "Path not available: ${domain}${path_url}" || ynh_die --message="Path not available: ${domain}${path_url}"
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
@ -38,11 +40,12 @@ ynh_webpath_available $domain $path_url \
# RESTORE THE NGINX CONFIGURATION # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# INSTALL SHELLINABOX # INSTALL SHELLINABOX
#================================================= #=================================================
ynh_script_progression --message="Installing shellinabox..." --weight=7
ynh_package_update ynh_package_update
ynh_package_install shellinabox ynh_package_install shellinabox
@ -50,15 +53,17 @@ ynh_package_install shellinabox
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=3
ynh_restore_file "/etc/shellinabox" ynh_restore_file --origin_path="/etc/shellinabox"
ynh_restore_file "/etc/default/shellinabox" ynh_restore_file --origin_path="/etc/default/shellinabox"
# Allow the service to log in syslog # Allow the service to log in syslog
ynh_replace_string " -- -q --background" " -- --background" "/etc/init.d/shellinabox" ynh_replace_string --match_string=" -- -q --background" --replace_string=" -- --background" --target_file="/etc/init.d/shellinabox"
systemctl daemon-reload systemctl daemon-reload
systemctl restart shellinabox ynh_systemd_action --service_name=shellinabox --action=restart
#================================================= #=================================================
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
@ -71,5 +76,12 @@ yunohost service add $app
#================================================= #=================================================
# RELOAD NGINX # 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

@ -11,73 +11,88 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get --app=$app --key=path)
port=$(ynh_app_setting_get $app port) port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
# If port doesn't exist, create it # If port doesn't exist, create it
if [ -z $port ]; then if [ -z "$port" ]; then
port=4200 port=4200
ynh_app_setting_set $app port $port ynh_app_setting_set --app=$app --key=port --value=$port
fi fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5
ynh_backup_before_upgrade # Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
ynh_restore_upgradebackup # restore it if the upgrade fails # restore it if the upgrade fails
ynh_restore_upgradebackup
} }
ynh_abort_if_errors # Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# CHECK THE PATH # CHECK THE PATH
#================================================= #=================================================
# Normalize the URL path syntax # 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 # STANDARD UPGRADE STEPS
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# RELOAD NGINX
#=================================================
systemctl reload nginx
#================================================= #=================================================
# CONFIGURE SHELLINABOX # CONFIGURE SHELLINABOX
#================================================= #=================================================
ynh_script_progression --message="Upgrading shellinabox configuration..." --weight=4
# Verify the checksum and backup the file if it's different # Verify the checksum and backup the file if it's different
ynh_backup_if_checksum_is_different "/etc/default/shellinabox" ynh_backup_if_checksum_is_different --file="/etc/default/shellinabox"
cp ../conf/shellinabox /etc/default/shellinabox cp ../conf/shellinabox /etc/default/shellinabox
ynh_replace_string "__PORT__" "$port" "/etc/default/shellinabox" ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="/etc/default/shellinabox"
# Allow the service to log in syslog ynh_replace_string --match_string=" -- -q --background" --replace_string=" -- --background" --target_file="/etc/init.d/shellinabox"
ynh_replace_string " -- -q --background" " -- --background" "/etc/init.d/shellinabox"
systemctl daemon-reload systemctl daemon-reload
systemctl restart shellinabox ynh_systemd_action --service_name=shellinabox --action=restart
#================================================= #=================================================
# STORE THE CHECKSUM OF THE CONFIG FILE # STORE THE CHECKSUM OF THE CONFIG FILE
#================================================= #=================================================
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "/etc/default/shellinabox" ynh_store_file_checksum --file="/etc/default/shellinabox"
#=================================================
# 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