#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # CHECK IF THE APP CAN BE INSTALLED #================================================= # Testing if ZeroTier is installed yunohost app list | grep -q "id: zerotier" || ynh_die "ZeroTier is needed, but it is not installed. There is a package for that!" #================================================= # INSTALL DEPENDENCIES #================================================= ynh_script_progression --message="Installing dependencies..." --weight=2 # Prevent ERR_OSSL_EVP_UNSUPPORTED error export NODE_OPTIONS=--openssl-legacy-provider # Prevent yet another Node and Corepack madness export COREPACK_ENABLE_DOWNLOAD_PROMPT=0 ynh_install_nodejs --nodejs_version=$nodejs_version ynh_use_nodejs $nodejs_path/corepack enable $nodejs_path/corepack prepare yarn@stable --activate #================================================= # 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 --dest_dir="$install_dir" ynh_script_progression --message="Building the backend..." --weight=3 pushd $install_dir/backend $nodejs_path/yarn install popd ynh_script_progression --message="Building the frontend..." --weight=3 pushd $install_dir/frontend $nodejs_path/yarn install $nodejs_path/yarn build popd chown -R $app:$app "$install_dir" chown $app:www-data "$install_dir" chown $app:www-data "$install_dir/frontend" chown -R $app:www-data "$install_dir/frontend/public" #================================================= # 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="ZeroTier Controller Web UI" #================================================= # APP INITIAL CONFIGURATION #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 # Let's retrieve information on the ZeroTier installation zt_token="$(