1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/tiddlywiki_ynh.git synced 2024-09-03 20:26:34 +02:00
This commit is contained in:
ericgaspar 2021-02-16 14:30:51 +01:00
parent 3cd5e703e5
commit 28c6c7ec2e
No known key found for this signature in database
GPG key ID: 574F281483054D44
7 changed files with 36 additions and 99 deletions

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/Jermolene/TiddlyWiki5/archive/v5.1.21.tar.gz SOURCE_URL=https://github.com/Jermolene/TiddlyWiki5/archive/v5.1.23.tar.gz
SOURCE_SUM=9f36a082f55334fd4b88f9af82a8711c4ef787b04f5280e52dd97e0df9864616 SOURCE_SUM=a35f8a4cb25f1f75e49ec40dcc9b1cd7ef4fb099322507464272be720fdc28d3
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -6,7 +6,6 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers

View file

@ -27,8 +27,8 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..." ynh_print_info --message="Loading installation settings..."
# 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)
port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED # CHECK WHICH PARTS SHOULD BE CHANGED
@ -53,7 +53,7 @@ fi
#================================================= #=================================================
ynh_print_info --message="Stopping a systemd service..." ynh_print_info --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" ynh_systemd_action --service_name=$app --action=stop
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
@ -91,7 +91,7 @@ fi
#================================================= #=================================================
ynh_print_info --message="Starting a systemd service..." ynh_print_info --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" ynh_systemd_action --service_name=$app --action=start
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX

View file

@ -7,7 +7,6 @@
#================================================= #=================================================
source _common.sh source _common.sh
source ynh_send_readme_to_admin__2
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -30,13 +29,10 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
# ldap_user="svc_${app}_ldap"
# ldap_password=$(ynh_string_random --length=8)
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
@ -47,21 +43,18 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." 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=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=is_public --value=$is_public
# 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 # STANDARD MODIFICATIONS
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_script_progression --message="Finding an available port..." ynh_script_progression --message="Finding an available port..." --weight=1
# Find a free port # Find a free port
port=$(ynh_find_port --port=8095) port=$(ynh_find_port --port=8095)
@ -77,7 +70,7 @@ ynh_install_nodejs --nodejs_version=$nodejs_version
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." ynh_script_progression --message="Setting up source files..." --weight=1
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 # Download, check integrity, uncompress and patch the source from app.src
@ -86,7 +79,7 @@ ynh_setup_source --dest_dir=$final_path
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring NGINX web server..." ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -94,7 +87,7 @@ ynh_add_nginx_config
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Configuring system user ..." ynh_script_progression --message="Configuring system user ..." --weight=1
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path ynh_system_user_create --username=$app --home_dir=$final_path
@ -103,6 +96,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
ynh_script_progression --message="tiddlywiki..." --weight=2 ynh_script_progression --message="tiddlywiki..." --weight=2
pushd $final_path pushd $final_path
$nodejs_path/node $final_path/tiddlywiki monwiki --init server $nodejs_path/node $final_path/tiddlywiki monwiki --init server
popd popd
@ -110,7 +104,7 @@ popd
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." ynh_script_progression --message="Configuring a systemd service..." --weight=1
ynh_add_systemd_config ynh_add_systemd_config
@ -135,7 +129,7 @@ yunohost service add $app --description="Collaborative editor" --log="/var/log/$
#================================================= #=================================================
ynh_print_info --message="on demarre le service..." ynh_print_info --message="on demarre le service..."
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Browse to http://localhost" ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match=""
sleep 30 sleep 30
@ -153,7 +147,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_print_info --message="Reloading NGINX web server..." ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
@ -161,4 +155,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Installation of $app completed" ynh_script_progression --message="Installation of $app completed" --last

View file

@ -18,12 +18,8 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port) 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) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#================================================= #=================================================
@ -45,21 +41,11 @@ ynh_print_info --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
ynh_print_info --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
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_print_info --message="Removing dependencies..." ynh_print_info --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
ynh_remove_nodejs ynh_remove_nodejs
#================================================= #=================================================
@ -73,30 +59,11 @@ ynh_secure_remove --file="$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info --message="Removing nginx web server configuration..." ynh_print_info --message="Removing NGINX web server configuration..."
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_print_info --message="Closing port $port..."
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE LDAP USER
#=================================================
ynh_print_info --message="Removing ldap user..."
yunohost user delete $ldap_user --purge
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -23,7 +23,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading settings..." ynh_print_info --message="Loading settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -34,7 +34,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_print_info --message="Validating restoration parameters..." ynh_print_info --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}" || ynh_die --message="Path not available: ${domain}${path_url}"
@ -52,14 +52,14 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_print_info --message="Restoring the app main directory..." ynh_print_info --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$final_path"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_print_info --message="Recreating the dedicated system user..." ynh_print_info --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path ynh_system_user_create --username=$app --home_dir=$final_path
@ -76,7 +76,7 @@ chown -R $app: $final_path
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_print_info --message="Reinstalling dependencies..." ynh_print_info --message="Reinstalling dependencies..." --weight=1
# Install Nodejs # Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
@ -84,7 +84,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================
ynh_print_info --message="Restoring the systemd configuration..." ynh_print_info --message="Restoring the systemd configuration..." --weight=1
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet systemctl enable $app.service --quiet
@ -108,7 +108,7 @@ ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --lin
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_print_info --message="Reloading NGINX web server..." ynh_print_info --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
@ -116,4 +116,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Restoration completed for $app" ynh_print_info --message="Restoration completed for $app" --last

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..." ynh_print_info --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -31,7 +31,7 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_print_info --message="Ensuring downward compatibility..." ynh_print_info --message="Ensuring downward compatibility..." --weight=1
# If final_path doesn't exist, create it # If final_path doesn't exist, create it
if [ -z "$final_path" ]; then if [ -z "$final_path" ]; then
@ -49,7 +49,7 @@ fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_print_info --message="Backing up the app before upgrading (may take a while)..." ynh_print_info --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -66,7 +66,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================
ynh_print_info --message="Stopping a systemd service..." ynh_print_info --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action=stop ynh_systemd_action --service_name=$app --action=stop
@ -85,7 +85,7 @@ fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info --message="Upgrading NGINX web server configuration..." ynh_print_info --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -93,43 +93,22 @@ ynh_add_nginx_config
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
ynh_print_info --message="Upgrading dependencies..." ynh_print_info --message="Upgrading dependencies..." --weight=1
ynh_install_nodejs --nodejs_version=$nodejs_version ynh_install_nodejs --nodejs_version=$nodejs_version
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_print_info --message="Making sure dedicated system user exists..." ynh_print_info --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# SPECIFIC UPGRADE
#=================================================
# MODIFY A CONFIG FILE
#=================================================
config_file="$final_path/config.yml"
ynh_backup_if_checksum_is_different --file=$config_file
cp -f ../conf/config.sample.yml $config_file
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=$config_file
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file=$config_file
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file=$config_file
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file=$config_file
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_print_info --message="Upgrading systemd configuration..." ynh_print_info --message="Upgrading systemd configuration..." --weight=1
ynh_add_systemd_config ynh_add_systemd_config
@ -145,11 +124,9 @@ chown -R $app: $final_path
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_print_info --message="Starting a systemd service..." ynh_print_info --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd ynh_systemd_action --service_name=$app --action=start --log_path=systemd
sleep 30
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
@ -162,4 +139,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Upgrade of $app completed" ynh_print_info --message="Upgrade of $app completed" --last