1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/galette_ynh.git synced 2024-09-03 18:36:28 +02:00
This commit is contained in:
ericgaspar 2021-06-15 22:16:38 +02:00
parent ca1bce5b74
commit 90bb980a97
No known key found for this signature in database
GPG key ID: 574F281483054D44
5 changed files with 34 additions and 73 deletions

View file

@ -1,12 +1,9 @@
# See here for more informations
# https://github.com/YunoHost/package_check#syntax-check_process-file
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
admin="john" (USER)
is_public=1 (PUBLIC|public=1|private=0)
domain="domain.tld"
path="/path"
admin="john"
is_public=1
password="miaw!"
; Checks
pkg_linter=1
@ -19,7 +16,6 @@
upgrade=1 from_commit=65cd8b542310e8b349107ed222fdc57e3c2d239a
backup_restore=1
multi_instance=1
port_already_use=0
change_url=0
;;; Options
Email=jean-baptiste@holcroft.fr

View file

@ -14,11 +14,11 @@ define("HOST_DB", "localhost");
/* tcp port for the database */
define("PORT_DB", "3306");
/* the username for the database */
define("USER_DB", "__DBNAME__");
define("USER_DB", "__DB_NAME__");
/* password for the username define above */
define("PWD_DB", "__DBPASSWORD__");
define("PWD_DB", "__DB_PWD__");
/* the database name */
define("NAME_DB", "__DBNAME__");
define("NAME_DB", "__DB_NAME__");
/* tables name prefix (default is galette_) */
define("PREFIX_DB", "galette_");
/* FIXME will disappear soon */

View file

@ -14,7 +14,7 @@
"email": ""
},
"requirements": {
"yunohost": ">= 3.8.1"
"yunohost": ">= 4.2.4"
},
"multi_instance": true,
"services": [

View file

@ -44,7 +44,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
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=is_public --value=$is_public
#=================================================
# CREATE A MYSQL DATABASE
@ -56,10 +55,18 @@ db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --time --weight=1
ynh_script_progression --message="Setting up source files..." --weight=1
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
@ -67,7 +74,10 @@ ynh_setup_source --dest_dir="$final_path"
mv "$final_path"/galette/* "$final_path"/
ynh_secure_remove "$final_path"/tests
chown -R root: "$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
@ -77,14 +87,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
@ -99,11 +101,10 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
ynh_script_progression --message="Configuring Galette..." --weight=1
cp ../conf/config.inc.php.dist "$final_path/config/config.inc.php"
ynh_add_config --template="../conf/config.inc.php.dist" --destination="$final_path/config/config.inc.php"
# Change variables in Castopod configuration
ynh_replace_string --match_string="__DBNAME__" --replace_string="$db_name" --target_file="$final_path/config/config.inc.php"
ynh_replace_string --match_string="__DBPASSWORD__" --replace_string="$db_pwd" --target_file="$final_path/config/config.inc.php"
chmod 400 "$final_path/config/config.inc.php"
chown $app "$final_path/config/config.inc.php"
#=================================================
# GENERIC FINALIZATION
@ -111,12 +112,9 @@ ynh_replace_string --match_string="__DBPASSWORD__" --replace_string="$db_pwd" --
# SECURE FILES AND DIRECTORIES
#=================================================
chown "$app" "$final_path/config"
chmod 750 "$final_path/config"
for folder in attachments cache exports files imports logs photos templates_c tempimages
do
chown "$app" "$final_path/data/$folder"
chown $app "$final_path/data/$folder"
chmod 750 "$final_path/data/$folder"
done
@ -127,30 +125,6 @@ done
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#=================================================
# SETUP SSOWAT
#=================================================
# if [[ "$path_url" == "/" ]]
# then
# # ynh panel is only comptable with non-root installation
# ynh_replace_string " include conf.d/" " #include conf.d/" "$finalnginxconf"
# else
# ynh_replace_string "^#sub_path_only" "" "$finalnginxconf"
# fi
# ynh_store_file_checksum "$finalnginxconf"
# if [ "$is_public" -eq 0 ]
# then # Remove the public access
# ynh_app_setting_delete "$app" skipped_uris
# fi
# # Make app public if necessary
# if [ "$is_public" -eq 1 ]
# then
# # unprotected_uris allows SSO credentials to be passed anyway.
# ynh_app_setting_set "$app" skipped_uris "/"
# fi
#=================================================
# SETUP SSOWAT
#=================================================

View file

@ -19,7 +19,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -42,15 +42,6 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set "$app" is_public 1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set "$app" is_public 0
is_public=0
fi
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid "$app")
@ -83,6 +74,14 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -120,14 +119,6 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# SPECIFIC UPGRADE
#=================================================