mirror of
https://github.com/YunoHost-Apps/mediawiki_ynh.git
synced 2024-09-03 19:46:05 +02:00
quoting
This commit is contained in:
parent
8b52f83126
commit
cc124ea33d
7 changed files with 110 additions and 97 deletions
|
@ -3,4 +3,9 @@
|
|||
#=================================================
|
||||
# CONSTANTS
|
||||
#=================================================
|
||||
pkg_dependencies="diffutils imagemagick acl"
|
||||
# shellcheck disable=SC2034 # Variable is used by other scripts
|
||||
pkg_dependencies=(
|
||||
diffutils
|
||||
imagemagick
|
||||
acl
|
||||
)
|
||||
|
|
|
@ -24,10 +24,10 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
||||
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# STANDARD BACKUP STEPS
|
||||
|
|
|
@ -36,7 +36,7 @@ old_path=$(ynh_normalize_url_path $old_path)
|
|||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
|
@ -86,7 +86,9 @@ then
|
|||
# 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
|
||||
# shellcheck disable=SC2034 # Variable is referenced by ynh_add_nginx_config
|
||||
domain="$old_domain"
|
||||
# shellcheck disable=SC2034 # Variable is referenced by ynh_add_nginx_config
|
||||
path_url="$new_path"
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
@ -97,7 +99,7 @@ if [ $change_domain -eq 1 ]
|
|||
then
|
||||
# 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
|
||||
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"
|
||||
fi
|
||||
|
|
|
@ -21,7 +21,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
|
||||
path_url=$(ynh_normalize_url_path "$YNH_APP_ARG_PATH")
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
admin_password=$YNH_APP_ARG_PASSWORD
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
|
@ -39,7 +39,7 @@ final_path=/var/www/$app
|
|||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
ynh_webpath_register --app="$app" --domain="$domain" --path_url="$path_url"
|
||||
|
||||
#=================================================
|
||||
# GENERATE LDAP USER SETTINGS
|
||||
|
@ -54,15 +54,15 @@ ldap_password=$(ynh_string_random --length=8)
|
|||
#=================================================
|
||||
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=admin --value=$admin
|
||||
ynh_app_setting_set --app=$app --key=admin_password --value=$admin_password
|
||||
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=wiki_name --value=$wiki_name
|
||||
ynh_app_setting_set --app=$app --key=ldap_user --value=$ldap_user
|
||||
ynh_app_setting_set --app=$app --key=ldap_password --value=$ldap_password
|
||||
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=admin_password --value="$admin_password"
|
||||
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=wiki_name --value="$wiki_name"
|
||||
ynh_app_setting_set --app="$app" --key=ldap_user --value="$ldap_user"
|
||||
ynh_app_setting_set --app="$app" --key=ldap_password --value="$ldap_password"
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
|
@ -71,26 +71,26 @@ ynh_app_setting_set --app=$app --key=ldap_password --value=$ldap_password
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=15
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_app_dependencies "${pkg_dependencies[@]}"
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a MySQL database..." --weight=1
|
||||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_name=$(ynh_sanitize_dbid --db_name="$app")
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
# creates the variable db_pwd
|
||||
ynh_app_setting_set --app="$app" --key=db_name --value="$db_name"
|
||||
ynh_app_setting_set --app="$app" --key=db_user --value="$db_user"
|
||||
ynh_mysql_setup_db --db_user="$db_user" --db_name="$db_name"
|
||||
test -n "${db_pwd:?}" # Check the variable is correctly set by ynh_mysql_setup_db
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=4
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
ynh_setup_source --dest_dir="$final_path/extensions/" --source_id="ldap_authentication2"
|
||||
|
@ -116,7 +116,7 @@ ynh_add_nginx_config
|
|||
ynh_script_progression --message="Configuring system user..." --weight=2
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
ynh_system_user_create --username="$app"
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
|
@ -133,7 +133,9 @@ ynh_add_fpm_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Creating dedicated LDAP user..." --weight=1
|
||||
|
||||
yunohost user create $ldap_user --firstname "MediaWikiLdap" --lastname "MediaWikiLdap" --mail ${ldap_user}@$domain --password $ldap_password -q 0
|
||||
yunohost user create "$ldap_user" \
|
||||
--firstname "MediaWikiLdap" --lastname "MediaWikiLdap" \
|
||||
--mail "${ldap_user}@$domain" --password "$ldap_password" -q 0
|
||||
|
||||
#=================================================
|
||||
# RUN INSTALLATION OF MEDIAWIKI
|
||||
|
@ -145,26 +147,26 @@ else
|
|||
scriptpath=$path_url
|
||||
fi
|
||||
|
||||
php $final_path/maintenance/install.php --conf $final_path \
|
||||
php "$final_path/maintenance/install.php" --conf "$final_path" \
|
||||
--server "https://$domain" \
|
||||
--scriptpath "$scriptpath" \
|
||||
--dbuser $db_name \
|
||||
--dbpass $db_pwd \
|
||||
--dbname $db_name \
|
||||
--dbuser "$db_name" \
|
||||
--dbpass "$db_pwd" \
|
||||
--dbname "$db_name" \
|
||||
--dbprefix "mdk_" \
|
||||
--lang $language \
|
||||
--pass $admin_password \
|
||||
--lang "$language" \
|
||||
--pass "$admin_password" \
|
||||
"$wiki_name" "$admin"
|
||||
|
||||
#=================================================
|
||||
# REPLACE CONFIGURATION SETTINGS
|
||||
#=================================================
|
||||
cp ../conf/LocalSettings.php $final_path/LocalSettings.php
|
||||
cp ../conf/LocalSettings.php "$final_path/LocalSettings.php"
|
||||
|
||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__WIKI_NAME__" --replace_string="$wiki_name"
|
||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__ADMIN__" --replace_string="$admin"
|
||||
|
||||
if [ $path_url = "/" ]; then
|
||||
if [ "$path_url" = "/" ]; then
|
||||
# MediaWiki expects a "" for the root URL which is typically assumed to be
|
||||
# "/" by other application packages. Therefore, we assume end-users will do
|
||||
# this as well and make sure to ensure an "" in all cases where "/" is
|
||||
|
@ -181,15 +183,15 @@ ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string=
|
|||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__LANGUAGE__" --replace_string="$language"
|
||||
|
||||
secret=$(ynh_string_random 64)
|
||||
ynh_app_setting_set $app secret $secret
|
||||
ynh_app_setting_set "$app" secret "$secret"
|
||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__SECRET__" --replace_string="$secret"
|
||||
|
||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__LDAP_USER__" --replace_string="$ldap_user"
|
||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__LDAP_PASSWORD__" --replace_string="$ldap_password"
|
||||
|
||||
php $final_path/maintenance/update.php
|
||||
php "$final_path/maintenance/update.php"
|
||||
|
||||
chown -R $app:$app $final_path
|
||||
chown -R "$app:$app" "$final_path"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
@ -197,7 +199,7 @@ chown -R $app:$app $final_path
|
|||
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]; then
|
||||
if [ "$is_public" -eq 1 ]; then
|
||||
ynh_permission_update --permission "main" --add "visitors"
|
||||
fi
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||
port=$(ynh_app_setting_get --app="$app" --key=port)
|
||||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user)
|
||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||
ldap_user=$(ynh_app_setting_get --app="$app" --key=ldap_user)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
|
@ -31,7 +31,7 @@ ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user)
|
|||
ynh_script_progression --message="Removing the MySQL database..." --weight=4
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
ynh_mysql_remove_db --db_user"=$db_user" --db_name="$db_name"
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
|
@ -72,7 +72,7 @@ ynh_remove_fpm_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Removing LDAP user..." --weight=1
|
||||
|
||||
yunohost user delete $ldap_user --purge
|
||||
yunohost user delete "$ldap_user" --purge
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -82,7 +82,7 @@ yunohost user delete $ldap_user --purge
|
|||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
ynh_system_user_delete --username="$app"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -24,24 +24,24 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app="$app" --key=path)
|
||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
||||
db_user=$db_name
|
||||
ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user)
|
||||
ldap_password=$(ynh_app_setting_get --app=$app --key=ldap_password)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
ldap_user=$(ynh_app_setting_get --app="$app" --key=ldap_user)
|
||||
ldap_password=$(ynh_app_setting_get --app="$app" --key=ldap_password)
|
||||
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
||||
ynh_webpath_available --domain="$domain" --path_url="$path_url" \
|
||||
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
test ! -d "$final_path" \
|
||||
|| ynh_die --message="There is already a directory: $final_path"
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
|
@ -64,14 +64,14 @@ ynh_restore_file --origin_path="$final_path"
|
|||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
ynh_system_user_create --username="$app"
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R $app:$app $final_path
|
||||
chown -R "$app:$app" "$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
|
@ -87,23 +87,25 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|||
ynh_script_progression --message="Reinstalling dependencies..." --weight=10
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_app_dependencies "${pkg_dependencies[@]}"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=5
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
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
|
||||
db_pwd=$(ynh_app_setting_get --app="$app" --key=mysqlpwd)
|
||||
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 LDAP USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring LDAP dedicated user..." --weight=1
|
||||
|
||||
yunohost user create $ldap_user --firstname "MediaWikiLdap" --lastname "MediaWikiLdap" --mail ${ldap_user}@$domain --password $ldap_password -q 0
|
||||
yunohost user create "$ldap_user" \
|
||||
--firstname "MediaWikiLdap" --lastname "MediaWikiLdap" \
|
||||
--mail "${ldap_user}@$domain" --password "$ldap_password" -q 0
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -112,7 +114,7 @@ yunohost user create $ldap_user --firstname "MediaWikiLdap" --lastname "MediaWik
|
|||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||
ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -16,23 +16,23 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
|
||||
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)
|
||||
wiki_name=$(ynh_app_setting_get --app=$app --key=wiki_name)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user)
|
||||
ldap_password=$(ynh_app_setting_get --app=$app --key=ldap_password)
|
||||
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)
|
||||
wiki_name=$(ynh_app_setting_get --app="$app" --key=wiki_name)
|
||||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
||||
db_pwd=$(ynh_app_setting_get --app="$app" --key=mysqlpwd)
|
||||
ldap_user=$(ynh_app_setting_get --app="$app" --key=ldap_user)
|
||||
ldap_password=$(ynh_app_setting_get --app="$app" --key=ldap_password)
|
||||
|
||||
# Note(decentral1se): avoid using this on upgrade for the versions
|
||||
# of the application that upgrade and have not stored this in their
|
||||
# settings (when it was not available to them). Later on, when we have
|
||||
# moved a few versions on, we can re-enable this
|
||||
# wiki_name=$(ynh_app_setting_get --app=$app --key=wiki_name)
|
||||
# wiki_name=$(ynh_app_setting_get --app="$app" --key=wiki_name)
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
|
@ -41,23 +41,23 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
|||
|
||||
# Fix is_public as a boolean value
|
||||
if [ "$is_public" = "Yes" ]; then
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=1
|
||||
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
|
||||
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)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
db_name=$(ynh_sanitize_dbid --db_name="$app")
|
||||
ynh_app_setting_set --app="$app" --key=db_name --value="$db_name"
|
||||
fi
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z "$final_path" ]; then
|
||||
final_path=/var/www/$app
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
final_path="/var/www/$app"
|
||||
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -79,7 +79,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
|
||||
# Normalize the URL path syntax
|
||||
path_url=$(ynh_normalize_url_path --path_url=$path_url)
|
||||
path_url=$(ynh_normalize_url_path --path_url="$path_url")
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
|
@ -111,7 +111,7 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=3
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_app_dependencies "${pkg_dependencies[@]}"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -119,7 +119,7 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
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
|
||||
ynh_system_user_create --username="$app"
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
|
@ -137,11 +137,13 @@ ynh_add_fpm_config
|
|||
ynh_script_progression --message="Creating dedicated LDAP user if necessary..." --weight=1
|
||||
|
||||
if [[ -z "$ldap_user" ]]; then
|
||||
ldap_user="${app}_ldap"
|
||||
ldap_password=$(ynh_string_random --length=8)
|
||||
ynh_app_setting_set --app="$app" --key=ldap_user --value="$ldap_user"
|
||||
ynh_app_setting_set --app="$app" --key=ldap_password --value="$ldap_password"
|
||||
yunohost user create $ldap_user --firstname "MediaWikiLdap" --lastname "MediaWikiLdap" --mail ${ldap_user}@$domain --password $ldap_password -q 0
|
||||
ldap_user="${app}_ldap"
|
||||
ldap_password=$(ynh_string_random --length=8)
|
||||
ynh_app_setting_set --app="$app" --key=ldap_user --value="$ldap_user"
|
||||
ynh_app_setting_set --app="$app" --key=ldap_password --value="$ldap_password"
|
||||
yunohost user create "$ldap_user" \
|
||||
--firstname "MediaWikiLdap" --lastname "MediaWikiLdap" \
|
||||
--mail "${ldap_user}@$domain" --password "$ldap_password" -q 0
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -154,13 +156,13 @@ ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Upgrading application files..." --weight=4
|
||||
|
||||
rm $final_path/LocalSettings.php
|
||||
cp ../conf/LocalSettings.php $final_path/LocalSettings.php
|
||||
rm "$final_path/LocalSettings.php"
|
||||
cp ../conf/LocalSettings.php "$final_path/LocalSettings.php"
|
||||
|
||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__WIKI_NAME__" --replace_string="$wiki_name"
|
||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__ADMIN__" --replace_string="$admin"
|
||||
|
||||
if [ $path_url = "/" ]; then
|
||||
if [ "$path_url" = "/" ]; then
|
||||
# MediaWiki expects a "" for the root URL which is typically assumed to be
|
||||
# "/" by other application packages. Therefore, we assume end-users will do
|
||||
# this as well and make sure to ensure an "" in all cases where "/" is
|
||||
|
@ -177,20 +179,20 @@ ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string=
|
|||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__LANGUAGE__" --replace_string="$language"
|
||||
|
||||
secret=$(ynh_string_random 64)
|
||||
ynh_app_setting_set $app secret $secret
|
||||
ynh_app_setting_set "$app" secret "$secret"
|
||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__SECRET__" --replace_string="$secret"
|
||||
|
||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__LDAP_USER__" --replace_string="$ldap_user"
|
||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__LDAP_PASSWORD__" --replace_string="$ldap_password"
|
||||
|
||||
php $final_path/maintenance/update.php
|
||||
php "$final_path/maintenance/update.php"
|
||||
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R $app:$app $final_path
|
||||
chown -R "$app:$app" "$final_path"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
Loading…
Add table
Reference in a new issue