#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= email=$(ynh_user_get_info --username="$admin" --key=mail) #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= ynh_script_progression --message="Validating installation parameters..." if [[ ${#admin} -lt 5 ]]; then ynh_die --message="Admin username minimum length is 5" fi #================================================= # INSTALL DEPENDENCIES #================================================= chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated NGINX config ynh_add_nginx_config systemctl enable "$app.service" --quiet yunohost service add "$app" --description="Web-based Game Server Management System" --log="/var/log/$app/$app.log" #================================================= # SPECIFIC SETUP #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." ynh_add_config --template="config.json" --destination="/etc/$app/config.json" chmod 650 "/etc/$app/config.json" chown "$app:$app" "/etc/$app/config.json" pufferpanel user add --admin --email="$email" --name="$admin" --password="$password" #================================================= # GENERIC FINALIZATION #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Listening for" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Installation of $app completed"