From 5826b7df7436bc4a0738dec13c13c9a939c9395f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 19 Jun 2022 23:11:36 +0200 Subject: [PATCH 01/15] Apply last example_ynh --- check_process | 7 +-- conf/app.conf | 6 +- conf/nginx.conf | 69 +++++++++-------------- conf/raspberry.conf | 1 + manifest.json | 2 +- scripts/_common.sh | 3 +- scripts/backup | 11 ++-- scripts/change_url | 11 ++-- scripts/install | 131 +++++++++++++++++++++++--------------------- scripts/remove | 21 +++---- scripts/restore | 61 ++++++++++++--------- scripts/upgrade | 99 +++++++++++++++++---------------- 12 files changed, 209 insertions(+), 213 deletions(-) diff --git a/check_process b/check_process index 0bbceb1..c07d3b6 100644 --- a/check_process +++ b/check_process @@ -1,9 +1,9 @@ - ;; Test complet ; Manifest domain="domain.tld" path="/path" is_public=1 + mpd_ext=1 ; Checks pkg_linter=1 setup_sub_dir=1 @@ -15,11 +15,8 @@ upgrade=1 from_commit=bc421d01d57a273a59287cf7500e94a89de0abed backup_restore=1 multi_instance=0 + port_already_use=0 change_url=1 ;;; Options Email= Notification=none -;;; Upgrade options - ; commit=CommitHash - name=Name and date of the commit. - manifest_arg=domain=DOMAIN&path=PATH&is_public=1 diff --git a/conf/app.conf b/conf/app.conf index 3b5185a..9b97374 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -2,9 +2,9 @@ # http://docs.mopidy.com/ [core] -cache_dir = __CACHE_DIR__ +$datadir/cache = __DATADIR__/cache #config_dir = -data_dir = __DATA_DIR__ +$datadir/data = __DATADIR__/data #max_tracklist_length = 10000 #restore_state = false @@ -168,7 +168,7 @@ retries = 3 [podcast] enabled = true -browse_root = __DATA_DIR__/podcast/bbc.opml +browse_root = __DATADIR__/data/podcast/bbc.opml #browse_order = desc #lookup_order = asc #cache_size = 64 diff --git a/conf/nginx.conf b/conf/nginx.conf index 72f345f..5734e05 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,56 +1,41 @@ location /mopidy/ws { - - proxy_pass http://localhost:__PORT__; - proxy_http_version 1.1; - proxy_set_header Host $host; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - proxy_read_timeout 604800; - proxy_send_timeout 604800; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_pass http://localhost:__PORT__; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_read_timeout 604800; + proxy_send_timeout 604800; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location __PATH__/ { - - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - - proxy_pass http://localhost:__PORT__/musicbox_webclient/; - proxy_http_version 1.1; - proxy_set_header Host $host; - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + proxy_pass http://localhost:__PORT__/musicbox_webclient/; + proxy_http_version 1.1; + proxy_set_header Host $host; + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } location /musicbox_webclient/ { - - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - - proxy_pass http://localhost:__PORT__; - proxy_http_version 1.1; - proxy_set_header Host $host; - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + proxy_pass http://localhost:__PORT__; + proxy_http_version 1.1; + proxy_set_header Host $host; + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } location /local/ { - - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - - proxy_pass http://localhost:__PORT__; - proxy_http_version 1.1; - proxy_set_header Host $host; - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + proxy_pass http://localhost:__PORT__; + proxy_http_version 1.1; + proxy_set_header Host $host; + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } diff --git a/conf/raspberry.conf b/conf/raspberry.conf index 9fe65a0..a07007d 100644 --- a/conf/raspberry.conf +++ b/conf/raspberry.conf @@ -5,3 +5,4 @@ bcm5 = play_pause,active_low,250 bcm6 = volume_down,active_low,250 bcm16 = next,active_low,250 bcm20 = volume_up,active_low,250 + diff --git a/manifest.json b/manifest.json index aa7099c..f263ba4 100644 --- a/manifest.json +++ b/manifest.json @@ -31,7 +31,7 @@ "nginx" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", "type": "domain" diff --git a/scripts/_common.sh b/scripts/_common.sh index dca0a40..eab697a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,12 +3,13 @@ #================================================= # COMMON VARIABLES #================================================= + # dependencies used by the app pkg_dependencies="acl build-essential python3-dev python3-pip python3-venv git postgresql postgresql-contrib \ gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly lsb-base \ python3-gst-1.0 python3-tornado debconf python3-pkg-resources python3-pykka python3-requests \ gstreamer1.0-alsa gstreamer1.0-pulseaudio gstreamer1.0-tools" - + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 23a3c57..d621689 100755 --- a/scripts/backup +++ b/scripts/backup @@ -26,11 +26,10 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) -work_dir=$(ynh_app_setting_get --app=$app --key=work_dir) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) # other variables media_dir="/home/yunohost.multimedia/share/Music" -work_dir="/home/yunohost.app/$app" cmd_file="/usr/local/bin/mopidyctl" #================================================= @@ -44,6 +43,12 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" +#================================================= +# BACKUP THE DATA DIR +#================================================= + +ynh_backup --src_path="$datadir" + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= @@ -62,8 +67,6 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" # BACKUP VARIOUS FILES #================================================= -ynh_backup --src_path=$work_dir - ynh_backup --src_path="$cmd_file" #================================================= diff --git a/scripts/change_url b/scripts/change_url index 17c0993..51c89ef 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,6 +28,9 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=path) +y=final_path) + +# Add settings here as needed by your application port=$(ynh_app_setting_get --app=$app --key=port) #================================================= @@ -94,7 +97,6 @@ fi # Change the domain for NGINX if [ $change_domain -eq 1 ] then - # Delete file checksum for the old conf file location ynh_delete_file_checksum --file="$nginx_conf_path" mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf @@ -107,12 +109,6 @@ then ynh_permission_url --permission="main" --add_url="$new_domain/musicbox_webclient" --remove_url="$old_domain/musicbox_webclient" fi -#================================================= -# SPECIFIC MODIFICATIONS -#================================================= -# ... -#================================================= - #================================================= # GENERIC FINALISATION #================================================= @@ -121,6 +117,7 @@ fi ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" + #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/install b/scripts/install index 53189b8..350ec9a 100755 --- a/scripts/install +++ b/scripts/install @@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -27,18 +30,12 @@ mpd_port=$YNH_APP_ARG_MPD_EXT app=$YNH_APP_INSTANCE_NAME -# other variables -final_path="/opt/yunohost/$app" -media_dir="/home/yunohost.multimedia/share/Music" -work_dir="/home/yunohost.app/$app" -conf_file="$final_path/$app.conf" -cmd_file="/usr/local/bin/mopidyctl" - #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= ynh_script_progression --message="Validating installation parameters..." +final_path=/opt/yunohost/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path @@ -86,17 +83,20 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Configuring system user..." # Create a system user -ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell --groups="audio" +ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell --groups="audio" #================================================= # INSTALL MOPIDY IN PYTHON ENVIRONMENT #================================================= ynh_script_progression --message="Install in Python environment..." --weight=30 +ynh_app_setting_set --app=$app --key=final_path --value=$final_path myynh_install patch -u $final_path/env/lib/python$python_version/site-packages/mopidy/__main__.py -i ../sources/patches/__main__.patch --forward -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # NGINX CONFIGURATION @@ -107,15 +107,38 @@ ynh_script_progression --message="Configuring NGINX web server..." ynh_add_nginx_config #================================================= -# CREATE YUNOHOST DIRECTORIES +# SPECIFIC SETUP +#================================================= +# ... #================================================= -ynh_script_progression --message="Creating YunoHost directories..." ynh_multimedia_build_main_dir # /home/yunohost.multimedia -mkdir -p "$work_dir/data" # /home/yunohost.app/mopidy/data -mkdir -p "$work_dir/cache" # /home/yunohost.app/mopidy/cache -chown -R $app: "$work_dir" +#================================================= +# CREATE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Creating a data directory..." + +datadir=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=datadir --value=$datadir + +mkdir -p $datadir +mkdir -p "$datadir/data" # /home/yunohost.app/mopidy/data +mkdir -p "$datadir/cache" # /home/yunohost.app/mopidy/cache + +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:www-data "$datadir" + +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." + +ynh_add_config --template="../conf/app.conf" --destination="$final_path/$app.conf" + +chmod 400 "$final_path/$app.conf" +chown $app:$app "$final_path/$app.conf" #================================================= # SETUP SYSTEMD @@ -123,34 +146,46 @@ chown -R $app: "$work_dir" ynh_script_progression --message="Configuring a systemd service..." # Create a dedicated systemd config - ynh_add_systemd_config #================================================= -# MODIFY A CONFIG FILE +# PROVIDE ADDITIONAL SHELL COMAND #================================================= -ynh_script_progression --message="Setup config file..." +ynh_script_progression --message="Provide additional shell command..." -cache_dir=$work_dir/cache -data_dir=$work_dir/data +cmd_file="/usr/local/bin/mopidyctl" +ynh_add_config --template="../sources/extra_files/mopidyctl" --destination="$cmd_file" -ynh_add_config --template="../conf/app.conf" --destination="$conf_file" +chmod +x "$cmd_file" #================================================= -# STORE THE CONFIG FILE CHECKSUM +# PROVIDE EXAMPLES #================================================= -ynh_store_file_checksum --file="$conf_file" +media_dir="/home/yunohost.multimedia/share/Music" + +# provide example m3u-playlist +mkdir -p "$datadir/data/m3u/" +cp -a ../sources/extra_files/radio_international.m3u "$datadir/data/m3u/radio_international.m3u" + +#provide example podcasts +mkdir -p "$datadir/data/podcast" +cp -a ../sources/extra_files/bbc.opml "$datadir/data/podcast/bbc.opml" + +#provide example local music file +if [ "$(ls -A "$media_dir" 2> /dev/null)" == "" ]; then # copy example.mp3 to mediadir if empty (for test purpose) + cp -a ../sources/extra_files/Tryad_Beauty.mp3 "$media_dir" +fi + +#================================================= +# SCAN LOCAL MEDIA DIRECTORY +#================================================= +ynh_script_progression --message="Scan local media directory..." + +"$cmd_file" local scan 2>&1 #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= @@ -176,7 +211,10 @@ ynh_systemd_action --service_name=$app --action="start" ynh_script_progression --message="Configuring permissions..." # Make app public if necessary -if [ $is_public -eq 1 ]; then +if [ $is_public -eq 1 ] +then + # Everyone can access the app. + # The "main" permission is automatically created before the install script. ynh_permission_update --permission="main" --add="visitors" fi @@ -191,39 +229,6 @@ ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload -#================================================= -# PROVIDE ADDITIONAL SHELL COMAND -#================================================= -ynh_script_progression --message="Provide additional shell command..." - -ynh_add_config --template="../sources/extra_files/mopidyctl" --destination="$cmd_file" - -chmod +x "$cmd_file" - -#================================================= -# PROVIDE EXAMPLES -#================================================= - -# provide example m3u-playlist -mkdir -p "$work_dir/data/m3u/" -cp -a ../sources/extra_files/radio_international.m3u "$work_dir/data/m3u/radio_international.m3u" - -#provide example podcasts -mkdir -p "$work_dir/data/podcast" -cp -a ../sources/extra_files/bbc.opml "$work_dir/data/podcast/bbc.opml" - -#provide example local music file -if [ "$(ls -A "$media_dir" 2> /dev/null)" == "" ]; then # copy example.mp3 to mediadir if empty (for test purpose) - cp -a ../sources/extra_files/Tryad_Beauty.mp3 "$media_dir" -fi - -#================================================= -# SCAN LOCAL MEDIA DIRECTORY -#================================================= -ynh_script_progression --message="Scan local media directory..." - -"$cmd_file" local scan 2>&1 - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index c3ff50c..ef25839 100755 --- a/scripts/remove +++ b/scripts/remove @@ -17,12 +17,13 @@ ynh_script_progression --message="Loading installation settings..." --weight=4 app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) -mpd_port=$(ynh_app_setting_get --app=$app --key=mpd_port) port=$(ynh_app_setting_get --app=$app --key=port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +mpd_port=$(ynh_app_setting_get --app=$app --key=mpd_port) # other variables cmd_file="/usr/local/bin/mopidyctl" + #================================================= # STANDARD REMOVE #================================================= @@ -44,14 +45,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=42 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= @@ -68,6 +61,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=42 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # CLOSE A PORT #================================================= @@ -82,8 +83,8 @@ fi #================================================= # REMOVE VARIOUS FILES #================================================= +ynh_script_progression --message="Removing various files..." -# Remove a cron file ynh_secure_remove --file="$cmd_file" #================================================= diff --git a/scripts/restore b/scripts/restore index 782f58b..bc6e61e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -31,7 +31,6 @@ mpd_port=$(ynh_app_setting_get --app=$app --key=mpd_port) # other variables media_dir="/home/yunohost.multimedia/share/Music" -work_dir="/home/yunohost.app/$app" cmd_file="/usr/local/bin/mopidyctl" #================================================= @@ -39,23 +38,18 @@ cmd_file="/usr/local/bin/mopidyctl" #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=3 -test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " +test ! -d $final_path \ + || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell --groups="audio" +ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell --groups="audio" #================================================= # RESTORE THE APP MAIN DIR @@ -64,18 +58,40 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$final_path" -#================================================= -# RESTORE USER RIGHTS -#================================================= - -# Restore permissions on app files - chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# RESTORE THE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Restoring the data directory..." + +ynh_restore_file --origin_path="$datadir" --not_mandatory + +mkdir -p $datadir + +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:www-data "$datadir" + #================================================= # SPECIFIC RESTORATION +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=50 + +# Define and install dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies + +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # OPEN PORT #================================================= @@ -86,12 +102,11 @@ if [ $mpd_port -ne 0 ]; then fi #================================================= -# REINSTALL DEPENDENCIES +# RESTORE VARIOUS FILES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=50 +ynh_script_progression --message="Restoring various files..." -# Define and install dependencies -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_restore_file --origin_path="$cmd_file" # /usr/local/bin/mopidyctl #================================================= # RESTORE SYSTEMD @@ -112,14 +127,6 @@ else yunohost service add $app --description="Mopidy music server" --log="/var/log/$app/$app.log" fi -#================================================= -# RESTORE VARIOUS FILES -#================================================= - -ynh_restore_file --origin_path="$work_dir" # /home/yunohost.app/mopidy - -ynh_restore_file --origin_path="$cmd_file" # /usr/local/bin/mopidyctl - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c731d92..4dc486a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -5,6 +5,7 @@ #================================================= # IMPORT GENERIC HELPERS #================================================= + source _common.sh source /usr/share/yunohost/helpers @@ -20,42 +21,19 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) mpd_port=$(ynh_app_setting_get --app=$app --key=mpd_port) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) # other variables media_dir="/home/yunohost.multimedia/share/Music" -work_dir="/home/yunohost.app/$app" -conf_file="$final_path/$app.conf" cmd_file="/usr/local/bin/mopidyctl" #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -#ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# -# N.B. : the followings setting migrations snippets are provided as *EXAMPLES* -# of what you may want to do in some cases (e.g. a setting was not defined on -# some legacy installs and you therefore want to initiaze stuff during upgrade) -# - -# If mpd_port doesn't exist, create it -if [ -z "$mpd_port" ]; then - mpd_port=0 - ynh_app_setting_set --app=$app --key=mpd_port --value=$mpd_port -fi - -if [ $mpd_port -eq 0 ]; then - mpd_state="false" -else - mpd_state="true" -fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -79,13 +57,30 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# If mpd_port doesn't exist, create it +if [ -z "$mpd_port" ]; then + mpd_port=0 + ynh_app_setting_set --app=$app --key=mpd_port --value=$mpd_port +fi + +if [ $mpd_port -eq 0 ]; then + mpd_state="false" +else + mpd_state="true" +fi + #================================================= # CREATE DEDICATED USER #================================================= ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) -ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell --groups="audio" +ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell --groups="audio" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -93,6 +88,7 @@ ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell -- if [ "$upgrade_type" == "UPGRADE_APP" ] then + ynh_script_progression --message="Upgrading source files..." myynh_install fi @@ -100,6 +96,13 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=11 + +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies + #================================================= # NGINX CONFIGURATION #================================================= @@ -108,15 +111,27 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=11 - -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - #================================================= # SPECIFIC UPGRADE +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." + +ynh_add_config --template="../conf/app.conf" --destination="$final_path/$app.conf" + +chmod 400 "$final_path/some_config_file" +chown $app:$app "$final_path/some_config_file" + +#================================================= +# PROVIDE ADDITIONAL SHELL COMAND +#================================================= +ynh_script_progression --message="Provide additional shell comand..." + +ynh_add_config --template="../sources/extra_files/mopidyctl" --destination="$cmd_file" + +chmod +x "$cmd_file" + #================================================= # SETUP SYSTEMD #================================================= @@ -126,14 +141,7 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=3 ynh_add_systemd_config #================================================= -# MODIFY A CONFIG FILE -#================================================= - -cache_dir=$work_dir/cache -data_dir=$work_dir/data - -ynh_add_config --template="../conf/app.conf" --destination="$conf_file" - +# GENERIC FINALIZATION #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= @@ -159,15 +167,6 @@ ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload -#================================================= -# PROVIDE ADDITIONAL SHELL COMAND -#================================================= -ynh_script_progression --message="Provide additional shell comand..." - -ynh_add_config --template="../sources/extra_files/mopidyctl" --destination="$cmd_file" - -chmod +x "$cmd_file" - #================================================= # END OF SCRIPT #================================================= From b0baac25a794948fa3576adb8f2ad3f722f563e9 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 19 Jun 2022 21:11:42 +0000 Subject: [PATCH 02/15] Auto-update README --- README.md | 21 ++++++++++----------- README_fr.md | 27 +++++++++++++++------------ 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 9600a7f..983b7a5 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # Mopidy for YunoHost -[![Integration level](https://dash.yunohost.org/integration/mopidy.svg)](https://dash.yunohost.org/appci/app/mopidy) ![](https://ci-apps.yunohost.org/ci/badges/mopidy.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/mopidy.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/mopidy.svg)](https://dash.yunohost.org/appci/app/mopidy) ![Working status](https://ci-apps.yunohost.org/ci/badges/mopidy.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/mopidy.maintain.svg) [![Install Mopidy with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mopidy) *[Lire ce readme en français.](./README_fr.md)* @@ -19,11 +19,9 @@ Play music, podcasts and radio programs from local disk and various streaming se **Shipped version:** 3.2.0~ynh1 - - ## Screenshots -![](./doc/screenshots/mopidy_screenshot1.png) +![Screenshot of Mopidy](./doc/screenshots/mopidy_screenshot1.png) ## Disclaimers / important information @@ -44,21 +42,22 @@ Play music, podcasts and radio programs from local disk and various streaming se ## Documentation and resources -* Official app website: https://www.mopidy.com -* Official admin documentation: https://docs.mopidy.com/en/latest -* Upstream app code repository: https://github.com/mopidy/mopidy -* YunoHost documentation for this app: https://yunohost.org/app_mopidy -* Report a bug: https://github.com/YunoHost-Apps/mopidy_ynh/issues +* Official app website: +* Official admin documentation: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/mopidy_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/mopidy_ynh/tree/testing --debug or sudo yunohost app upgrade mopidy -u https://github.com/YunoHost-Apps/mopidy_ynh/tree/testing --debug ``` -**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index 9778275..b14aed2 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,10 +1,14 @@ + + # Mopidy pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/mopidy.svg)](https://dash.yunohost.org/appci/app/mopidy) ![](https://ci-apps.yunohost.org/ci/badges/mopidy.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/mopidy.maintain.svg) +[![Niveau d'intégration](https://dash.yunohost.org/integration/mopidy.svg)](https://dash.yunohost.org/appci/app/mopidy) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/mopidy.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/mopidy.maintain.svg) [![Installer Mopidy avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mopidy) *[Read this readme in english.](./README.md)* -*[Lire ce readme en français.](./README_fr.md)* > *Ce package vous permet d'installer Mopidy rapidement et simplement sur un serveur YunoHost. Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* @@ -15,11 +19,9 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour **Version incluse :** 3.2.0~ynh1 - - ## Captures d'écran -![](./doc/screenshots/mopidy_screenshot1.png) +![Capture d'écran de Mopidy](./doc/screenshots/mopidy_screenshot1.png) ## Avertissements / informations importantes @@ -40,21 +42,22 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour ## Documentations et ressources -* Site officiel de l'app : https://www.mopidy.com -* Documentation officielle de l'admin : https://docs.mopidy.com/en/latest -* Dépôt de code officiel de l'app : https://github.com/mopidy/mopidy -* Documentation YunoHost pour cette app : https://yunohost.org/app_mopidy -* Signaler un bug : https://github.com/YunoHost-Apps/mopidy_ynh/issues +* Site officiel de l'app : +* Documentation officielle de l'admin : +* Dépôt de code officiel de l'app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/mopidy_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/mopidy_ynh/tree/testing --debug ou sudo yunohost app upgrade mopidy -u https://github.com/YunoHost-Apps/mopidy_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d'infos sur le packaging d'applications :** From a8a32fa631d4b3a27d71065089b9c05e8b2482b8 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 19 Jun 2022 23:16:21 +0200 Subject: [PATCH 03/15] Cleanup --- check_process | 3 +++ conf/app.conf | 4 ++-- scripts/change_url | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/check_process b/check_process index c07d3b6..cba90fe 100644 --- a/check_process +++ b/check_process @@ -12,7 +12,10 @@ setup_private=1 setup_public=1 upgrade=1 + # 3.1.1~ynh2 upgrade=1 from_commit=bc421d01d57a273a59287cf7500e94a89de0abed + # 3.2.0~ynh1 + upgrade=1 from_commit=31c5de684273794e4f4837d5dccc5a663ce9fb45 backup_restore=1 multi_instance=0 port_already_use=0 diff --git a/conf/app.conf b/conf/app.conf index 9b97374..1c51c13 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -2,9 +2,9 @@ # http://docs.mopidy.com/ [core] -$datadir/cache = __DATADIR__/cache +cache_dir = __DATADIR__/cache #config_dir = -$datadir/data = __DATADIR__/data +data_dir = __DATADIR__/data #max_tracklist_length = 10000 #restore_state = false diff --git a/scripts/change_url b/scripts/change_url index 51c89ef..702a5d2 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,7 +28,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=path) -y=final_path) # Add settings here as needed by your application port=$(ynh_app_setting_get --app=$app --key=port) From 411a558ebab99be9422a1d791fb169d73e656004 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 19 Jun 2022 23:29:30 +0200 Subject: [PATCH 04/15] More fixes --- scripts/backup | 8 ++------ scripts/install | 10 ++++++---- scripts/restore | 6 +----- scripts/upgrade | 1 + 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/scripts/backup b/scripts/backup index d621689..610ad7e 100755 --- a/scripts/backup +++ b/scripts/backup @@ -28,10 +28,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) datadir=$(ynh_app_setting_get --app=$app --key=datadir) -# other variables -media_dir="/home/yunohost.multimedia/share/Music" -cmd_file="/usr/local/bin/mopidyctl" - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= @@ -47,7 +43,7 @@ ynh_backup --src_path="$final_path" # BACKUP THE DATA DIR #================================================= -ynh_backup --src_path="$datadir" +ynh_backup --src_path="$datadir" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION @@ -67,7 +63,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" # BACKUP VARIOUS FILES #================================================= -ynh_backup --src_path="$cmd_file" +ynh_backup --src_path="/usr/local/bin/mopidyctl" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 350ec9a..a543c58 100755 --- a/scripts/install +++ b/scripts/install @@ -61,15 +61,15 @@ port=$(ynh_find_port --port=6680) ynh_app_setting_set --app=$app --key=port --value=$port if [ $mpd_port -eq 1 ]; then - mpd_port=$(ynh_find_port --port=6600) + mpd_port=6600 + ynh_app_setting_set --app=$app --key=mpd_port --value=$mpd_port + ynh_port_available --port=$mpd_port || ynh_die --message="Port $mpd_port is needs to be available for this app" ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $mpd_port mpd_state="true" else mpd_state="false" fi -ynh_app_setting_set --app=$app --key=mpd_port --value=$mpd_port - #================================================= # INSTALL DEPENDENCIES #================================================= @@ -109,9 +109,11 @@ ynh_add_nginx_config #================================================= # SPECIFIC SETUP #================================================= -# ... +# BUILD MULTIMEDIA #================================================= +ynh_script_progression --message="Building multimedia directory..." +media_dir="/home/yunohost.multimedia/share/Music" ynh_multimedia_build_main_dir # /home/yunohost.multimedia #================================================= diff --git a/scripts/restore b/scripts/restore index bc6e61e..455ad05 100755 --- a/scripts/restore +++ b/scripts/restore @@ -29,10 +29,6 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) mpd_port=$(ynh_app_setting_get --app=$app --key=mpd_port) -# other variables -media_dir="/home/yunohost.multimedia/share/Music" -cmd_file="/usr/local/bin/mopidyctl" - #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= @@ -106,7 +102,7 @@ fi #================================================= ynh_script_progression --message="Restoring various files..." -ynh_restore_file --origin_path="$cmd_file" # /usr/local/bin/mopidyctl +ynh_restore_file --origin_path="/usr/local/bin/mopidyctl" # /usr/local/bin/mopidyctl #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index 4dc486a..bb00cdb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -118,6 +118,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Updating a configuration file..." +media_dir="/home/yunohost.multimedia/share/Music" ynh_add_config --template="../conf/app.conf" --destination="$final_path/$app.conf" chmod 400 "$final_path/some_config_file" From 09bd911d67ef13041a6b44355987d43c9a3b8706 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 19 Jun 2022 23:36:56 +0200 Subject: [PATCH 05/15] cleanup --- scripts/_common.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index eab697a..37da236 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,9 +6,9 @@ # dependencies used by the app pkg_dependencies="acl build-essential python3-dev python3-pip python3-venv git postgresql postgresql-contrib \ - gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly lsb-base \ - python3-gst-1.0 python3-tornado debconf python3-pkg-resources python3-pykka python3-requests \ - gstreamer1.0-alsa gstreamer1.0-pulseaudio gstreamer1.0-tools" +gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly lsb-base \ +python3-gst-1.0 python3-tornado debconf python3-pkg-resources python3-pykka python3-requests \ +gstreamer1.0-alsa gstreamer1.0-pulseaudio gstreamer1.0-tools" #================================================= # PERSONAL HELPERS @@ -17,25 +17,24 @@ pkg_dependencies="acl build-essential python3-dev python3-pip python3-venv git p python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)" myynh_install() { - python3 -m venv "${final_path}/env" - chown -R "$app" "$final_path" + python3 -m venv "${final_path}/env" + chown -R "$app" "$final_path" - #run source in a 'sub shell' - ( + #run source in a 'sub shell' + ( set +o nounset source "${final_path}/env/bin/activate" set -o nounset ynh_exec_as $app $final_path/env/bin/pip install --upgrade --no-cache-dir pip - + # to make Gstreamer visible in Python environment $final_path/env/bin/python3 -m pip install vext $final_path/env/bin/python3 -m pip install --no-binary=:all: vext.gi # install essential packages ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy==3.2.0 - - ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-local==3.2.1 - ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-MusicBox-Webclient==3.1.0 + ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-local==3.2.1 + ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-MusicBox-Webclient==3.1.0 ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-YouTube==3.3 ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir mopidy-ytmusic==0.3.0 ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-RadioNet==0.2.2 @@ -43,7 +42,7 @@ myynh_install() { ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-Podcast-iTunes==3.0.0 ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-SoundCloud==3.0.1 ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-MPD==3.1.0 - ) + ) } #================================================= From 4285d593cd367e6e5802dec620c5181aaa57faba Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 20 Jun 2022 00:20:12 +0200 Subject: [PATCH 06/15] cleanup --- scripts/change_url | 2 +- scripts/install | 7 +++---- scripts/remove | 6 ++---- scripts/restore | 4 ++-- scripts/upgrade | 4 ++-- sources/extra_files/mopidyctl | 2 +- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 702a5d2..4cf96d3 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -72,7 +72,7 @@ fi #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="stop" #================================================= # MODIFY URL IN NGINX CONF diff --git a/scripts/install b/scripts/install index a543c58..0d6c64b 100755 --- a/scripts/install +++ b/scripts/install @@ -61,9 +61,8 @@ port=$(ynh_find_port --port=6680) ynh_app_setting_set --app=$app --key=port --value=$port if [ $mpd_port -eq 1 ]; then - mpd_port=6600 + mpd_port=$(ynh_find_port --port=6600) ynh_app_setting_set --app=$app --key=mpd_port --value=$mpd_port - ynh_port_available --port=$mpd_port || ynh_die --message="Port $mpd_port is needs to be available for this app" ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $mpd_port mpd_state="true" else @@ -194,9 +193,9 @@ ynh_script_progression --message="Scan local media directory..." ynh_script_progression --message="Integrating service in YunoHost..." if [ $mpd_port -ne 0 ]; then - yunohost service add $app --description="Mopidy music server" --log="/var/log/$app/$app.log" --needs_exposed_ports=$mpd_port + yunohost service add $app --description="Mopidy music server" --needs_exposed_ports=$mpd_port else - yunohost service add $app --description="Mopidy music server" --log="/var/log/$app/$app.log" + yunohost service add $app --description="Mopidy music server" fi #================================================= diff --git a/scripts/remove b/scripts/remove index ef25839..d78bc55 100755 --- a/scripts/remove +++ b/scripts/remove @@ -21,9 +21,6 @@ port=$(ynh_app_setting_get --app=$app --key=port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) mpd_port=$(ynh_app_setting_get --app=$app --key=mpd_port) -# other variables -cmd_file="/usr/local/bin/mopidyctl" - #================================================= # STANDARD REMOVE #================================================= @@ -78,6 +75,7 @@ then ynh_script_progression --message="Closing port $mpd_port..." --weight=1 ynh_exec_warn_less yunohost firewall disallow TCP $mpd_port fi + #================================================= # SPECIFIC REMOVE #================================================= @@ -85,7 +83,7 @@ fi #================================================= ynh_script_progression --message="Removing various files..." -ynh_secure_remove --file="$cmd_file" +ynh_secure_remove --file="/usr/local/bin/mopidyctl" #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index 455ad05..d7f6f4e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -118,9 +118,9 @@ systemctl enable $app.service --quiet ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 if [ $mpd_port -ne 0 ]; then - yunohost service add $app --description="Mopidy music server" --log="/var/log/$app/$app.log" --needs_exposed_ports=$mpd_port + yunohost service add $app --description="Mopidy music server" --needs_exposed_ports=$mpd_port else - yunohost service add $app --description="Mopidy music server" --log="/var/log/$app/$app.log" + yunohost service add $app --description="Mopidy music server" fi #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index bb00cdb..cab5c5c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -149,9 +149,9 @@ ynh_add_systemd_config ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 if [ $mpd_port -ne 0 ]; then - yunohost service add $app --description="Mopidy music server" --log="/var/log/$app/$app.log" --needs_exposed_ports=$mpd_port + yunohost service add $app --description="Mopidy music server" --needs_exposed_ports=$mpd_port else - yunohost service add $app --description="Mopidy music server" --log="/var/log/$app/$app.log" + yunohost service add $app --description="Mopidy music server" fi #================================================= diff --git a/sources/extra_files/mopidyctl b/sources/extra_files/mopidyctl index 6d8210b..debe6e0 100644 --- a/sources/extra_files/mopidyctl +++ b/sources/extra_files/mopidyctl @@ -3,7 +3,7 @@ SELF=$(basename $0) DAEMON="__FINAL_PATH__/env/bin/mopidy" DAEMON_USER="__APP__" -CONFIG_FILES="__CONF_FILE__" +CONFIG_FILES="__FINAL_PATH__/__APP__.conf" CMD="$DAEMON --config $CONFIG_FILES $@" if [ $# -eq 0 ]; then From 4ab3b1e13eb17b049e4b659fd9f5b8109ec4bb39 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 20 Jun 2022 00:28:59 +0200 Subject: [PATCH 07/15] Update _common.sh --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 37da236..41cd020 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -32,7 +32,7 @@ myynh_install() { $final_path/env/bin/python3 -m pip install --no-binary=:all: vext.gi # install essential packages - ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy==3.2.0 + ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy==$(ynh_app_upstream_version) ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-local==3.2.1 ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-MusicBox-Webclient==3.1.0 ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-YouTube==3.3 From 067a33af8da14c8fe0eeac0b14ea3bf53968b7d3 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 20 Jun 2022 00:30:14 +0200 Subject: [PATCH 08/15] Typo --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 0d6c64b..45d67a5 100755 --- a/scripts/install +++ b/scripts/install @@ -150,7 +150,7 @@ ynh_script_progression --message="Configuring a systemd service..." ynh_add_systemd_config #================================================= -# PROVIDE ADDITIONAL SHELL COMAND +# PROVIDE ADDITIONAL SHELL COMMAND #================================================= ynh_script_progression --message="Provide additional shell command..." diff --git a/scripts/upgrade b/scripts/upgrade index cab5c5c..87a7fe1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -125,7 +125,7 @@ chmod 400 "$final_path/some_config_file" chown $app:$app "$final_path/some_config_file" #================================================= -# PROVIDE ADDITIONAL SHELL COMAND +# PROVIDE ADDITIONAL SHELL COMMAND #================================================= ynh_script_progression --message="Provide additional shell comand..." From 9674bd96958a623dfb861dc7e3a05324f80b42ca Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 20 Jun 2022 00:34:10 +0200 Subject: [PATCH 09/15] Cleanup --- conf/nginx.conf | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 5734e05..4d4b142 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,20 +1,20 @@ location /mopidy/ws { - proxy_pass http://localhost:__PORT__; - proxy_http_version 1.1; - proxy_set_header Host $host; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - proxy_read_timeout 604800; - proxy_send_timeout 604800; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://localhost:__PORT__; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_read_timeout 604800; + proxy_send_timeout 604800; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location __PATH__/ { - proxy_pass http://localhost:__PORT__/musicbox_webclient/; - proxy_http_version 1.1; - proxy_set_header Host $host; + proxy_pass http://localhost:__PORT__/musicbox_webclient/; + proxy_http_version 1.1; + proxy_set_header Host $host; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; @@ -22,9 +22,9 @@ location __PATH__/ { location /musicbox_webclient/ { - proxy_pass http://localhost:__PORT__; - proxy_http_version 1.1; - proxy_set_header Host $host; + proxy_pass http://localhost:__PORT__; + proxy_http_version 1.1; + proxy_set_header Host $host; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; @@ -32,9 +32,9 @@ location /musicbox_webclient/ { location /local/ { - proxy_pass http://localhost:__PORT__; - proxy_http_version 1.1; - proxy_set_header Host $host; + proxy_pass http://localhost:__PORT__; + proxy_http_version 1.1; + proxy_set_header Host $host; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; From 814427ff34108b5ee4144d61148acadb5572edbe Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 20 Jun 2022 00:34:40 +0200 Subject: [PATCH 10/15] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index f263ba4..bc994ed 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Play music, podcasts and radio programs from local disk and various streaming services", "fr": "Écouter de la musique, des podcasts et des programmes radio depuis le disque local et divers services de streaming" }, - "version": "3.2.0~ynh1", + "version": "3.2.0~ynh2", "url": "https://www.mopidy.com", "upstream": { "license": "Apache-2.0", From a113b03218d810519561bee6c3e641b0752ab206 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 19 Jun 2022 22:34:46 +0000 Subject: [PATCH 11/15] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 983b7a5..37a9cdf 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Play music, podcasts and radio programs from local disk and various streaming services -**Shipped version:** 3.2.0~ynh1 +**Shipped version:** 3.2.0~ynh2 ## Screenshots diff --git a/README_fr.md b/README_fr.md index b14aed2..da11eff 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,7 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Écouter de la musique, des podcasts et des programmes radio depuis le disque local et divers services de streaming -**Version incluse :** 3.2.0~ynh1 +**Version incluse :** 3.2.0~ynh2 ## Captures d'écran From 11a81f58e53b4c837738c6d5e61b06a5d6624e1b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 20 Jun 2022 00:39:35 +0200 Subject: [PATCH 12/15] missing datadir --- scripts/upgrade | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 87a7fe1..12ec71f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -74,6 +74,12 @@ else mpd_state="true" fi +# If final_path doesn't exist, create it +if [ -z "$datadir" ]; then + datadir=/home/yunohost.app/$app + ynh_app_setting_set --app=$app --key=datadir --value=$datadir +fi + #================================================= # CREATE DEDICATED USER #================================================= From 72d52378f167a9ea087439b647482a593dc6d68d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 20 Jun 2022 00:42:25 +0200 Subject: [PATCH 13/15] typo --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 12ec71f..df2ad73 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -74,7 +74,7 @@ else mpd_state="true" fi -# If final_path doesn't exist, create it +# If datadir doesn't exist, create it if [ -z "$datadir" ]; then datadir=/home/yunohost.app/$app ynh_app_setting_set --app=$app --key=datadir --value=$datadir From a6404605fddd826048b28eb6dc580a9671ac0b97 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 22 Jun 2022 03:06:22 +0200 Subject: [PATCH 14/15] Fix restore --- scripts/restore | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/restore b/scripts/restore index d7f6f4e..72c6366 100755 --- a/scripts/restore +++ b/scripts/restore @@ -28,6 +28,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) mpd_port=$(ynh_app_setting_get --app=$app --key=mpd_port) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK IF THE APP CAN BE RESTORED From e19f490a52ba50d370cbf2596d836d20cecc041e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 22 Jun 2022 03:07:06 +0200 Subject: [PATCH 15/15] Fix upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index df2ad73..5fd0fa0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -127,8 +127,8 @@ ynh_script_progression --message="Updating a configuration file..." media_dir="/home/yunohost.multimedia/share/Music" ynh_add_config --template="../conf/app.conf" --destination="$final_path/$app.conf" -chmod 400 "$final_path/some_config_file" -chown $app:$app "$final_path/some_config_file" +chmod 400 "$final_path/$app.conf" +chown $app:$app "$final_path/$app.conf" #================================================= # PROVIDE ADDITIONAL SHELL COMMAND