1
0
Fork 0
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:
frju365 2018-04-16 10:48:18 +02:00 committed by GitHub
parent a741ff90be
commit 1a2645045e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# GENERIC STARTING # GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
@ -10,10 +10,11 @@ source _common.sh
source /usr/share/yunohost/helpers 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 # RETRIEVE ARGUMENTS FROM THE MANIFEST
@ -27,20 +28,19 @@ admin_pass=$YNH_APP_ARG_PASSWORD
app=$YNH_APP_INSTANCE_NAME 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 final_path=/var/www/$app
then # Si le domaine existe dans Yunohost test ! -e "$final_path" || ynh_die "This path already contains a folder"
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
path_url=$(ynh_normalize_url_path $path_url) # Check and normalize path # Normalize the url path syntax
CHECK_DOMAINPATH # Vérifie la disponibilité du path et du domaine. path_url=$(ynh_normalize_url_path $path_url)
CHECK_FINALPATH # Vérifie que le dossier de destination n'est pas déjà utilisé.
# 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 # STORE SETTINGS FROM MANIFEST
@ -56,7 +56,10 @@ ynh_app_setting_set $app path_url "$path_url"
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
# Find a port
port=$(ynh_find_port 8900) # Cherche un port libre. 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 ynh_app_setting_set $app port $port
#================================================= #=================================================
@ -65,12 +68,6 @@ ynh_app_setting_set $app port $port
ynh_install_nodejs $NODEJS_VERSION ynh_install_nodejs $NODEJS_VERSION
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_system_user_create $app
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
@ -89,19 +86,27 @@ ynh_use_logrotate
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
final_path=/var/www/$app
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set $app final_path $final_path
ynh_setup_source $final_path ynh_setup_source "$final_path"
# Set files ownership during installation # Set files ownership during installation
sudo chown $app: $final_path -R sudo chown $app: $final_path -R
sudo chmod 755 $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 # ADD SYSTEMD SERVICE
@ -131,7 +136,7 @@ popd
sudo mv "../conf/config.js" "$final_path/config.production.js" sudo mv "../conf/config.js" "$final_path/config.production.js"
# Set service port # 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 # Store file checksum to detected user modifications on upgrade
ynh_store_file_checksum "$final_path/config.production.js" ynh_store_file_checksum "$final_path/config.production.js"