1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/photoview_ynh.git synced 2024-09-03 20:05:55 +02:00
photoview_ynh/scripts/install

86 lines
2.8 KiB
Bash
Executable file
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INSTALL GO
#=================================================
ynh_script_progression --message="Installing Go..." --weight=10
ynh_install_go --go_version="$go_version"
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Installing NodeJS..." --weight=10
ynh_install_nodejs --nodejs_version="$node_version"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=10
ynh_setup_source --dest_dir="$install_dir/sources"
ynh_setup_source --source_id=libheif --dest_dir="$install_dir/libheif"
mkdir -p "$install_dir/output/"{data,ui}
chown -R "$app:$app" "$install_dir"
chown -R "$app:$app" "$data_dir"
#=================================================
# BUILD APP
#=================================================
ynh_script_progression --message="Compiling libheif..." --weight=10
build_libheif
ynh_script_progression --message="Compiling Go API..." --weight=10
build_api
ynh_script_progression --message="Building static UI files..." --weight=10
build_ui
cleanup_sources
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding $app's configuration file..."
ynh_add_config --template=".env" --destination="$install_dir/output/.env"
chown "$app:$app" "$install_dir/output/.env"
#=================================================
# 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="Photoview photo manager API" --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
# 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