mirror of
https://github.com/YunoHost-Apps/dont-code_ynh.git
synced 2024-09-03 18:26:34 +02:00
rename document_path -> document_dir for readability. fix upgrade.
This commit is contained in:
parent
51e94e2719
commit
99c115d00a
5 changed files with 14 additions and 6 deletions
|
@ -5,5 +5,5 @@ projects_database_name=dontCodeProjects
|
||||||
|
|
||||||
quarkus_mongodb_data_connection_string=mongodb://localhost:27017
|
quarkus_mongodb_data_connection_string=mongodb://localhost:27017
|
||||||
data_database_name=dontCodeData
|
data_database_name=dontCodeData
|
||||||
document_directory=__DOCUMENT_PATH__
|
document_directory=__DOCUMENT_DIR__
|
||||||
document_external_url=__DOCUMENT_URL__
|
document_external_url=__DOCUMENT_URL__
|
||||||
|
|
|
@ -19,7 +19,7 @@ StandardError=inherit
|
||||||
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
||||||
|
|
||||||
# Enable the writing of uploaded documents
|
# Enable the writing of uploaded documents
|
||||||
ReadWritePaths=__DOCUMENT_PATH__
|
ReadWritePaths=__DOCUMENT_DIR__
|
||||||
NoNewPrivileges=yes
|
NoNewPrivileges=yes
|
||||||
PrivateTmp=yes
|
PrivateTmp=yes
|
||||||
PrivateDevices=yes
|
PrivateDevices=yes
|
||||||
|
|
|
@ -29,8 +29,8 @@ chown "$app:$app" /var/log/$app
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring document storage..." --weight=1
|
ynh_script_progression --message="Configuring document storage..." --weight=1
|
||||||
|
|
||||||
document_path=$data_dir/docs
|
document_dir=$data_dir/docs
|
||||||
ynh_app_setting_set --app="$app" --key=document_path --value="$document_path"
|
ynh_app_setting_set --app="$app" --key=document_dir --value="$document_dir"
|
||||||
|
|
||||||
document_url=$(append_uri "https://${domain}${path}" "docs")
|
document_url=$(append_uri "https://${domain}${path}" "docs")
|
||||||
ynh_app_setting_set --app="$app" --key=document_url --value="$document_url"
|
ynh_app_setting_set --app="$app" --key=document_url --value="$document_url"
|
||||||
|
|
|
@ -31,7 +31,7 @@ ynh_script_progression --message="Restoring the document storage..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||||
|
|
||||||
mkdir -p $document_path
|
mkdir -p $document_dir
|
||||||
|
|
||||||
chmod -R o-rwx "$data_dir"
|
chmod -R o-rwx "$data_dir"
|
||||||
chown -R $app:www-data "$data_dir"
|
chown -R $app:www-data "$data_dir"
|
||||||
|
|
|
@ -28,9 +28,17 @@ done
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
|
if [[ -n "$document_path" ]]; then
|
||||||
|
# Renamed setting key
|
||||||
|
document_dir="$document_path"
|
||||||
|
ynh_app_setting_delete --app="$app" --key=document_path
|
||||||
|
ynh_app_setting_set --app="$app" --key=document_dir --value="$document_dir"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n "${html_path:-}" ]]; then
|
if [[ -n "${html_path:-}" ]]; then
|
||||||
# Migrate html_path to data_dir
|
# Migrate html_path to data_dir
|
||||||
mv "$html_path/index.html" "$html_path/docs" "$data_dir"
|
mv "$html_path/index.html" "$html_path/docs" "$data_dir"
|
||||||
|
old_doc_dir="$html_path/docs"
|
||||||
ynh_secure_remove --file="$html_path"
|
ynh_secure_remove --file="$html_path"
|
||||||
ynh_app_setting_delete --app="$app" --key=html_path
|
ynh_app_setting_delete --app="$app" --key=html_path
|
||||||
# FIXME: other settings
|
# FIXME: other settings
|
||||||
|
@ -40,7 +48,7 @@ if [[ -n "${html_path:-}" ]]; then
|
||||||
|
|
||||||
# Update the path in .env file
|
# Update the path in .env file
|
||||||
ynh_backup_if_checksum_is_different --file="$install_dir/.env"
|
ynh_backup_if_checksum_is_different --file="$install_dir/.env"
|
||||||
ynh_replace_string --match_string="$old_doc_path" --replace_string="$document_path" --target_file="$install_dir/.env"
|
ynh_replace_string --match_string="$old_doc_dir" --replace_string="$document_dir" --target_file="$install_dir/.env"
|
||||||
ynh_store_file_checksum --file="$install_dir/.env"
|
ynh_store_file_checksum --file="$install_dir/.env"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue