1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/libreto_ynh.git synced 2024-09-03 19:36:14 +02:00
libreto_ynh/scripts/install

67 lines
2.3 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INITIALIZE AND STORE SETTINGS
#=================================================
# FIXME: subdir install does not seem to be supported anymore.
path="/"
ynh_app_setting_set --app="$app" --key=path --value="$path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=4
# Note: We use git instead of ynh_setup_source, cause this repo use submodules
ynh_exec_as "$app" git clone https://github.com/zamentur/libreto.git "$install_dir/libreto" --quiet
ynh_exec_as "$app" git -C "$install_dir/libreto" checkout "$COMMIT" --quiet
ynh_exec_as "$app" git -C "$install_dir/libreto" submodule update --init --recursive --quiet
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# SPECIFIC SETUP
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
provider="__PROVIDER__"
default_provider="framapad"
commented_provider="// CUSTOM_PROVIDER"
if [ "$etherpad_instance" != "https://annuel2.framapad.org" ]; then
provider="${domain%%.*}"
default_provider="$provider"
commented_provider=""
fi
ynh_add_config --template="config.dist.php" --destination="$install_dir/libreto/config.php"
chown "$app:www-data" "$install_dir/libreto/config.php"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last