1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yourls_ynh.git synced 2024-09-03 20:35:59 +02:00
yourls_ynh/scripts/install
Éric Gaspar 4bded60719 Fix
2023-03-05 12:59:42 +01:00

82 lines
2.7 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
password="$YNH_APP_ARG_PASSWORD"
random=$(ynh_string_random --length=24)
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=random --value=$random
ynh_app_setting_set --app=$app --key=password --value="$password"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=4
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
# Install French language
ynh_setup_source --dest_dir="$install_dir/user/languages" --source_id="fr"
# copy index file
cp ../conf/index.php $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..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=$low --footprint=$low
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="../conf/config-sample.php" --destination="$install_dir/user/config.php"
chmod 600 "$install_dir/user/config.php"
chown $app:$app "$install_dir/user/config.php"
#=================================================
# SETUP APPLICATION WITH CURL
#=================================================
# Installation with curl
ynh_script_progression --message="Finalizing installation..." --weight=1
ynh_local_curl "admin/install.php" "install=dummy"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last