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 #28 from YunoHost-Apps/testing

Apply example_ynh
This commit is contained in:
yalh76 2022-07-13 02:15:18 +02:00 committed by GitHub
commit 86375c3948
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 266 additions and 156 deletions

View file

@ -1,57 +1,48 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Shell In A Box for YunoHost
[![Integration level](https://dash.yunohost.org/integration/shellinabox.svg)](https://dash.yunohost.org/appci/app/shellinabox) ![](https://ci-apps.yunohost.org/ci/badges/shellinabox.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/shellinabox.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/shellinabox.svg)](https://dash.yunohost.org/appci/app/shellinabox) ![Working status](https://ci-apps.yunohost.org/ci/badges/shellinabox.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/shellinabox.maintain.svg)
[![Install Shell In A Box with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=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.*
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Shell In A Box quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
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.
**Shipped version:** 2.21 (current Debian version)
**Shipped version:** 2.21~ynh3
## Screenshots
![](https://raw.githubusercontent.com/shellinabox/shellinabox/master/misc/preview.gif)
![Screenshot of Shell In A Box](./doc/screenshots/screenshot.gif)
## Configuration
## Documentation and resources
## Documentation
* Official app website: <https://code.google.com/archive/p/shellinabox/>
* Official user documentation: <https://code.google.com/p/shellinabox/wiki/shellinaboxd_man>
* Official admin documentation: <https://github.com/shellinabox/shellinabox/wiki/shellinaboxd_man>
* Upstream app code repository: <https://github.com/shellinabox/shellinabox>
* YunoHost documentation for this app: <https://yunohost.org/app_shellinabox>
* Report a bug: <https://github.com/YunoHost-Apps/shellinabox_ynh/issues>
* Official documentation: https://code.google.com/archive/p/shellinabox/wikis/shellinaboxd_man.wiki
* YunoHost documentation: If specific documentation is needed, feel free to contribute.
## Developer info
## YunoHost specific features
#### Multi-users support
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/shellinabox.svg)](https://ci-apps.yunohost.org/ci/apps/shellinabox/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/shellinabox.svg)](https://ci-apps-arm.yunohost.org/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
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/shellinabox_ynh/tree/testing).
Please send 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.
```
``` bash
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
```
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

48
README_fr.md Normal file
View file

@ -0,0 +1,48 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Shell In A Box pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/shellinabox.svg)](https://dash.yunohost.org/appci/app/shellinabox) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/shellinabox.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/shellinabox.maintain.svg)
[![Installer Shell In A Box avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=shellinabox)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Shell In A Box rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
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.
**Version incluse :** 2.21~ynh3
## Captures d'écran
![Capture d'écran de Shell In A Box](./doc/screenshots/screenshot.gif)
## Documentations et ressources
* Site officiel de l'app : <https://code.google.com/archive/p/shellinabox/>
* Documentation officielle utilisateur : <https://code.google.com/p/shellinabox/wiki/shellinaboxd_man>
* Documentation officielle de l'admin : <https://github.com/shellinabox/shellinabox/wiki/shellinaboxd_man>
* Dépôt de code officiel de l'app : <https://github.com/shellinabox/shellinabox>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_shellinabox>
* Signaler un bug : <https://github.com/YunoHost-Apps/shellinabox_ynh/issues>
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/shellinabox_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/shellinabox_ynh/tree/testing --debug
ou
sudo yunohost app upgrade shellinabox -u https://github.com/YunoHost-Apps/shellinabox_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -10,14 +10,14 @@
setup_private=0
setup_public=0
upgrade=1
# 1.1.0
upgrade=1 from_commit=a94b50de8b68501148fa90419ad3ea8e24c675e1
#2.21~ynh2
upgrade=1 from_commit=83014f57450daf58746e7fb79003f52ad8d2da1e
backup_restore=1
multi_instance=0
port_already_use=0
change_url=1
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=a94b50de8b68501148fa90419ad3ea8e24c675e1
name=Refactoring
manifest_arg=domain=DOMAIN&path=PATH&

0
doc/.gitkeep Normal file
View file

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
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.

0
doc/DISCLAIMER.md Normal file
View file

0
doc/screenshots/.gitkeep Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 930 KiB

View file

@ -1,37 +1,44 @@
{
"name": "Shell In A Box",
"id": "shellinabox",
"packaging_format": 1,
"description": {
"en": "Web based AJAX terminal emulator",
"fr": "Émulateur de terminal web"
},
"version": "2.21~ynh2",
"url": "https://github.com/shellinabox/shellinabox",
"license": "GPL-2.0",
"maintainer": {
"name": "kload",
"email": "kload@kload.fr"
},
"requirements": {
"name": "Shell In A Box",
"id": "shellinabox",
"packaging_format": 1,
"description": {
"en": "Web based AJAX terminal emulator",
"fr": "Émulateur de terminal web"
},
"version": "2.21~ynh3",
"url": "https://github.com/shellinabox/shellinabox",
"upstream": {
"license": "GPL-2.0",
"website": "https://code.google.com/archive/p/shellinabox/",
"admindoc": "https://github.com/shellinabox/shellinabox/wiki/shellinaboxd_man",
"userdoc": "https://code.google.com/p/shellinabox/wiki/shellinaboxd_man",
"code": "https://github.com/shellinabox/shellinabox"
},
"license": "GPL-2.0",
"maintainer": {
"name": "",
"email": ""
},
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"example": "/ssh",
"default": "/ssh"
}
]
}
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"example": "/ssh",
"default": "/ssh"
}
]
}
}

View file

@ -6,12 +6,17 @@
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -29,19 +34,19 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="/etc/shellinabox"
ynh_backup --src_path="/etc/default/shellinabox"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/etc/shellinabox"
ynh_backup --src_path="/etc/default/shellinabox"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -31,13 +31,14 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
@ -68,30 +69,30 @@ fi
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping shellinabox..." --weight=1
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=shellinabox --action=stop
ynh_systemd_action --service_name=$app --action="stop"
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating nginx web server configuration..." --weight=2
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
# 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
# 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
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for nginx
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
@ -106,9 +107,9 @@ fi
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting shellinabox..." --weight=2
ynh_script_progression --message="Starting a systemd service..." --weight=2
ynh_systemd_action --service_name=shellinabox --action=start
ynh_systemd_action --service_name=$app --action="start"
#=================================================
# RELOAD NGINX

View file

@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -48,14 +51,14 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=2
# Find a free port
# Find an available port
port=$(ynh_find_port --port=4200)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL SHELLINABOX
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing shellinabox..." --weight=7
ynh_script_progression --message="Installing dependencies..." --weight=7
ynh_package_update
ynh_install_app_dependencies $pkg_dependencies
@ -65,33 +68,44 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# CONFIGURE SHELLINABOX
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring shellinabox..." --weight=2
ynh_script_progression --message="Adding a configuration file..." --weight=2
ynh_add_config --template="../conf/shellinabox" --destination="/etc/default/shellinabox"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..."
# Allow the service to log in syslog
ynh_replace_string --match_string=" -- -q --background" --replace_string=" -- --background" --target_file="/etc/init.d/shellinabox"
systemctl daemon-reload
ynh_systemd_action --service_name=shellinabox --action=restart
#=================================================
# GENERIC FINALIZATION
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Web based AJAX terminal emulator"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=shellinabox --action=restart
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -22,31 +22,32 @@ port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status $app >/dev/null 2>&1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service..."
ynh_script_progression --message="Removing $app service integration..."
yunohost service remove $app
fi
#=================================================
# REMOVE SHELLINABOX
#=================================================
ynh_script_progression --message="Removing shellinabox..." --weight=20
ynh_package_autopurge shellinabox
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated nginx config
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_package_autopurge shellinabox
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -6,6 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -13,6 +14,9 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -28,44 +32,55 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# STANDARD RESTORATION STEPS
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_package_update
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# INSTALL SHELLINABOX
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Installing shellinabox..." --weight=7
ynh_package_update
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=3
ynh_script_progression --message="Restoring various files..." --weight=3
ynh_restore_file --origin_path="/etc/shellinabox"
ynh_restore_file --origin_path="/etc/default/shellinabox"
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..."
# Allow the service to log in syslog
ynh_replace_string --match_string=" -- -q --background" --replace_string=" -- --background" --target_file="/etc/init.d/shellinabox"
systemctl daemon-reload
ynh_systemd_action --service_name=shellinabox --action=restart
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Web based AJAX terminal emulator"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=shellinabox --action=restart
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -20,6 +20,37 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -31,30 +62,6 @@ if [ -z "$port" ]; then
ynh_app_setting_set --app=$app --key=port --value=$port
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5
# 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
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
@ -63,24 +70,44 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CONFIGURE SHELLINABOX
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading shellinabox configuration..." --weight=4
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=4
ynh_add_config --template="../conf/shellinabox" --destination="/etc/default/shellinabox"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..."
ynh_replace_string --match_string=" -- -q --background" --replace_string=" -- --background" --target_file="/etc/init.d/shellinabox"
systemctl daemon-reload
ynh_systemd_action --service_name=shellinabox --action=restart
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Web based AJAX terminal emulator"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=shellinabox --action=restart
#=================================================
# RELOAD NGINX
#=================================================