2015-05-08 12:03:12 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Retrieve arguments
|
|
|
|
domain=$1
|
|
|
|
path=$2
|
|
|
|
|
|
|
|
# Check domain/path availability
|
2016-05-04 14:17:07 +02:00
|
|
|
sudo yunohost app checkurl $domain$path -a shellinabox \
|
|
|
|
|| (echo "Path not available: $domain$path" && exit 1)
|
2015-05-08 12:03:12 +02:00
|
|
|
|
|
|
|
# Check port availability
|
2016-05-04 14:17:07 +02:00
|
|
|
sudo yunohost app checkport 4200 \
|
|
|
|
|| (echo "Port not available: 4200" && exit 1)
|
2015-05-08 12:03:12 +02:00
|
|
|
|
|
|
|
# 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
|