commit 5ac6e408b6434f63a8e6565f5ce67b939c044193 Author: kload Date: Fri May 8 12:03:12 2015 +0200 Init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/README.md b/README.md new file mode 100644 index 0000000..2a7b1d3 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Shell In A Box for YunoHost + +https://code.google.com/p/shellinabox/ diff --git a/conf/nginx.conf b/conf/nginx.conf new file mode 100644 index 0000000..21212b2 --- /dev/null +++ b/conf/nginx.conf @@ -0,0 +1,10 @@ +location PATHTOCHANGE { + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } + proxy_pass http://127.0.0.1:4200/; + proxy_set_header Host $host; + proxy_buffering off; + tcp_nodelay on; + access_log off; +} diff --git a/conf/shellinabox b/conf/shellinabox new file mode 100644 index 0000000..bb4ee0a --- /dev/null +++ b/conf/shellinabox @@ -0,0 +1,19 @@ +hould shellinaboxd start automatically +SHELLINABOX_DAEMON_START=1 + +# TCP port that shellinboxd's webserver listens on +SHELLINABOX_PORT=4200 + +# Parameters that are managed by the system and usually should not need +# changing: +# SHELLINABOX_DATADIR=/var/lib/shellinabox +# SHELLINABOX_USER=shellinabox +# SHELLINABOX_GROUP=shellinabox + +# Any optional arguments (e.g. extra service definitions). Make sure +# that that argument is quoted. +# +# Beeps are disabled because of reports of the VLC plugin crashing +# Firefox on Linux/x86_64. +SHELLINABOX_ARGS="--no-beep --localhost-only" + diff --git a/scripts/install b/scripts/install new file mode 100644 index 0000000..11d6955 --- /dev/null +++ b/scripts/install @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e + +# Retrieve arguments +domain=$1 +path=$2 + +# Check domain/path availability +sudo yunohost app checkurl $domain$path -a shellinabox + +# Check port availability +sudo yunohost app checkport 4200 + +# Remove trailing "/" for next commands +if [[ ! "$path" == "/" ]]; then + path=${path%/} +fi + +sudo apt-get update -qq +sudo apt-get install shellinabox -y -qq + +sudo yunohost service add shellinabox + +# Copy shellinabox default configuration and restart +sudo cp ../conf/shellinabox /etc/default/shellinabox +sudo service shellinabox restart + +# Configure Nginx and reload +sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf +sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/shellinabox.conf +sudo service nginx reload + +sudo yunohost app ssowatconf diff --git a/scripts/remove b/scripts/remove new file mode 100644 index 0000000..66d00a6 --- /dev/null +++ b/scripts/remove @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +# Retrieve arguments +domain=$(sudo yunohost app setting shellinabox domain) +path=$(sudo yunohost app setting shellinabox path) + +# Stop and remove shellinabox +sudo service shellinabox stop || echo "ShellInABox already stopped" +sudo apt-get remove --purge shellinabox || echo "ShellInABox already uninstalled" + +# Remove Nginx proxy configuration +sudo rm -f sudo rm /etc/nginx/conf.d/$domain.d/shellinabox.conf + +sudo service nginx reload + +sudo yunohost app ssowatconf diff --git a/scripts/upgrade b/scripts/upgrade new file mode 100644 index 0000000..edde8f9 --- /dev/null +++ b/scripts/upgrade @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +# Retrieve arguments +domain=$(sudo yunohost app setting shellinabox domain) +path=$(sudo yunohost app setting shellinabox path) + +# Remove trailing "/" for next commands +if [[ ! "$path" == "/" ]]; then + path=${path%/} +fi + +sudo apt-get update -qq +sudo apt-get install shellinabox -y -qq + +# Copy shellinabox default configuration and restart +sudo cp ../conf/shellinabox /etc/default/shellinabox +sudo service shellinabox restart + +# Configure Nginx and reload +sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf +sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/shellinabox.conf +sudo service nginx reload