mirror of
https://github.com/YunoHost-Apps/shellinabox_ynh.git
synced 2024-09-03 20:26:12 +02:00
Update app
This commit is contained in:
parent
658c0ab5db
commit
51626441a8
7 changed files with 99 additions and 41 deletions
12
README.md
12
README.md
|
@ -1,3 +1,13 @@
|
||||||
# Shell In A Box for YunoHost
|
# Shell In A Box for YunoHost
|
||||||
|
|
||||||
https://code.google.com/p/shellinabox/
|
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:
|
||||||
|
|
||||||
|
Source: [code.google.com/shellinabox/](https://code.google.com/p/shellinabox/)
|
||||||
|
|
||||||
|
### Install
|
||||||
|
|
||||||
|
`$ sudo yunohost app install https://github.com/YunoHost-Apps/shellinabox_ynh.git`
|
||||||
|
|
||||||
|
### Update
|
||||||
|
|
||||||
|
`$ sudo yunohost app upgrade --verbose spip -u https://github.com/YunoHost-Apps/shellinabox_ynh.git`
|
|
@ -2,6 +2,8 @@
|
||||||
"name": "Shell In A Box",
|
"name": "Shell In A Box",
|
||||||
"id": "shellinabox",
|
"id": "shellinabox",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
|
"version": "1.1.0",
|
||||||
|
"license": "free",
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">> 2.3.15"
|
"yunohost": ">> 2.3.15"
|
||||||
},
|
},
|
||||||
|
@ -14,7 +16,7 @@
|
||||||
"name": "kload",
|
"name": "kload",
|
||||||
"email": "kload@kload.fr"
|
"email": "kload@kload.fr"
|
||||||
},
|
},
|
||||||
"multi_instance": "false",
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx",
|
||||||
"shellinabox"
|
"shellinabox"
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
# Exit on command errors and treat unset variables as an error
|
||||||
set -e
|
set -eu
|
||||||
|
|
||||||
# Source YNH helpers
|
# Source YNH helpers
|
||||||
. /usr/share/yunohost/helpers
|
. /usr/share/yunohost/helpers
|
||||||
|
|
||||||
app=${!#}
|
# Get multi-instances specific variables
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(sudo yunohost app setting $app domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
|
|
||||||
# Backup directory location for the app from where the script is executed and
|
# Backup directory location for the app from where the script is executed and
|
||||||
# which will be compressed afterward
|
# which will be compressed afterward
|
||||||
|
@ -16,4 +17,5 @@ backup_dir=$YNH_APP_BACKUP_DIR
|
||||||
|
|
||||||
# Copy the conf files
|
# Copy the conf files
|
||||||
sudo mkdir -p ./conf
|
sudo mkdir -p ./conf
|
||||||
|
ynh_backup "/etc/default/${app}" "./conf/default_${app}"
|
||||||
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" ./conf/nginx.conf
|
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" ./conf/nginx.conf
|
|
@ -1,18 +1,23 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
# Exit on command errors and treat unset variables as an error
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
source /usr/share/yunohost/helpers # Source app helpers
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$1
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path=$2
|
path=$YNH_APP_ARG_PATH
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a shellinabox \
|
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
||||||
|| (echo "Path not available: $domain$path" && exit 1)
|
|| ynh_die "Path not available: ${domain}${path}"
|
||||||
|
|
||||||
# Check port availability
|
# Check port availability
|
||||||
sudo yunohost app checkport 4200 \
|
sudo yunohost app checkport 4200 \
|
||||||
|| (echo "Port not available: 4200" && exit 1)
|
|| ynh_die "Port not available: 4200"
|
||||||
|
|
||||||
# Remove trailing "/" for next commands
|
# Remove trailing "/" for next commands
|
||||||
if [[ ! "$path" == "/" ]]; then
|
if [[ ! "$path" == "/" ]]; then
|
||||||
|
@ -22,6 +27,7 @@ fi
|
||||||
sudo apt-get update -qq
|
sudo apt-get update -qq
|
||||||
sudo apt-get install shellinabox -y -qq
|
sudo apt-get install shellinabox -y -qq
|
||||||
|
|
||||||
|
# Add service into YunoHost
|
||||||
sudo yunohost service add shellinabox
|
sudo yunohost service add shellinabox
|
||||||
|
|
||||||
# Copy shellinabox default configuration and restart
|
# Copy shellinabox default configuration and restart
|
||||||
|
@ -31,4 +37,4 @@ sudo service shellinabox restart
|
||||||
# Configure Nginx and reload
|
# Configure Nginx and reload
|
||||||
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/shellinabox.conf
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/shellinabox.conf
|
||||||
sudo service nginx reload
|
sudo systemctl reload nginx
|
||||||
|
|
|
@ -1,23 +1,29 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
# Exit on command errors and treat unset variables as an error
|
||||||
|
set -u
|
||||||
|
|
||||||
|
# Source app helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Get multi-instances specific variables
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$(sudo yunohost app setting shellinabox domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
path=$(sudo yunohost app setting shellinabox path)
|
path=$(ynh_app_setting_get "$app" path)
|
||||||
|
|
||||||
# Stop and remove shellinabox
|
# Stop and remove shellinabox
|
||||||
sudo service shellinabox stop || echo "ShellInABox already stopped"
|
sudo systemctl stop shellinabox || echo "ShellInABox already stopped"
|
||||||
sudo apt-get remove --purge -y -qq shellinabox || echo "ShellInABox already uninstalled"
|
sudo apt-get remove --purge -y -qq shellinabox || echo "ShellInABox already uninstalled"
|
||||||
|
|
||||||
# Remove Shell In A Box configuration
|
|
||||||
sudo rm -f /etc/default/shellinabox
|
|
||||||
|
|
||||||
# Remove service
|
# Remove service
|
||||||
sudo yunohost service remove shellinabox
|
sudo yunohost service remove shellinabox
|
||||||
|
|
||||||
|
# Remove Shell In A Box configuration
|
||||||
|
sudo rm -f "/etc/default/${app}"
|
||||||
# Remove Nginx proxy configuration
|
# Remove Nginx proxy configuration
|
||||||
sudo rm -f /etc/nginx/conf.d/$domain.d/shellinabox.conf
|
[[ -n $domain ]] && sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||||
|
|
||||||
# Restart nginx
|
# Restart nginx
|
||||||
sudo service nginx reload
|
sudo systemctl reload nginx
|
||||||
|
|
|
@ -1,34 +1,59 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
||||||
set -e
|
set -eu
|
||||||
|
|
||||||
|
# Source app helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Get multi-instances specific variables
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
app=${!#}
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
|
path=$(ynh_app_setting_get "$app" path)
|
||||||
domain=$(sudo yunohost app setting $app domain)
|
|
||||||
path=$(sudo yunohost app setting $app path)
|
|
||||||
|
|
||||||
# Remove trailing slash to path
|
# Remove trailing slash to path
|
||||||
path=${path%/}
|
path=${path%/}
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a $app \
|
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
||||||
|| (echo "Path not available: $domain$path" && exit 1)
|
|| ynh_die "Path not available: ${domain}${path}"
|
||||||
|
|
||||||
# Check port availability
|
# Check port availability
|
||||||
sudo yunohost app checkport 4200 \
|
sudo yunohost app checkport 4200 \
|
||||||
|| (echo "Port not available: 4200" && exit 1)
|
|| ynh_die "Port not available: 4200"
|
||||||
|
|
||||||
# Check configuration files
|
# Check configuration files
|
||||||
NGINX_CONF="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||||
[[ -f $NGINX_CONF ]] && die \
|
if [ -f $nginx_conf ]; then
|
||||||
"The NGINX configuration already exists at '${NGINX_CONF}'.
|
ynh_die "The NGINX configuration already exists at '${nginx_conf}'.
|
||||||
You should safely delete it before restoring this app."
|
You should safely delete it before restoring this app."
|
||||||
|
fi
|
||||||
|
shellinabox_conf="/etc/default/${app}"
|
||||||
|
if [ -f $shellinabox_conf ]; then
|
||||||
|
ynh_die "The shellinabox configuration already exists at '${shellinabox_conf}'.
|
||||||
|
You should safely delete it before restoring this app."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if shellainbox is installed
|
||||||
|
shellinabox_bin="/usr/bin/shellinaboxd"
|
||||||
|
if [ -f $shellinabox_bin ]; then
|
||||||
|
ynh_die "Good! The shellinabox is installed"
|
||||||
|
else
|
||||||
|
sudo apt-get update -qq
|
||||||
|
sudo apt-get install shellinabox -y -qq
|
||||||
|
|
||||||
|
sudo cp -a "./conf/default_${app}" "${shellinabox_conf}"
|
||||||
|
|
||||||
|
# Add service into YunoHost
|
||||||
|
sudo yunohost service add shellinabox
|
||||||
|
sudo service shellinabox restart
|
||||||
|
fi
|
||||||
|
|
||||||
# Restore configuration files
|
# Restore configuration files
|
||||||
sudo cp -a ./conf/nginx.conf "$NGINX_CONF"
|
sudo cp -a ./conf/nginx.conf "${nginx_conf}"
|
||||||
|
|
||||||
# Reload Nginx and regenerate SSOwat conf
|
# Reload service
|
||||||
sudo service nginx reload
|
sudo systemctl reload nginx
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
# Exit on command errors and treat unset variables as an error
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Source app helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Get multi-instances specific variables
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$(sudo yunohost app setting shellinabox domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
path=$(sudo yunohost app setting shellinabox path)
|
path=$(ynh_app_setting_get "$app" path)
|
||||||
|
|
||||||
# Remove trailing "/" for next commands
|
# Remove trailing "/" for next commands
|
||||||
if [[ ! "$path" == "/" ]]; then
|
if [[ ! "$path" == "/" ]]; then
|
||||||
|
@ -21,4 +28,4 @@ sudo service shellinabox restart
|
||||||
# Configure Nginx and reload
|
# Configure Nginx and reload
|
||||||
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/shellinabox.conf
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/shellinabox.conf
|
||||||
sudo service nginx reload
|
sudo systemctl reload nginx
|
||||||
|
|
Loading…
Add table
Reference in a new issue