1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wikijs_ynh.git synced 2024-09-03 20:36:09 +02:00

Merge pull request #133 from YunoHost-Apps/eng-testing

Fix change_url
This commit is contained in:
yalh76 2021-05-18 04:59:25 +02:00 committed by GitHub
commit 5a0dcef89a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 57 additions and 79 deletions

View file

@ -28,7 +28,7 @@ Wiki.js is a copylefted libre software, modern and powerful wiki app built on No
## Documentation
* Official documentation: https://docs-beta.requarks.io/
* YunoHost documentation: https://yunohost.org/#/app_wikijs
* YunoHost documentation: https://yunohost.org/en/app_wikijs
## YunoHost specific features

View file

@ -34,6 +34,8 @@
upgrade=1 from_commit=3c9ab32ee147ef1f39aff2773fc3be506164d873
# 2.5.201~ynh1
upgrade=1 from_commit=bce2bfa3f9f0e28ffdde79df17a34bd5302559ea
# 2.5.201~ynh2
upgrade=1 from_commit=17ee20b13ba56babe0231b3f9bd87e9118908838
backup_restore=1
multi_instance=1
port_already_use=0
@ -66,3 +68,5 @@ Notification=yes
name=2.5.197~ynh1
; commit=bce2bfa3f9f0e28ffdde79df17a34bd5302559ea
name=2.5.201~ynh1
; commit=17ee20b13ba56babe0231b3f9bd87e9118908838
name=2.5.201~ynh2

View file

@ -3,10 +3,10 @@
"id": "wikijs",
"packaging_format": 1,
"description": {
"en": "An open source, modern and powerful wiki app built on Node.js, Git and Markdown.",
"fr": "Un wiki moderne et open source propulsé Node.js, Git et Markdown."
"en": "Open source, modern and powerful wiki app built on Node.js, Git and Markdown.",
"fr": "Wiki moderne et open source propulsé Node.js, Git et Markdown."
},
"version": "2.5.201~ynh2",
"version": "2.5.201~ynh3",
"url": "https://wiki.js.org/",
"license": "AGPL-3.0-or-later",
"maintainer": {

View file

@ -7,7 +7,7 @@
# dependencies used by the app
pkg_dependencies="postgresql postgresql-contrib"
NODEJS_VERSION=12
NODEJS_VERSION=14
#=================================================
# PERSONAL HELPERS

View file

@ -29,10 +29,6 @@ ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#db_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================

View file

@ -129,7 +129,7 @@ yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikij
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a config file..."
ynh_script_progression --message="Adding a configuration file..."
ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path/config.yml"
@ -142,7 +142,7 @@ chown $app:$app "$final_path/config.yml"
ynh_script_progression --message="Configuring a systemd service..."
# Create a dedicated systemd config
ynh_add_systemd_config --others_var="ynh_node ynh_node_load_PATH"
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
@ -169,8 +169,6 @@ ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi

View file

@ -50,7 +50,7 @@ ynh_remove_systemd_config
ynh_script_progression --message="Removing the PostgreSQL database..."
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name"
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
@ -77,16 +77,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..."
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
#=================================================
# SPECIFIC REMOVE
#=================================================

View file

@ -51,7 +51,7 @@ test ! -d $final_path \
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"

View file

@ -33,40 +33,6 @@ ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# If ldap_user doesn't exist, retrieve it or create it
if [[ -z "$ldap_user" ]]; then
ldap_user="svc_${app}_ldap"
ldap_password=$(ynh_string_random --length=8)
ynh_app_setting_set "$app" ldap_user "$ldap_user"
ynh_app_setting_set "$app" ldap_password "$ldap_password"
yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --mail ${ldap_user}@$domain --password $ldap_password -q 0
fi
# Remove yarn repository
ynh_secure_remove --file="/etc/apt/sources.list.d/yarn.list"
# Remove old log file
ynh_secure_remove --file="/var/log/$app/"
# Create PostgreSQL User
ynh_psql_create_user $db_name $db_pwd
# Install pg_trgm extension to provide a PostgreSQL search solution
ynh_psql_test_if_first_run
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -90,6 +56,47 @@ ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped wikijs service"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# If ldap_user doesn't exist, retrieve it or create it
if [[ -z "$ldap_user" ]]; then
ldap_user="svc_${app}_ldap"
ldap_password=$(ynh_string_random --length=8)
ynh_app_setting_set "$app" ldap_user "$ldap_user"
ynh_app_setting_set "$app" ldap_password "$ldap_password"
yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --mail ${ldap_user}@$domain --password $ldap_password -q 0
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
# Remove yarn repository
ynh_secure_remove --file="/etc/apt/sources.list.d/yarn.list"
# Remove old log file
ynh_secure_remove --file="/var/log/$app/"
# Create PostgreSQL User
ynh_psql_create_user $db_name $db_pwd
# Install pg_trgm extension to provide a PostgreSQL search solution
ynh_psql_test_if_first_run
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -156,7 +163,7 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a config file..."
ynh_script_progression --message="Updating a configuration file..."
ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path/config.yml"
@ -169,7 +176,7 @@ chown $app:$app "$final_path/config.yml"
ynh_script_progression --message="Upgrading systemd configuration..."
# Create a dedicated systemd config
ynh_add_systemd_config --others_var="ynh_node ynh_node_load_PATH"
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION

View file

@ -72,17 +72,7 @@ ynh_send_readme_to_admin() {
Specific information for the application $app.
$(if [ -n "$app_message" ]
then
cat "$app_message"
else
echo "...No specific information..."
fi)
---
Automatic diagnosis data from YunoHost
__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__"
$(cat "$app_message")"
# Store the message into a file for further modifications.
echo "$mail_message" > mail_to_send
@ -103,10 +93,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
# Insert url links tags
ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
# Insert pre tags
ynh_replace_string "__PRE_TAG1__" "<pre>" mail_to_send
ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
# Insert finishing HTML tags
echo -e "\n</body>\n</html>" >> mail_to_send
@ -115,9 +101,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
# Remove URL tags
ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
ynh_replace_string "__URL_TAG2__" ": " mail_to_send
# Remove PRE tags
ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
fi
# Define binary to use for mail command