1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/monica_ynh.git synced 2024-09-03 19:46:23 +02:00

Apply last example_ynh

This commit is contained in:
yalh76 2021-05-22 12:42:26 +02:00
parent c1a0356a00
commit a4992b9302
11 changed files with 131 additions and 249 deletions

View file

@ -1,13 +1,8 @@
# See here for more informations
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
path="/" (PATH)
admin="john" (USER)
domain="domain.tld"
path="/path"
admin="john"
is_public=1 (PUBLIC|public=1|private=0)
language="fr"
dav_support=1 (DAV_SUPPORT|dav_support=1|dav_support=0)
@ -33,9 +28,6 @@
# incorrect_path=1
port_already_use=0
change_url=0
;;; Levels
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 5=auto
;;; Options
Email=anmol@datamol.org
Notification=change

View file

@ -14,7 +14,7 @@ APP_DEBUG=false
# this secure otherwise, everyone will be able to access your application.
# Must be 32 characters long exactly.
# Use `php artisan key:generate` or `pwgen -s 32 1` to generate a random key.
APP_KEY=random_key
APP_KEY=__RANDOM_KEY__
# Prevent information leakage by referring to IDs with hashIds instead of
# the actual IDs used in the database.
@ -36,9 +36,9 @@ DB_HOST=127.0.0.1
DB_PORT=3306
# You can use mysql unix socket if available, it overrides DB_HOST and DB_PORT values.
#DB_UNIX_SOCKET=/var/run/mysqld/mysqld.sock
DB_DATABASE=yunobase
DB_USERNAME=yunouser
DB_PASSWORD=yunopass
DB_DATABASE=__DB_NAME__
DB_USERNAME=__DB_USER__
DB_PASSWORD=__DB_PWD__
DB_PREFIX=
DB_TEST_HOST=127.0.0.1
DB_TEST_DATABASE=monica_test
@ -57,18 +57,18 @@ MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=
# Outgoing emails will be sent with these identity
MAIL_FROM_ADDRESS=monica@yunodomain
MAIL_FROM_ADDRESS=monica@__DOMAIN__
MAIL_FROM_NAME="Monica"
# New registration notification sent to this email
APP_EMAIL_NEW_USERS_NOTIFICATION=yunomail
APP_EMAIL_NEW_USERS_NOTIFICATION=__EMAIL__
# Default locale used in the application.
APP_DEFAULT_LOCALE=language
APP_DEFAULT_LOCALE=__LANGUAGE__
# Ability to disable signups on your instance.
# Can be true or false. Default to false.
APP_DISABLE_SIGNUP=__SIGNUP__
APP_DISABLE_SIGNUP=__SIGN_BOLEAN__
# Enable user email verification.
APP_SIGNUP_DOUBLE_OPTIN=false
@ -132,10 +132,10 @@ AWS_BUCKET=
AWS_SERVER=
# Allow Two Factor Authentication feature on your instance
MFA_ENABLED=__TWO_FACTOR__
MFA_ENABLED=__TWOF_BOOLEAN__
# Enable DAV support
DAV_ENABLED=__DAV__
DAV_ENABLED=__DAV_BOLEAN__
# CLIENT ID and SECRET used for OAuth authentication
PASSPORT_PERSONAL_ACCESS_CLIENT_ID=__IDENTITY__

View file

@ -14,12 +14,12 @@
"url": "http://github.com/rndmh3ro/monica_ynh"
},
"requirements": {
"yunohost": ">= 3.8.1"
"yunohost": ">= 4.1.3"
},
"multi_instance": true,
"services": [
"nginx",
"php7.0-fpm",
"php7.3-fpm",
"mysql"
],
"arguments": {
@ -27,38 +27,22 @@
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain name for Monica",
"fr": "Choisissez un nom de domaine pour Monica"
},
"example": "monicahq.com"
"example": "example.com"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for Monica",
"fr": "Choisissez un chemin pour Monica"
},
"example": "/monica",
"default": "/monica"
},
{
"name": "admin",
"type": "user",
"ask": {
"en": "Choose an admin user",
"fr": "Choisissez ladministrateur"
},
"example": "johndoe"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"default": true
},
{

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -56,7 +56,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# BACKUP A CRON FILE
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/etc/cron.d/$app"

View file

@ -36,7 +36,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
@ -46,7 +46,7 @@ ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# restore it if the upgrade fails
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
@ -80,8 +80,8 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
@ -92,11 +92,11 @@ fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================

View file

@ -7,11 +7,9 @@
#=================================================
source _common.sh
source ynh_composer__2
source send_readme_to_admin
source ynh_send_readme_to_admin
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
@ -57,7 +55,6 @@ ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=random_key --value=$random_key
ynh_app_setting_set --app=$app --key=dav_support --value=$dav_support
@ -74,6 +71,14 @@ ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
@ -96,6 +101,10 @@ pushd "$final_path"
git checkout tags/$version
popd
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -104,14 +113,6 @@ ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
@ -131,48 +132,42 @@ ynh_script_progression --message="Installing Composer dependencies..."
ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$final_path"
#=================================================
# MODIFY A CONFIG FILE
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Modifying a config file..."
ynh_script_progression --message="Adding a configuration file..."
config="$final_path/.env"
cp ../conf/.env "$config"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
ynh_replace_string --match_string="random_key" --replace_string="$random_key" --target_file="$config"
ynh_replace_string --match_string="yunouser" --replace_string="$db_name" --target_file="$config"
ynh_replace_string --match_string="yunopass" --replace_string="$db_pwd" --target_file="$config"
ynh_replace_string --match_string="yunobase" --replace_string="$db_name" --target_file="$config"
ynh_replace_string --match_string="yunomail" --replace_string="$email" --target_file="$config"
ynh_replace_string --match_string="yunodomain" --replace_string="$domain" --target_file="$config"
ynh_replace_string --match_string="language" --replace_string="$language" --target_file="$config"
# Enable or disable DAV support for users
if [ $dav_support -eq 0 ]
then
ynh_replace_string --match_string="__DAV__" --replace_string="false" --target_file="$config"
dav_boolean="false"
dav="Yes"
else
ynh_replace_string --match_string="__DAV__" --replace_string="true" --target_file="$config"
dav_boolean="true"
dav="No"
fi
# Enable or disable signup for public users
if [ $signup -eq 1 ]
then
ynh_replace_string --match_string="__SIGNUP__" --replace_string="false" --target_file="$config"
sign_boolean="false"
sign="No"
else
ynh_replace_string --match_string="__SIGNUP__" --replace_string="true" --target_file="$config"
sign_boolean="true"
sign="Yes"
fi
# Enable or disable two factor authentication support for users
if [ $two_factor -eq 1 ]
then
ynh_replace_string --match_string="__TWO_FACTOR__" --replace_string="true" --target_file="$config"
twof_boolean="true"
twof="Yes"
else
ynh_replace_string --match_string="__TWO_FACTOR__" --replace_string="false" --target_file="$config"
twof_boolean="false"
twof="No"
fi
ynh_replace_string --match_string="__TWO_FACTOR__" --replace_string="$twof_boolean" --target_file="$config"
ynh_add_config --template="../conf/.env" --destination="$config"
#=================================================
# DEPLOY
@ -204,6 +199,9 @@ ynh_script_progression --message="Storing the config file checksum..."
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config"
chmod 400 "$config"
chown $app:$app "$config"
#=================================================
# INSTALL THE CRON FILE
#=================================================
@ -214,19 +212,10 @@ mv -f /tmp/cron$app /etc/cron.d/$app
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files
chown -R $app: $final_path
chmod -R 775 "$final_path/storage"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..."
ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary
if [ $is_public -eq 1 ]
@ -237,9 +226,9 @@ then
fi
# Giver API permission to visitors
ynh_permission_create --permission="api" --url "/api" --allowed="visitors" --show_tile="false" --protected="true"
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true"
# Giver DAV permission to visitors
ynh_permission_create --permission="dav" --url "/dav" --allowed="visitors" --show_tile="false" --protected="true"
ynh_permission_create --permission="dav" --url="/dav" --allowed="visitors" --show_tile="false" --protected="true"
#=================================================
# RELOAD NGINX

View file

@ -66,9 +66,9 @@ ynh_remove_fpm_config
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE THE CRON FILE
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing the cron file..."
ynh_script_progression --message="Removing various files..."
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -23,7 +23,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -53,6 +53,14 @@ ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -60,27 +68,14 @@ ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# RESTORE USER RIGHTS
#=================================================
ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files
chown -R $app: $final_path
chmod -R 775 "$final_path/storage"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring PHP-FPM configuration..."
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
@ -107,9 +102,9 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# RESTORE THE CRON FILE
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring the cron file..."
ynh_script_progression --message="Restoring various files..."
ynh_restore_file --origin_path="/etc/cron.d/$app"

View file

@ -7,7 +7,6 @@
#=================================================
source _common.sh
source ynh_composer__2
source ynh_package_version
source /usr/share/yunohost/helpers
@ -21,7 +20,6 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
@ -33,7 +31,6 @@ signup=$(ynh_app_setting_get --app=$app --key=signup)
two_factor=$(ynh_app_setting_get --app=$app --key=two_factor)
version=$(curl -s https://api.github.com/repos/monicahq/monica/releases/latest | grep 'tag_name' | cut -d\" -f4)
#=================================================
# CHECK VERSION
#=================================================
@ -41,20 +38,27 @@ ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
@ -67,6 +71,19 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# Create a permission if needed
if ! ynh_permission_exists --permission="api"; then
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true"
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# CHECK VERSION NUMBER
#=================================================
@ -75,22 +92,6 @@ abort_if_up_to_date
# previous function is what defines 'version', more precisely the 'previous version'
previous_version="${version}"
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -100,7 +101,8 @@ then
ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; then
if git -C "$final_path" rev-parse --is-inside-work-tree` >/dev/null 2>/dev/null
then
pushd "$final_path"
git fetch
git checkout tags/$version
@ -112,6 +114,10 @@ then
fi
ynh_app_setting_set --app=$app --key=version --value=$version
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -127,14 +133,6 @@ ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
@ -151,54 +149,45 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
ynh_script_progression --message="Updating PHP dependencies..."
chown -R $app: "$final_path"
ynh_exec_warn_less ynh_composer_exec --phpversion="$phpversion" --workdir="$final_path" --commands="update"
#=================================================
# MODIFY A CONFIG FILE
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..."
ynh_script_progression --message="Updating a configuration file..."
config="$final_path/.env"
ynh_backup_if_checksum_is_different --file="$config"
cp ../conf/.env "$config"
ynh_replace_string --match_string="random_key" --replace_string="$random_key" --target_file="$config"
ynh_replace_string --match_string="yunouser" --replace_string="$db_name" --target_file="$config"
ynh_replace_string --match_string="yunopass" --replace_string="$db_pwd" --target_file="$config"
ynh_replace_string --match_string="yunobase" --replace_string="$db_name" --target_file="$config"
ynh_replace_string --match_string="yunomail" --replace_string="$email" --target_file="$config"
ynh_replace_string --match_string="yunodomain" --replace_string="$domain" --target_file="$config"
ynh_replace_string --match_string="language" --replace_string="$language" --target_file="$config"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
# Enable or disable DAV support for users
if [ $dav_support -eq 0 ]
then
ynh_replace_string --match_string="__DAV__" --replace_string="false" --target_file="$config"
dav_boolean="false"
dav="Yes"
else
ynh_replace_string --match_string="__DAV__" --replace_string="true" --target_file="$config"
dav_support=1
ynh_app_setting_set --app=$app --key=dav_support --value=$dav_support
dav_boolean="true"
dav="No"
fi
# Enable or disable signup for public users
if [ $signup -eq 1 ]
then
ynh_replace_string --match_string="__SIGNUP__" --replace_string="false" --target_file="$config"
sign_boolean="false"
sign="No"
else
ynh_replace_string --match_string="__SIGNUP__" --replace_string="true" --target_file="$config"
signup=0
ynh_app_setting_set --app=$app --key=signup --value=$signup
sign_boolean="true"
sign="Yes"
fi
# Enable or disable two factor authentication support for users
if [ $two_factor -eq 1 ]
then
ynh_replace_string --match_string="__TWO_FACTOR__" --replace_string="true" --target_file="$config"
twof_boolean="true"
twof="Yes"
else
ynh_replace_string --match_string="__TWO_FACTOR__" --replace_string="false" --target_file="$config"
two_factor=0
ynh_app_setting_set --app=$app --key=two_factor --value=$two_factor
twof_boolean="false"
twof="No"
fi
ynh_replace_string --match_string="__TWO_FACTOR__" --replace_string="$twof_boolean" --target_file="$config"
ynh_add_config --template="../conf/.env" --destination="$config"
#=================================================
# DEPLOYMENT
@ -255,16 +244,8 @@ ynh_script_progression --message="Storing the config file checksum..."
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions on app files
chown -R $app: $final_path
chmod -R 775 "$final_path/storage"
chmod 400 "$config"
chown $app:$app "$config"
#=================================================
# INSTALL THE CRON FILE
@ -274,6 +255,8 @@ ynh_script_progression --message="Installing the cron file..."
echo "* * * * * -u $app /usr/bin/php$phpversion $final_path/artisan schedule:run" > /tmp/cron$app
mv -f /tmp/cron$app /etc/cron.d/$app
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -1,61 +0,0 @@
#!/bin/bash
readonly YNH_DEFAULT_COMPOSER_VERSION=1.10.17
# Declare the actual composer version to use.
# A packager willing to use another version of composer can override the variable into its _common.sh.
YNH_COMPOSER_VERSION=${YNH_COMPOSER_VERSION:-$YNH_DEFAULT_COMPOSER_VERSION}
# Execute a command with Composer
#
# usage: ynh_composer_exec [--phpversion=phpversion] [--workdir=$final_path] --commands="commands"
# | arg: -v, --phpversion - PHP version to use with composer
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -c, --commands - Commands to execute.
ynh_composer_exec () {
# Declare an array to define the options of this helper.
local legacy_args=vwc
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [c]=commands= )
local phpversion
local workdir
local commands
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-$YNH_PHP_VERSION}"
COMPOSER_HOME="$workdir/.composer" \
php${phpversion} "$workdir/composer.phar" $commands \
-d "$workdir" --quiet --no-interaction
}
# Install and initialize Composer in the given directory
#
# usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"] [--composerversion=composerversion]
# | arg: -v, --phpversion - PHP version to use with composer
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -a, --install_args - Additional arguments provided to the composer install. Argument --no-dev already include
# | arg: -c, --composerversion - Composer version to install
ynh_install_composer () {
# Declare an array to define the options of this helper.
local legacy_args=vwa
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args= [c]=composerversion=)
local phpversion
local workdir
local install_args
local composerversion
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-$YNH_PHP_VERSION}"
install_args="${install_args:-}"
composerversion="${composerversion:-$YNH_COMPOSER_VERSION}"
curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \
php${phpversion} -- --quiet --install-dir="$workdir" --version=$composerversion \
|| ynh_die "Unable to install Composer."
# update dependencies to create composer.lock
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \
|| ynh_die "Unable to update core dependencies with Composer."
}