1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mumbleserver_ynh.git synced 2024-09-03 19:46:03 +02:00

[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot 2024-08-31 01:08:39 +02:00 committed by Alexandre Aubin
parent e574b2e02c
commit c484b3957b
8 changed files with 56 additions and 137 deletions

View file

@ -1,25 +0,0 @@
;; Test complet
auto_remove=1
; Manifest
domain="domain.tld"
welcometext="Welcome to my Mumble server"
registername="Root"
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=0
setup_nourl=1
setup_private=0
setup_public=0
upgrade=1
# 1.3.0~ynh1
upgrade=1 from_commit=d9ece341d532bd5eac9af9ce191da7b62d1e8bb1
# 1.3.0~ynh2
upgrade=1 from_commit=fc6ca3fa6abe234314089fd58ef884759ebe4fd9
backup_restore=1
multi_instance=1
port_already_use=0
change_url=0
;;; Options
Email=
Notification=none

View file

@ -16,7 +16,8 @@ admindoc = "https://wiki.mumble.info/wiki/Main_Page"
code = "https://github.com/mumble-voip/mumble" code = "https://github.com/mumble-voip/mumble"
[integration] [integration]
yunohost = ">= 11.2" yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true

View file

@ -1,17 +1,5 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# COMMON VARIABLES # COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#================================================= #=================================================

View file

@ -1,34 +1,25 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # 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
#================================================= ynh_print_info "Declaring files to be backed up..."
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$install_dir" ynh_backup "$install_dir"
#================================================= #=================================================
# BACKUP SYSTEMD # BACKUP SYSTEMD
#================================================= #=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service" ynh_backup "/etc/systemd/system/$app.service"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -2,12 +2,6 @@
# doc: https://wiki.mumble.info/wiki/Running_Murmur # doc: https://wiki.mumble.info/wiki/Running_Murmur
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -22,27 +16,26 @@ instance_id=$YNH_APP_INSTANCE_NUMBER
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_script_progression "Storing installation settings..."
ynh_app_setting_set --app=$app --key=no_sso --value="true" ynh_app_setting_set --key=no_sso --value="true"
ynh_app_setting_set --app=$app --key=server_password --value="$server_password" ynh_app_setting_set --key=server_password --value="$server_password"
ynh_app_setting_set --app=$app --key=su_passwd --value="$su_passwd" ynh_app_setting_set --key=su_passwd --value="$su_passwd"
ynh_app_setting_set --app=$app --key=instance_id --value="$instance_id" ynh_app_setting_set --key=instance_id --value="$instance_id"
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=2 ynh_script_progression "Adding $app's configuration..."
mkdir -p "$install_dir" mkdir -p "$install_dir"
ynh_add_config --template="mumble-server.ini" --destination="$install_dir/mumble-server.ini" ynh_config_add --template="mumble-server.ini" --destination="$install_dir/mumble-server.ini"
chmod -R 770 "$install_dir"
chown -R :mumble-server "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R 770 "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R :mumble-server "$install_dir"
#================================================= #=================================================
# ADD USER TO SSL-CERT # ADD USER TO SSL-CERT
#================================================= #=================================================
@ -56,7 +49,7 @@ usermod --append --groups ssl-cert mumble-server
# || true temporarily to ignore a bug in murmurd 1.3.0 # || true temporarily to ignore a bug in murmurd 1.3.0
# https://github.com/mumble-voip/mumble/issues/3911 # https://github.com/mumble-voip/mumble/issues/3911
#ynh_exec_warn_less murmurd -ini "$install_dir/mumble-server.ini" -supw "$su_passwd" "$instance_id" || true #ynh_hide_warnings murmurd -ini "$install_dir/mumble-server.ini" -supw "$su_passwd" "$instance_id" || true
#================================================= #=================================================
# Disable default server installed by Debian's package # Disable default server installed by Debian's package
@ -66,19 +59,19 @@ systemctl stop mumble-server
systemctl disable mumble-server --quiet systemctl disable mumble-server --quiet
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_config_add_systemd
yunohost service add $app --description="Mumble server" --log="/var/log/mumble-server/$app.log" --needs_exposed_ports="$port" yunohost service add $app --description="Mumble server" --log="/var/log/mumble-server/$app.log" --needs_exposed_ports="$port"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=3 ynh_script_progression "Starting $app's systemd service..."
ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/mumble-server/$app.log" ynh_systemctl --service=$app --action=restart --log_path="/var/log/mumble-server/$app.log"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" --last ynh_script_progression "Installation of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -16,19 +10,19 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) # Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null if ynh_hide_warnings yunohost service status $app >/dev/null
then then
ynh_script_progression --message="Removing $app service integration..." --weight=1 ynh_script_progression "Removing $app service integration..."
yunohost service remove $app yunohost service remove $app
fi fi
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_config_remove_systemd
ynh_secure_remove --file="/var/log/mumble-server/$app.log" ynh_safe_rm "/var/log/mumble-server/$app.log"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" --last ynh_script_progression "Removal of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # 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
@ -15,18 +9,17 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=2 ynh_script_progression "Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir" ynh_restore "$install_dir"
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE USER RIGHTS
#================================================= #=================================================
# Restore permissions on app files # Restore permissions on app files
chmod -R 770 "$install_dir" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R 770 "$install_dir"
chown -R :mumble-server "$install_dir" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R :mumble-server "$install_dir"
#================================================= #=================================================
# Add user to ssl-cert so it can read certificates # Add user to ssl-cert so it can read certificates
#================================================= #=================================================
@ -43,27 +36,27 @@ systemctl disable mumble-server --quiet
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 ynh_script_progression "Restoring $app's systemd service..."
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore "/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet systemctl enable $app.service --quiet
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression "Integrating service in YunoHost..."
yunohost service add $app --description="Mumble server" --log="/var/log/mumble-server/$app.log" --needs_exposed_ports="$port" yunohost service add $app --description="Mumble server" --log="/var/log/mumble-server/$app.log" --needs_exposed_ports="$port"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=3 ynh_script_progression "Starting $app's systemd service..."
ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/mumble-server/$app.log" ynh_systemctl --service=$app --action=restart --log_path="/var/log/mumble-server/$app.log"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for $app" --last ynh_script_progression "Restoration completed for $app"

View file

@ -1,33 +1,19 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." ynh_script_progression "Stopping $app's systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/mumble-server/$app.log" ynh_systemctl --service=$app --action="stop" --log_path="/var/log/mumble-server/$app.log"
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 ynh_script_progression "Ensuring downward compatibility..."
# test old time # test old time
if [ -z "${server_password:-}" ]; then if [ -z "${server_password:-}" ]; then
@ -53,10 +39,10 @@ if [ -z "${server_password:-}" ]; then
| head -1 \ | head -1 \
| sed -r "s/.* (([a-z])*\.([a-z])*).*/\1/g") | sed -r "s/.* (([a-z])*\.([a-z])*).*/\1/g")
ynh_app_setting_set --app=$app --key=server_password --value=$server_password ynh_app_setting_set --key=server_password --value=$server_password
ynh_app_setting_set --app=$app --key=welcometext --value=$welcometext ynh_app_setting_set --key=welcometext --value=$welcometext
ynh_app_setting_set --app=$app --key=registername --value=$registername ynh_app_setting_set --key=registername --value=$registername
ynh_app_setting_set --app=$app --key=su_passwd --value=$su_passwd ynh_app_setting_set --key=su_passwd --value=$su_passwd
systemctl stop mumble-server systemctl stop mumble-server
dpkg-reconfigure mumble-server --frontend=Noninteractive dpkg-reconfigure mumble-server --frontend=Noninteractive
@ -67,35 +53,33 @@ fi
# Fix SSO issue # Fix SSO issue
# https://github.com/YunoHost-Apps/mumbleserver_ynh/issues/19 # https://github.com/YunoHost-Apps/mumbleserver_ynh/issues/19
if [ -z "${no_sso:-}" ]; then if [ -z "${no_sso:-}" ]; then
ynh_app_setting_set --app="$app" --key=no_sso --value="true" ynh_app_setting_set --key=no_sso --value="true"
fi fi
# Fix multi installation # Fix multi installation
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=instance_id --value=$YNH_APP_INSTANCE_NUMBER
if [ -z "${instance_id:-}" ]; then if [ -z "${instance_id:-}" ]; then
instance_id=$YNH_APP_INSTANCE_NUMBER instance_id=$YNH_APP_INSTANCE_NUMBER
ynh_app_setting_set --app="$app" instance_id --value="$instance_id" ynh_app_setting_set instance_id --value="$instance_id"
fi fi
if [ -z "${registername:-}" ]; then if [ -z "${registername:-}" ]; then
registername=$(ynh_app_setting_get "$app" registerName) registername=$(ynh_app_setting_get "$app" registerName)
ynh_app_setting_set --app="$app" --key=registername --value="$registername" ynh_app_setting_set --key=registername --value="$registername"
ynh_app_setting_delete "$app" registerName ynh_app_setting_delete "$app" registerName
fi fi
#=================================================
# SPECIFIC UPGRADE
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_script_progression "Updating configuration..."
mkdir -p $install_dir mkdir -p $install_dir
ynh_add_config --template="mumble-server.ini" --destination="$install_dir/mumble-server.ini" ynh_config_add --template="mumble-server.ini" --destination="$install_dir/mumble-server.ini"
chmod -R 770 "$install_dir"
chown -R :mumble-server "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R 770 "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R :mumble-server "$install_dir"
#================================================= #=================================================
# Add user to ssl-cert so it can read certificates # Add user to ssl-cert so it can read certificates
#================================================= #=================================================
@ -120,10 +104,10 @@ systemctl disable mumble-server --quiet
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 ynh_script_progression "Upgrading systemd configuration..."
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_config_add_systemd
# Add Mumble as a YunoHost service # Add Mumble as a YunoHost service
yunohost service add $app --description="Mumble server" --log="/var/log/mumble-server/$app.log" --needs_exposed_ports="$port" yunohost service add $app --description="Mumble server" --log="/var/log/mumble-server/$app.log" --needs_exposed_ports="$port"
@ -131,12 +115,12 @@ yunohost service add $app --description="Mumble server" --log="/var/log/mumble-s
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=3 ynh_script_progression "Starting $app's systemd service..."
ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/mumble-server/$app.log" ynh_systemctl --service=$app --action=restart --log_path="/var/log/mumble-server/$app.log"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --last ynh_script_progression "Upgrade of $app completed"