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:
commit
feccb3dab7
9 changed files with 141 additions and 42 deletions
58
README.md
58
README.md
|
@ -1,13 +1,59 @@
|
|||
# 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:
|
||||
[](https://dash.yunohost.org/appci/app/shellinabox)
|
||||
[](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
|
||||
|
||||

|
||||
|
||||
## 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 - [](https://ci-apps.yunohost.org/ci/apps/shellinabox/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/shellinabox/)
|
||||
* Jessie x86-64b - [](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
|
||||
```
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
;; Test complet
|
||||
auto_remove=1
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
location __PATH__ {
|
||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
location __PATH__/ {
|
||||
|
||||
# Force usage of https
|
||||
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
|
@ -13,7 +16,8 @@ location __PATH__ {
|
|||
# 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_clear_input_headers 'Accept-Encoding';
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
more_clear_input_headers 'Accept-Encoding';
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Web based AJAX terminal emulator",
|
||||
"fr": "Émulateur de terminal web"
|
||||
},
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.0~ynh1",
|
||||
"url": "https://github.com/shellinabox/shellinabox",
|
||||
"license": "GPL-2.0",
|
||||
"maintainer": {
|
||||
|
@ -14,12 +14,11 @@
|
|||
"email": "kload@kload.fr"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 2.7.2"
|
||||
"yunohost": ">= 3.2.0"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"nginx",
|
||||
"shellinabox"
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
|
|
|
@ -2,22 +2,23 @@
|
|||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit on command errors and treat access to unset variables as an error
|
||||
set -eu
|
||||
|
||||
#=================================================
|
||||
# IMPORT GENERIC 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
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -28,6 +29,7 @@ domain=$(ynh_app_setting_get $app domain)
|
|||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info "Backing up the main app directory..."
|
||||
|
||||
ynh_backup "/etc/shellinabox"
|
||||
ynh_backup "/etc/default/shellinabox"
|
||||
|
@ -35,5 +37,12 @@ ynh_backup "/etc/default/shellinabox"
|
|||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Backing up nginx web server configuration..."
|
||||
|
||||
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)."
|
||||
|
|
|
@ -27,18 +27,18 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_print_info "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
|
||||
ynh_webpath_register $app $domain $path_url
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_print_info "Storing installation settings..."
|
||||
|
||||
ynh_app_setting_set $app domain $domain
|
||||
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
|
||||
#=================================================
|
||||
ynh_print_info "Looking for a free port..."
|
||||
|
||||
# Find a free port
|
||||
port=$(ynh_find_port 4200)
|
||||
|
@ -56,6 +57,7 @@ ynh_app_setting_set $app port $port
|
|||
#=================================================
|
||||
# INSTALL SHELLINABOX
|
||||
#=================================================
|
||||
ynh_print_info "Installing shellinabox..."
|
||||
|
||||
ynh_package_update
|
||||
ynh_package_install shellinabox
|
||||
|
@ -63,6 +65,7 @@ ynh_package_install shellinabox
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Configuring nginx web server..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
@ -72,6 +75,7 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
# CONFIGURE SHELLINABOX
|
||||
#=================================================
|
||||
ynh_print_info "Configuring shellinabox..."
|
||||
|
||||
cp ../conf/shellinabox /etc/default/shellinabox
|
||||
ynh_replace_string "__PORT__" "$port" "/etc/default/shellinabox"
|
||||
|
@ -100,5 +104,12 @@ yunohost service add $app
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx web server..."
|
||||
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Installation of $app completed"
|
||||
|
|
|
@ -11,6 +11,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -23,21 +24,24 @@ port=$(ynh_app_setting_get $app port)
|
|||
# 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
|
||||
echo "Remove $app service"
|
||||
ynh_print_info "Removing $app service"
|
||||
yunohost service remove $app
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE SHELLINABOX
|
||||
#=================================================
|
||||
ynh_print_info "Removing shellinabox"
|
||||
|
||||
ynh_package_autopurge shellinabox
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Removing nginx web server configuration"
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
|
|
@ -2,22 +2,23 @@
|
|||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit on command errors and treat access to unset variables as an error
|
||||
set -eu
|
||||
|
||||
#=================================================
|
||||
# IMPORT GENERIC 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
|
||||
#=================================================
|
||||
ynh_print_info "Loading settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -28,6 +29,7 @@ port=$(ynh_app_setting_get $app port)
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_print_info "Validating restoration parameters..."
|
||||
|
||||
ynh_webpath_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
|
||||
#=================================================
|
||||
ynh_print_info "Installing shellinabox..."
|
||||
|
||||
ynh_package_update
|
||||
ynh_package_install shellinabox
|
||||
|
@ -50,6 +53,7 @@ ynh_package_install shellinabox
|
|||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info "Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file "/etc/shellinabox"
|
||||
ynh_restore_file "/etc/default/shellinabox"
|
||||
|
@ -71,5 +75,12 @@ yunohost service add $app
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx web server and php-fpm..."
|
||||
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Restoration completed for $app"
|
||||
|
|
|
@ -11,6 +11,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -21,9 +22,10 @@ port=$(ynh_app_setting_get $app port)
|
|||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_print_info "Ensuring downward compatibility..."
|
||||
|
||||
# If port doesn't exist, create it
|
||||
if [ -z $port ]; then
|
||||
if [ -z "$port" ]; then
|
||||
port=4200
|
||||
ynh_app_setting_set $app port $port
|
||||
fi
|
||||
|
@ -31,12 +33,16 @@ fi
|
|||
#=================================================
|
||||
# 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_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
|
||||
|
@ -50,18 +56,15 @@ path_url=$(ynh_normalize_url_path $path_url)
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading nginx web server configuration..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
||||
systemctl reload nginx
|
||||
#=================================================
|
||||
# CONFIGURE SHELLINABOX
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading shellinabox configuration..."
|
||||
|
||||
# Verify the checksum and backup the file if it's different
|
||||
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
|
||||
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"
|
||||
|
|
Loading…
Add table
Reference in a new issue