mirror of
https://github.com/YunoHost-Apps/httpsh_ynh.git
synced 2024-09-03 19:25:55 +02:00
55 lines
1.9 KiB
Bash
Executable file
55 lines
1.9 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
|
|
|
ynh_setup_source --source_id=httpsh --dest_dir="$install_dir/httpsh"
|
|
|
|
# TODO: copy files where needed
|
|
mv "$install_dir/httpsh/usr/local/bin/ttyd-login" "$install_dir/httpsh"
|
|
|
|
ynh_add_config --template="ttyd_httphs.conf" --destination="$install_dir/ttyd_httphs.conf"
|
|
|
|
chown -R "$app:$app" "$install_dir"
|
|
|
|
#=================================================
|
|
# SYSTEM CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
|
|
|
ynh_add_nginx_config
|
|
|
|
ynh_add_systemd_config
|
|
|
|
yunohost service add "$app" --description="httpsh on ttyd web terminal" --log="/var/log/$app/$app.log"
|
|
|
|
ynh_use_logrotate
|
|
|
|
ynh_add_fail2ban_config --logpath="/var/log/$app/$app.log" --failregex="^error: maximum authentication attempts exceeded for <F-USER>.*</F-USER> from <HOST>$"
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
ynh_script_progression --message="Installation of $app completed" --last
|