mirror of
https://github.com/YunoHost-Apps/psitransfer_ynh.git
synced 2024-09-03 20:16:06 +02:00
Update install
This commit is contained in:
parent
a741ff90be
commit
1a2645045e
1 changed files with 30 additions and 25 deletions
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -10,10 +10,11 @@ source _common.sh
|
|||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE FAILURE OF THE SCRIPT
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
|
@ -27,20 +28,19 @@ admin_pass=$YNH_APP_ARG_PASSWORD
|
|||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
|
||||
if sudo yunohost domain list | grep -q $domain # Vérifie la liste des domaines
|
||||
then # Si le domaine existe dans Yunohost
|
||||
if sudo yunohost app map | grep -q $domain # Vérifie la liste des apps par domaine
|
||||
then # Si une app est installée sur ce domaine.
|
||||
WARNING echo "An app is already installed on the domain $domain. cryptpad needs a whole domain or subdomain to himself."
|
||||
fi
|
||||
fi
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||
|
||||
path_url=$(ynh_normalize_url_path $path_url) # Check and normalize path
|
||||
CHECK_DOMAINPATH # Vérifie la disponibilité du path et du domaine.
|
||||
CHECK_FINALPATH # Vérifie que le dossier de destination n'est pas déjà utilisé.
|
||||
# Normalize the url path syntax
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
# Check web path availability
|
||||
ynh_webpath_available $domain $path_url
|
||||
# Register (book) web path
|
||||
ynh_webpath_register $app $domain $path_url
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
|
@ -56,7 +56,10 @@ ynh_app_setting_set $app path_url "$path_url"
|
|||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
|
||||
# Find a port
|
||||
port=$(ynh_find_port 8900) # Cherche un port libre.
|
||||
# Open this port
|
||||
yunohost firewall allow --no-upnp TCP $port 2>&1
|
||||
ynh_app_setting_set $app port $port
|
||||
|
||||
#=================================================
|
||||
|
@ -65,12 +68,6 @@ ynh_app_setting_set $app port $port
|
|||
|
||||
ynh_install_nodejs $NODEJS_VERSION
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
|
@ -89,19 +86,27 @@ ynh_use_logrotate
|
|||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
final_path=/var/www/$app
|
||||
ynh_app_setting_set $app final_path $final_path
|
||||
ynh_setup_source $final_path
|
||||
ynh_setup_source "$final_path"
|
||||
|
||||
# Set files ownership during installation
|
||||
sudo chown $app: $final_path -R
|
||||
sudo chmod 755 $final_path -R
|
||||
|
||||
|
||||
#=================================================
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_nginx_config
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# ADD SYSTEMD SERVICE
|
||||
|
@ -131,7 +136,7 @@ popd
|
|||
sudo mv "../conf/config.js" "$final_path/config.production.js"
|
||||
|
||||
# Set service port
|
||||
ynh_replace_string "__ADMINPASS__" "admin_pass" "$final_path/config.production.js"
|
||||
ynh_replace_string "__ADMINPASS__" "$admin_pass" "$final_path/config.production.js"
|
||||
|
||||
# Store file checksum to detected user modifications on upgrade
|
||||
ynh_store_file_checksum "$final_path/config.production.js"
|
||||
|
|
Loading…
Add table
Reference in a new issue