1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/torrelay_ynh.git synced 2024-09-03 20:26:36 +02:00
torrelay_ynh/scripts/install
Éric Gaspar a0ed189900 v2
2023-04-21 15:58:52 +02:00

48 lines
1.7 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_app_setting_set --app=$app --key=contact --value=$contact
ynh_app_setting_set --app=$app --key=nickname --value=$nickname
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="../conf/torrc" --destination="/etc/tor/torrc"
chmod 660 /etc/tor/torrc
chown :debian-tor /etc/tor/torrc
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
yunohost service add tor --description="Tor Relay" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_or" --test_status="pgrep tor"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=3
# Start a systemd service
ynh_systemd_action --service_name=tor --action="restart" --log_path="systemd"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last