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 #12 from YunoHost-Apps/package_upgrade

Package upgrade
This commit is contained in:
JimboJoe 2019-03-08 09:12:34 +01:00 committed by GitHub
commit feccb3dab7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 141 additions and 42 deletions

View file

@ -1,13 +1,59 @@
# 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%28Official%29.svg)](https://ci-apps.yunohost.org/ci/apps/shellinabox/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/shellinabox%20%28Official%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%28Official%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
* 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)

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'"; add_header 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.2.0"
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [
"nginx", "nginx"
"shellinabox"
], ],
"arguments": { "arguments": {
"install": [ "install": [

View file

@ -2,22 +2,23 @@
#================================================= #=================================================
# 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_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -28,6 +29,7 @@ domain=$(ynh_app_setting_get $app domain)
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_print_info "Backing up the main app directory..."
ynh_backup "/etc/shellinabox" ynh_backup "/etc/shellinabox"
ynh_backup "/etc/default/shellinabox" ynh_backup "/etc/default/shellinabox"
@ -35,5 +37,12 @@ ynh_backup "/etc/default/shellinabox"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info "Backing up nginx web server configuration..."
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -27,18 +27,18 @@ 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_print_info "Validating installation parameters..."
# 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)
# 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 $domain $path_url
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_print_info "Storing installation settings..."
ynh_app_setting_set $app domain $domain ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url ynh_app_setting_set $app path $path_url
@ -48,6 +48,7 @@ ynh_app_setting_set $app path $path_url
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_print_info "Looking for a free port..."
# Find a free port # Find a free port
port=$(ynh_find_port 4200) port=$(ynh_find_port 4200)
@ -56,6 +57,7 @@ ynh_app_setting_set $app port $port
#================================================= #=================================================
# INSTALL SHELLINABOX # INSTALL SHELLINABOX
#================================================= #=================================================
ynh_print_info "Installing shellinabox..."
ynh_package_update ynh_package_update
ynh_package_install shellinabox ynh_package_install shellinabox
@ -63,6 +65,7 @@ ynh_package_install shellinabox
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info "Configuring nginx web server..."
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -72,6 +75,7 @@ ynh_add_nginx_config
#================================================= #=================================================
# CONFIGURE SHELLINABOX # CONFIGURE SHELLINABOX
#================================================= #=================================================
ynh_print_info "Configuring shellinabox..."
cp ../conf/shellinabox /etc/default/shellinabox cp ../conf/shellinabox /etc/default/shellinabox
ynh_replace_string "__PORT__" "$port" "/etc/default/shellinabox" ynh_replace_string "__PORT__" "$port" "/etc/default/shellinabox"
@ -100,5 +104,12 @@ yunohost service add $app
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_print_info "Reloading nginx web server..."
systemctl reload nginx systemctl reload nginx
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Installation of $app completed"

View file

@ -11,6 +11,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -23,21 +24,24 @@ 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_print_info "Removing $app service"
yunohost service remove $app yunohost service remove $app
fi fi
#================================================= #=================================================
# REMOVE SHELLINABOX # REMOVE SHELLINABOX
#================================================= #=================================================
ynh_print_info "Removing shellinabox"
ynh_package_autopurge shellinabox ynh_package_autopurge shellinabox
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info "Removing nginx web server configuration"
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config

View file

@ -2,22 +2,23 @@
#================================================= #=================================================
# 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_print_info "Loading settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -28,6 +29,7 @@ port=$(ynh_app_setting_get $app port)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_print_info "Validating restoration parameters..."
ynh_webpath_available $domain $path_url \ ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}" || ynh_die "Path not available: ${domain}${path_url}"
@ -43,6 +45,7 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# INSTALL SHELLINABOX # INSTALL SHELLINABOX
#================================================= #=================================================
ynh_print_info "Installing shellinabox..."
ynh_package_update ynh_package_update
ynh_package_install shellinabox ynh_package_install shellinabox
@ -50,6 +53,7 @@ ynh_package_install shellinabox
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_print_info "Restoring the app main directory..."
ynh_restore_file "/etc/shellinabox" ynh_restore_file "/etc/shellinabox"
ynh_restore_file "/etc/default/shellinabox" ynh_restore_file "/etc/default/shellinabox"
@ -71,5 +75,12 @@ yunohost service add $app
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_print_info "Reloading nginx web server and php-fpm..."
systemctl reload nginx systemctl reload nginx
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Restoration completed for $app"

View file

@ -11,6 +11,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -21,9 +22,10 @@ port=$(ynh_app_setting_get $app port)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_print_info "Ensuring downward compatibility..."
# 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 port $port
fi fi
@ -31,12 +33,16 @@ fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_print_info "Backing up the app before upgrading (may take a while)..."
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
@ -50,18 +56,15 @@ path_url=$(ynh_normalize_url_path $path_url)
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info "Upgrading nginx web server configuration..."
# 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_print_info "Upgrading shellinabox configuration..."
# 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 "/etc/default/shellinabox"
@ -81,3 +84,16 @@ systemctl restart shellinabox
# 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 "/etc/default/shellinabox"
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx web server..."
systemctl reload nginx
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Upgrade of $app completed"