diff --git a/check_process b/check_process index d0c50d7..efd1980 100644 --- a/check_process +++ b/check_process @@ -20,17 +20,7 @@ incorrect_path=0 port_already_use=0 ;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto - # https://github.com/YunoHost-Apps/mumbleserver_ynh/issues/11 - Level 4=1 Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Options Email=jean-baptiste@holcroft.fr Notification=all \ No newline at end of file diff --git a/scripts/_common.sh b/scripts/_common.sh index 7eda170..f37c864 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -80,4 +80,3 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')" # Send the email to the recipients echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients" } - diff --git a/scripts/backup b/scripts/backup index 1f89b94..68b7974 100644 --- a/scripts/backup +++ b/scripts/backup @@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= diff --git a/scripts/install b/scripts/install index b54b615..8bcb77e 100644 --- a/scripts/install +++ b/scripts/install @@ -35,6 +35,7 @@ su_passwd=$(ynh_string_random) #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= +ynh_script_progression --message="Validating installation parameters..." --weight=1 final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -42,6 +43,7 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder" #================================================= # STORE SETTINGS FROM MANIFEST #================================================= +ynh_script_progression --message="Storing installation settings..." --weight=2 # Save app settings ynh_app_setting_set --app=$app --key=domain --value="$domain" @@ -57,6 +59,7 @@ ynh_app_setting_set --app=$app --key=instance_id --value="$instance_id" #================================================= # FIND AND OPEN A PORT #================================================= +ynh_script_progression --message="Configuring firewall..." --weight=1 port=$(ynh_find_port 64738) ynh_app_setting_set --app=$app --key=port --value=$port @@ -67,9 +70,9 @@ yunohost firewall allow Both "$port" #================================================= # INSTALL DEPENDENCIES #================================================= +ynh_script_progression --message="Installing dependencies..." --weight=4 # Install Mumble Debian package via apt - ynh_install_app_dependencies $pkg_dependencies #================================================= @@ -86,13 +89,13 @@ mumble_conf="$final_path/mumble-server.ini" cp ../conf/mumble-server.ini "$mumble_conf" -ynh_replace_string "__FINALPATH__" "$final_path" "$mumble_conf" -ynh_replace_string "__APP__" "$app" "$mumble_conf" -ynh_replace_string "__WELCOME__" "$welcometext" "$mumble_conf" -ynh_replace_string "__PORT__" "$port" "$mumble_conf" -ynh_replace_string "__SRV_PWD__" "$server_password" "$mumble_conf" -ynh_replace_string "__REGISTER__" "$registerName" "$mumble_conf" -ynh_replace_string "__DOMAIN__" "$domain" "$mumble_conf" +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$mumble_conf" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$mumble_conf" +ynh_replace_string --match_string="__WELCOME__" --replace_string="$welcometext" --target_file="$mumble_conf" +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$mumble_conf" +ynh_replace_string --match_string="__SRV_PWD__" --replace_string="$server_password" --target_file="$mumble_conf" +ynh_replace_string --match_string="__REGISTER__" --replace_string="$registerName" --target_file="$mumble_conf" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$mumble_conf" ynh_store_file_checksum "$mumble_conf" diff --git a/scripts/restore b/scripts/restore index cadf1d0..4059be9 100644 --- a/scripts/restore +++ b/scripts/restore @@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= @@ -84,3 +83,10 @@ ynh_restore_file "/etc/systemd/system/$app.service" systemctl enable "$app.service" systemctl restart "$app" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Restoration completed for $app" --last + diff --git a/scripts/upgrade b/scripts/upgrade index d269e51..07489dc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -5,13 +5,14 @@ #================================================= # IMPORT GENERIC HELPERS #================================================= + source _common.sh source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= - +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get "$app" domain) @@ -24,6 +25,12 @@ port=$(ynh_app_setting_get "$app" port) final_path=$(ynh_app_setting_get "$app" final_path) instance_id=$(ynh_app_setting_get "$app" instance_id) +#================================================= +# CHECK VERSION +#================================================= + +upgrade_type=$(ynh_check_app_version_changed) + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -90,10 +97,10 @@ if [ -z "$instance_id" ]; then ynh_app_setting_set "$app" instance_id "$instance_id" fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5 # Backup the current version of the app ynh_backup_before_upgrade @@ -114,9 +121,10 @@ ynh_abort_if_errors #================================================= # INSTALL DEPENDENCIES #================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=6 # Install Mumble Debian package via apt -ynh_install_app_dependencies mumble-server mailutils +ynh_install_app_dependencies $pkg_dependencies #================================================= # SPECIFIC UPGRADE @@ -133,13 +141,13 @@ ynh_backup_if_checksum_is_different "$mumble_conf" cp ../conf/mumble-server.ini "$mumble_conf" -ynh_replace_string "__FINALPATH__" "$final_path" "$mumble_conf" -ynh_replace_string "__APP__" "$app" "$mumble_conf" -ynh_replace_string "__WELCOME__" "$welcometext" "$mumble_conf" -ynh_replace_string "__PORT__" "$port" "$mumble_conf" -ynh_replace_string "__SRV_PWD__" "$server_password" "$mumble_conf" -ynh_replace_string "__REGISTER__" "$registerName" "$mumble_conf" -ynh_replace_string "__DOMAIN__" "$domain" "$mumble_conf" +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$mumble_conf" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$mumble_conf" +ynh_replace_string --match_string="__WELCOME__" --replace_string="$welcometext" --target_file="$mumble_conf" +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$mumble_conf" +ynh_replace_string --match_string="__SRV_PWD__" --replace_string="$server_password" --target_file="$mumble_conf" +ynh_replace_string --match_string="__REGISTER__" --replace_string="$registerName" --target_file="$mumble_conf" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$mumble_conf" ynh_store_file_checksum "$mumble_conf"