#!/bin/bash #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # INITIALIZE AND STORE SETTINGS #================================================= # Testing if ZeroTier is installed if ! yunohost app list | grep -q "id: zerotier"; then ynh_die "ZeroTier is needed, but it is not installed. There is a package for that!" fi # Let's retrieve information on the ZeroTier installation zt_token="$( "$install_dir/src/etc/passwd" #================================================= # LINK CERTIFICATES #================================================= # Even though one can stay in HTTP mode, the ztncui requires SSL certificates # let's use the ones of the domain cp "/etc/yunohost/certs/$domain/key.pem" "$install_dir/src/etc/tls/privkey.pem" cp "/etc/yunohost/certs/$domain/crt.pem" "$install_dir/src/etc/tls/fullchain.pem" #================================================= # SYSTEM CONFIGURATION #================================================= ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config # Create a dedicated systemd config ynh_add_systemd_config yunohost service add "$app" --description "ZeroTier network controller user interface" --log "/var/log/$app/$app.log" # Use logrotate to manage application logfile(s) ynh_use_logrotate #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting $app's 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