From edbfa2b313dc603c524479e6b4f0a9fbfc439047 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 2 Aug 2020 00:00:11 +0200 Subject: [PATCH] clean up --- README.md | 2 +- conf/systemd.service | 4 ++-- scripts/backup | 22 ++++++++++++++-------- scripts/install | 27 +++++++++++++++++---------- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index da8e852..ecf128a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Mumble server package for YunoHost +# Mumble server for YunoHost [![Integration level](https://dash.yunohost.org/integration/mumbleserver.svg)](https://dash.yunohost.org/appci/app/mumbleserver) [![Install with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=mumbleserver) diff --git a/conf/systemd.service b/conf/systemd.service index c2bb296..31275cd 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -4,8 +4,8 @@ Requires=network-online.target After=network.target [Service] -User=mumble-server -Group=mumble-server +User=__APP__ +Group=__APP__ Type=forking # https://www.freedesktop.org/software/systemd/man/systemd.exec.html#RuntimeDirectory= RuntimeDirectory=mumble-server diff --git a/scripts/backup b/scripts/backup index bf8bc99..1f89b94 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,12 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -if [ ! -e _common.sh ]; then - # Get the _common.sh file if it's not in the current directory - cp ../settings/scripts/_common.sh ./_common.sh - chmod a+rx _common.sh -fi -source _common.sh +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= @@ -21,14 +16,19 @@ source /usr/share/yunohost/helpers # Exit if an error occurs during the execution of the script ynh_abort_if_errors - #================================================= # LOAD SETTINGS #================================================= +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get $app final_path) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) + +#================================================= +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." #================================================= # STANDARD BACKUP STEPS @@ -43,3 +43,9 @@ ynh_backup "$final_path" #================================================= 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)." diff --git a/scripts/install b/scripts/install index 3424aa5..b54b615 100644 --- a/scripts/install +++ b/scripts/install @@ -44,13 +44,13 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder" #================================================= # Save app settings -ynh_app_setting_set "$app" domain "$domain" -ynh_app_setting_set "$app" no_sso "true" -ynh_app_setting_set "$app" server_password "$server_password" -ynh_app_setting_set "$app" su_passwd "$su_passwd" -ynh_app_setting_set "$app" welcometext "$welcometext" -ynh_app_setting_set "$app" registerName "$registerName" -ynh_app_setting_set "$app" instance_id "$instance_id" +ynh_app_setting_set --app=$app --key=domain --value="$domain" +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=welcometext --value="$welcometext" +ynh_app_setting_set --app=$app --key=registerName --value="$registerName" +ynh_app_setting_set --app=$app --key=instance_id --value="$instance_id" #================================================= # STANDARD MODIFICATIONS @@ -79,7 +79,7 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= mkdir -p "$final_path" -ynh_app_setting_set "$app" final_path "$final_path" +ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Configuring with given settings mumble_conf="$final_path/mumble-server.ini" @@ -134,11 +134,12 @@ systemctl stop $app systemctl disable $app #================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_script_progression --message="Integrating service in YunoHost..." # Add Mumble as a YunoHost service -yunohost service add "$app" -l "/var/log/mumble-server/$app.log" +yunohost service add $app --description "Mumble server" --log="/var/log/$app/$app.log" systemctl restart "$app" @@ -162,3 +163,9 @@ Are you facing an issue, want to improve this app or say thank you? Please open a new issue in this project: https://github.com/YunoHost-Apps/mumbleserver_ynh " ynh_send_readme_to_admin "$message" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Installation of $app completed" --last