diff --git a/check_process b/check_process deleted file mode 100644 index bf315e4..0000000 --- a/check_process +++ /dev/null @@ -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 diff --git a/manifest.toml b/manifest.toml index fa51621..96fd278 100644 --- a/manifest.toml +++ b/manifest.toml @@ -16,7 +16,8 @@ admindoc = "https://wiki.mumble.info/wiki/Main_Page" code = "https://github.com/mumble-voip/mumble" [integration] -yunohost = ">= 11.2" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = "all" multi_instance = true diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..3d7f008 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,17 +1,5 @@ #!/bin/bash #================================================= -# COMMON VARIABLES -#================================================= - -#================================================= -# PERSONAL HELPERS -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index ac5b947..d3dddfd 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,34 +1,25 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# 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 /usr/share/yunohost/helpers -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # BACKUP SYSTEMD #================================================= -ynh_backup --src_path="/etc/systemd/system/$app.service" +ynh_backup "/etc/systemd/system/$app.service" #================================================= # 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)." diff --git a/scripts/install b/scripts/install index 982910f..2ff7ff9 100644 --- a/scripts/install +++ b/scripts/install @@ -2,12 +2,6 @@ # doc: https://wiki.mumble.info/wiki/Running_Murmur -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers @@ -22,27 +16,26 @@ instance_id=$YNH_APP_INSTANCE_NUMBER #================================================= # 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 --app=$app --key=server_password --value="$server_password" -ynh_app_setting_set --app=$app --key=su_passwd --value="$su_passwd" -ynh_app_setting_set --app=$app --key=instance_id --value="$instance_id" +ynh_app_setting_set --key=no_sso --value="true" +ynh_app_setting_set --key=server_password --value="$server_password" +ynh_app_setting_set --key=su_passwd --value="$su_passwd" +ynh_app_setting_set --key=instance_id --value="$instance_id" #================================================= # SPECIFIC SETUP #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=2 +ynh_script_progression "Adding $app's configuration..." mkdir -p "$install_dir" -ynh_add_config --template="mumble-server.ini" --destination="$install_dir/mumble-server.ini" - -chmod -R 770 "$install_dir" -chown -R :mumble-server "$install_dir" +ynh_config_add --template="mumble-server.ini" --destination="$install_dir/mumble-server.ini" +#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 #================================================= @@ -56,7 +49,7 @@ usermod --append --groups ssl-cert mumble-server # || true temporarily to ignore a bug in murmurd 1.3.0 # 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 @@ -66,19 +59,19 @@ systemctl stop mumble-server systemctl disable mumble-server --quiet # 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" #================================================= # 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 #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 4f1a654..39505fb 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh 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`) -if ynh_exec_warn_less yunohost service status $app >/dev/null +if ynh_hide_warnings yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service integration..." --weight=1 + ynh_script_progression "Removing $app service integration..." yunohost service remove $app fi # 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 #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index cceb9fb..8115b9b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# 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 /usr/share/yunohost/helpers @@ -15,18 +9,17 @@ source /usr/share/yunohost/helpers #================================================= # 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 permissions on app files -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 #================================================= @@ -43,27 +36,27 @@ systemctl disable mumble-server --quiet #================================================= # 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 #================================================= # 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" #================================================= # 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 #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 0ece539..d1b2f59 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,33 +1,19 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - -#================================================= -# STANDARD UPGRADE STEPS #================================================= # 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 #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +ynh_script_progression "Ensuring downward compatibility..." # test old time if [ -z "${server_password:-}" ]; then @@ -53,10 +39,10 @@ if [ -z "${server_password:-}" ]; then | head -1 \ | 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 --app=$app --key=welcometext --value=$welcometext - ynh_app_setting_set --app=$app --key=registername --value=$registername - ynh_app_setting_set --app=$app --key=su_passwd --value=$su_passwd + ynh_app_setting_set --key=server_password --value=$server_password + ynh_app_setting_set --key=welcometext --value=$welcometext + ynh_app_setting_set --key=registername --value=$registername + ynh_app_setting_set --key=su_passwd --value=$su_passwd systemctl stop mumble-server dpkg-reconfigure mumble-server --frontend=Noninteractive @@ -67,35 +53,33 @@ fi # Fix SSO issue # https://github.com/YunoHost-Apps/mumbleserver_ynh/issues/19 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 # 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 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 if [ -z "${registername:-}" ]; then 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 fi -#================================================= -# SPECIFIC UPGRADE #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a configuration file..." --weight=1 +ynh_script_progression "Updating configuration..." mkdir -p $install_dir -ynh_add_config --template="mumble-server.ini" --destination="$install_dir/mumble-server.ini" - -chmod -R 770 "$install_dir" -chown -R :mumble-server "$install_dir" +ynh_config_add --template="mumble-server.ini" --destination="$install_dir/mumble-server.ini" +#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 #================================================= @@ -120,10 +104,10 @@ systemctl disable mumble-server --quiet #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 +ynh_script_progression "Upgrading systemd configuration..." # Create a dedicated systemd config -ynh_add_systemd_config +ynh_config_add_systemd # Add Mumble as a YunoHost service 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 #================================================= -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 #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed"