mirror of
https://github.com/YunoHost-Apps/opensondage_ynh.git
synced 2024-09-03 19:46:28 +02:00
1.1.16
This commit is contained in:
parent
219ff653d6
commit
68fe2e0101
8 changed files with 55 additions and 145 deletions
|
@ -1,10 +1,10 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
admin="john" (USER)
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
admin="john"
|
||||
language="fr"
|
||||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
is_public=1
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
|
@ -16,11 +16,7 @@
|
|||
upgrade=1 from_commit=eb508660841801995fe2c66e5bf3259cdbea5922
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
incorrect_path=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Levels
|
||||
Level 5=auto
|
||||
;;; Upgrade options
|
||||
; commit=eb508660841801995fe2c66e5bf3259cdbea5922
|
||||
name=Remove Framasoft signature
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SOURCE_URL=https://framagit.org/framasoft/framadate/framadate/-/archive/1.1.10/framadate-1.1.10.tar.gz
|
||||
SOURCE_SUM=ea9ab8bd713da17dc7e5d6ddd782ce704184a3189888ed837ba8e59ee7b6fa5f
|
||||
SOURCE_URL=https://framagit.org/framasoft/framadate/framadate/-/archive/1.1.16/framadate-1.1.16.tar.gz
|
||||
SOURCE_SUM=89da42a915c912a91ae1ba44fd32a61ec8fa5f59c517ee3f5d74335ddee77c7d
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=opensondage-1-1-10.tar.gz
|
||||
SOURCE_FILENAME=opensondage-1-1-16.tar.gz
|
||||
|
|
|
@ -26,19 +26,19 @@ const APP_URL = '__DOMAIN__';
|
|||
const NOMAPPLICATION = 'OpenSondage';
|
||||
|
||||
// Database administrator email
|
||||
const ADRESSEMAILADMIN = '__ADMINMAIL__';
|
||||
const ADRESSEMAILADMIN = '__EMAIL__';
|
||||
|
||||
// Email for automatic responses (you should set it to "no-reply")
|
||||
const ADRESSEMAILREPONSEAUTO = '<no-reply@__DOMAIN__>';
|
||||
|
||||
// Database user
|
||||
const DB_USER= '__DBUSER__';
|
||||
const DB_USER= '__DB_USER__';
|
||||
|
||||
// Database password
|
||||
const DB_PASSWORD = '__DBPWD__';
|
||||
const DB_PASSWORD = '__DB_PWD__';
|
||||
|
||||
// Database server name, leave empty to use a socket
|
||||
const DB_CONNECTION_STRING = 'mysql:host=localhost;dbname=__DBNAME__;port=3306';
|
||||
const DB_CONNECTION_STRING = 'mysql:host=localhost;dbname=__DB_NAME__;port=3306';
|
||||
|
||||
// Name of the table that store migration script already executed
|
||||
const MIGRATION_TABLE = 'framadate_migration';
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
"id": "opensondage",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Service for planning an appointment or making a decision quickly and easily.",
|
||||
"fr": "Service pour planifier un rendez-vous ou prendre une décision rapidement et facilement.",
|
||||
"de": "Service zur schnellen und einfachen Planung eines Termins oder zur Entscheidungsfindung."
|
||||
"en": "Service for planning an appointment or making a decision quickly and easily",
|
||||
"fr": "Service pour planifier un rendez-vous ou prendre une décision rapidement et facilement",
|
||||
"de": "Service zur schnellen und einfachen Planung eines Termins oder zur Entscheidungsfindung"
|
||||
},
|
||||
"version": "1.1.10~ynh2",
|
||||
"version": "1.1.16~ynh1",
|
||||
"url": "https://git.framasoft.org/framasoft/framadate",
|
||||
"license": "CECILL-B",
|
||||
"maintainer": {
|
||||
|
@ -19,12 +19,12 @@
|
|||
"email": "ljf+opensondage_ynh@grimaud.me"
|
||||
}],
|
||||
"requirements": {
|
||||
"yunohost": ">= 3.8.1"
|
||||
"yunohost": ">= 4.2.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php7.0-fpm",
|
||||
"php7.3-fpm",
|
||||
"mysql"
|
||||
],
|
||||
"arguments": {
|
||||
|
@ -32,32 +32,17 @@
|
|||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain for OpenSondage",
|
||||
"fr": "Choisissez un nom de domaine pour OpenSondage",
|
||||
"de": "Wählen Sie bitte einen Domain für OpenSondage"
|
||||
},
|
||||
"example": "domain.org"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path for OpenSondage",
|
||||
"fr": "Choisissez l'adresse pour OpenSondage",
|
||||
"de": "Tragen Sie bitte den Pfad für OpenSondage ein"
|
||||
},
|
||||
"example": "/date",
|
||||
"default": "/date"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Choose the OpenSondage administrator (must be an existing YunoHost user)",
|
||||
"fr": "Choisissez l'administrateur d'OpenSondage (doit être un utilisateur YunoHost)",
|
||||
"de": "Wählen Sie bitte den OpenSondageadministrator (muss ein vorhandener YunoHost Nutzer sein)"
|
||||
},
|
||||
"example": "johndoe"
|
||||
},
|
||||
{
|
||||
|
@ -74,11 +59,6 @@
|
|||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Can non-members create a poll?",
|
||||
"fr": "Une personne non membre peut elle créer un sondage ?",
|
||||
"de": "Kann einen nicht eingeloggter Nutzer einen Umfrage erstellen?"
|
||||
},
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# dependencies used by the app
|
||||
YNH_PHP_VERSION="7.3"
|
||||
|
||||
pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-cli"
|
||||
extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-cli"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
@ -21,19 +21,6 @@ pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-intl php$
|
|||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Execute a command as another user
|
||||
# usage: exec_as USER COMMAND [ARG ...]
|
||||
exec_as() {
|
||||
local USER=$1
|
||||
shift 1
|
||||
|
||||
if [[ $USER = $(whoami) ]]; then
|
||||
eval "$@"
|
||||
else
|
||||
sudo -u "$USER" "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# Execute a command with Composer
|
||||
#
|
||||
# usage: ynh_composer_exec --phpversion=phpversion [--workdir=$final_path] --commands="commands"
|
||||
|
|
|
@ -24,6 +24,7 @@ path_url=$YNH_APP_ARG_PATH
|
|||
admin=$YNH_APP_ARG_ADMIN
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -47,16 +48,15 @@ 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=language --value=$language
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||
ynh_app_setting_set --app=$app --key=email --value=$email
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=3
|
||||
ynh_script_progression --message="Configuring system user..." --weight=2
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
|
@ -84,21 +84,14 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
|||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=2
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
|
@ -107,23 +100,7 @@ ynh_add_fpm_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring $app..." --weight=2
|
||||
|
||||
config="$final_path/app/inc/config.php"
|
||||
|
||||
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
|
||||
|
||||
cp ../conf/config.php "$config"
|
||||
|
||||
# Change variables in configuration
|
||||
ynh_replace_string --match_string="__DBUSER__" --replace_string=$db_name --target_file="$config"
|
||||
ynh_replace_string --match_string="__DBPWD__" --replace_string="$db_pwd" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DBNAME__" --replace_string=$db_name --target_file="$config"
|
||||
ynh_replace_string --match_string="__ADMINMAIL__" --replace_string=$admin_mail --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"
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string=$path_url --target_file="$config"
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$config"
|
||||
ynh_add_config --template="../conf/config.php" --destination="$final_path/app/inc/config.php"
|
||||
|
||||
#=================================================
|
||||
# REPLACE LOGO IMAGE (DEFAULT IS FRAMADATE)
|
||||
|
|
|
@ -47,13 +47,6 @@ test ! -d $final_path \
|
|||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -62,6 +55,13 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei
|
|||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
|
|
@ -24,6 +24,8 @@ 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)
|
||||
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
email=$(ynh_app_setting_get --app=$app --key=email)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -43,15 +45,6 @@ then
|
|||
ynh_app_setting_delete --app=$app --key=public_site
|
||||
fi
|
||||
|
||||
# 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)
|
||||
|
@ -64,6 +57,12 @@ if [ -z "$final_path" ]; then
|
|||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
fi
|
||||
|
||||
# If email doesn't exist, create it
|
||||
if [ -z "$email" ]
|
||||
then
|
||||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||
fi
|
||||
|
||||
# Make sure default language is set
|
||||
if [ -z "$language" ]
|
||||
then
|
||||
|
@ -93,11 +92,12 @@ ynh_clean_setup () {
|
|||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Normalize the URL path syntax
|
||||
path_url=$(ynh_normalize_url_path --path_url=$path_url)
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
|
@ -113,6 +113,10 @@ then
|
|||
ynh_setup_source --dest_dir="$final_path"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -121,28 +125,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
|||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=7
|
||||
|
||||
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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=3
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
|
@ -154,27 +143,9 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|||
then
|
||||
ynh_script_progression --message="Reconfiguring $app..." --weight=2
|
||||
|
||||
config="$final_path/app/inc/config.php"
|
||||
|
||||
# Verify the checksum and backup the file if it's different
|
||||
ynh_backup_if_checksum_is_different --file="$config"
|
||||
|
||||
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
|
||||
|
||||
cp ../conf/config.php "$config"
|
||||
|
||||
# Change variables in configuration
|
||||
ynh_replace_string --match_string="__DBUSER__" --replace_string=$db_name --target_file="$config"
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_replace_string --match_string="__DBPWD__" --replace_string="$db_pwd" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DBNAME__" --replace_string=$db_name --target_file="$config"
|
||||
ynh_replace_string --match_string="__ADMINMAIL__" --replace_string=$admin_mail --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"
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string=$path_url --target_file="$config"
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$config"
|
||||
ynh_add_config --template="../conf/config.php" --destination="$final_path/app/inc/config.php"
|
||||
chmod 400 "$final_path/app/inc/config.php"
|
||||
chown $app:$app "$final_path/app/inc/config.php"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -200,7 +171,7 @@ then
|
|||
# Install composer
|
||||
ynh_install_composer
|
||||
|
||||
ynh_exec_warn_less php "$final_path/admin/migration.php"
|
||||
ynh_exec_warn_less php$phpversion "$final_path/admin/migration.php"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -209,7 +180,6 @@ fi
|
|||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
chown -R root: "$final_path"
|
||||
chown -R $app: "$final_path/"{tpl_c,admin/stdout.log}
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue