1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/shellinabox_ynh.git synced 2024-09-03 20:26:12 +02:00
shellinabox_ynh/scripts/install

100 lines
2.8 KiB
Text
Raw Normal View History

2015-05-08 12:03:12 +02:00
#!/bin/bash
2017-08-28 16:34:15 +02:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2017-04-20 19:34:26 +02:00
2017-08-28 16:34:15 +02:00
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
2015-05-08 12:03:12 +02:00
2017-04-20 19:34:26 +02:00
domain=$YNH_APP_ARG_DOMAIN
2017-08-28 16:34:15 +02:00
path_url=$YNH_APP_ARG_PATH
2017-04-20 19:34:26 +02:00
app=$YNH_APP_INSTANCE_NAME
2015-05-08 12:03:12 +02:00
2017-08-28 16:34:15 +02:00
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
# 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_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
# Find a free port
port=$(ynh_find_port 4200)
ynh_app_setting_set $app port $port
#=================================================
# INSTALL SHELLINABOX
#=================================================
ynh_package_update
ynh_package_install shellinabox
#=================================================
# NGINX CONFIGURATION
#=================================================
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# CONFIGURE SHELLINABOX
#=================================================
cp ../conf/shellinabox /etc/default/shellinabox
ynh_replace_string "__PORT__" "$port" "/etc/default/shellinabox"
systemctl restart shellinabox
2015-05-08 12:03:12 +02:00
2017-08-28 16:34:15 +02:00
#=================================================
# STORE THE CHECKSUM OF THE CONFIG FILE
#=================================================
2015-05-08 12:03:12 +02:00
2017-08-28 16:34:15 +02:00
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "/etc/default/shellinabox"
2015-05-08 12:03:12 +02:00
2017-08-28 16:34:15 +02:00
#=================================================
# GENERIC FINALIZATION
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
2015-05-08 12:03:12 +02:00
2017-08-28 16:34:15 +02:00
yunohost service add $app
2015-05-08 12:03:12 +02:00
2017-08-28 16:34:15 +02:00
#=================================================
# RELOAD NGINX
#=================================================
2015-05-08 12:03:12 +02:00
2017-08-28 16:34:15 +02:00
systemctl reload nginx