#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source ynh_install_go source /usr/share/yunohost/helpers #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= # SPECIFIC SETUP #================================================= # BUILDING SOURCES AND SETTING UP THE SERVER #================================================= ynh_script_progression --message="Building the sources (it will take some time)..." --weight=6 ynh_exec_warn_less ynh_install_go --go_version=$GO_VERSION pushd "$install_dir" # Setup go exe and environnement ynh_use_go export GOPATH="$install_dir/go" export GOCACHE="$install_dir/go/.cache" # Build server from source make build 2>&1 ynh_secure_remove --file="$install_dir/go" popd ynh_remove_go # Setup a nice YunoHost logo cp ../sources/logo_dark.png "$install_dir/web/themes/dark/logo.png" cp ../sources/logo_light.png "$install_dir/web/themes/light/logo.png" #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="config.yaml" --destination="$install_dir/config.yaml" chmod 400 "$install_dir/config.yaml" chown "$app:$app" "$install_dir/config.yaml" #================================================= # SETUP SYSTEMD #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config ynh_add_systemd_config yunohost service add "$app" --description="OpenID Connect Provider" --log="/var/log/$app/$app.log" # Use logrotate to manage application logfile(s) ynh_use_logrotate #================================================= # 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="/var/log/$app/$app.log" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Installation of $app completed" --last