diff --git a/manifest.json b/manifest.json index 34040ba..3974e8b 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "gofannon@riseup.net" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.1.7" }, "multi_instance": true, "services": [ @@ -25,29 +25,17 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for Airsonic", - "fr": "Choisissez un nom de domaine pour Airsonic" - }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for Airsonic", - "fr": "Choisissez un chemin pour Airsonic" - }, "example": "/airsonic", "default": "/airsonic" }, { "name": "admin", "type": "user", - "ask": { - "en": "Choose an admin user", - "fr": "Choisissez l’administrateur" - }, "help": { "en": "This user will have full control on this application and will be able to configure it.", "fr": "Cet utilisateur aura le controle total de l'application et pourra la configurer." @@ -57,10 +45,6 @@ { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "default": true } ] diff --git a/pull_request_template.md b/pull_request_template.md index 5379a23..6c28fc5 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -11,12 +11,6 @@ - [ ] Upgrade from last version tested. - [ ] Can be reviewed and tested. -## Validation +## Package_check results --- -- [ ] **Code review** -- [ ] **Approval (LGTM)** -*Code review and approval have to be from a member of @YunoHost/apps group* -- **CI succeeded** : -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/airsonic_ynh%20PR-NUM-/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/airsonic_ynh%20PR-NUM-/) -*Please replace '-NUM-' in this link by the PR number.* -When the PR is marked as ready to merge, you have to wait for 3 days before really merging it. +* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/install b/scripts/install index 0767a45..8cce68f 100644 --- a/scripts/install +++ b/scripts/install @@ -49,7 +49,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin -ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # STANDARD MODIFICATIONS @@ -156,27 +155,23 @@ ynh_add_systemd_config #================================================= # Path of the systemd service configuration -service_config="/etc/default/$app" +# service_config="/etc/default/$app" -ynh_app_setting_set --app=$app --key=service_config --value=$service_config +# ynh_app_setting_set --app=$app --key=service_config --value=$service_config # Copy config. template to right location -cp ../conf/systemd-sysconfig $service_config +# cp ../conf/systemd-sysconfig $service_config -ynh_replace_string --match_string="__FINALPATH__" --replace_string=$final_path --target_file="$service_config" -ynh_replace_string --match_string="__PORT__" --replace_string=$port --target_file="$service_config" -ynh_replace_string --match_string="__PATH__" --replace_string=$path_url --target_file="$service_config" +# ynh_replace_string --match_string="__FINALPATH__" --replace_string=$final_path --target_file="$service_config" +# ynh_replace_string --match_string="__PORT__" --replace_string=$port --target_file="$service_config" +# ynh_replace_string --match_string="__PATH__" --replace_string=$path_url --target_file="$service_config" + +ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/default/$app" # Copy configuration file of airsonic cp ../conf/airsonic.properties $final_path/airsonic.properties - -#================================================= -# STORE THE CONFIG FILES CHECKSUM -#================================================= - # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="$final_path/airsonic.properties" -ynh_store_file_checksum --file="$service_config" #================================================= # GENERIC FINALIZATION @@ -207,21 +202,20 @@ yunohost service add $app --description="Airsonic daemon" --log="$final_path/$ap ynh_script_progression --message="Starting a systemd service..." --weight=12 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/$app.log" --line_match="Started Application in" +ynh_systemd_action --service_name=$app --action=start --log_path="$final_path/$app.log" --line_match="Started Application in" #================================================= # SETUP APPLICATION WITH CURL #================================================= -ynh_script_progression --message="Configuring SSOwat..." --weight=1 # Set the app as temporarily public for curl call -ynh_app_setting_set --app=$app --key=skipped_uris --value="/" -# Reload SSOwat config -yunohost app ssowatconf +ynh_permission_update --permission="main" --add="visitors" # Reload Nginx ynh_systemd_action --service_name=nginx --action=reload +ynh_script_progression --message="Finalizing installation..." --weight=10 + mailadmin=$(ynh_user_get_info --username=$admin --key=mail) #http://www.subsonic.org/pages/api.jsp @@ -250,12 +244,6 @@ token=$(echo -n $passwordAdmin$salt | md5sum | awk '{print $1}') ynh_local_curl "/rest/createUser.view" "u=admin" "t=$token" "s=$salt" "username=$admin" "password=a" "v=$VERSION" "c=myapp" "email=$mailadmin" "adminRole=Yes" "ldapAuthenticated=Yes" "settingsRole=Yes" "streamRole=Yes" "jukeboxRole=Yes" "downloadRole=Yes" "uploadRole=Yes" "playlistRole=Yes" "coverArtRole=Yes" "commentRole=Yes" "podcastRole=Yes" "shareRole=Yes" "videoConversionRole=Yes" -# Remove the public access -if [ $is_public -eq 0 ] -then - ynh_app_setting_delete --app=$app --key=skipped_uris -fi - #================================================= # USE MULTIMEDIA #================================================= @@ -272,13 +260,12 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/ #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --weight=2 +ynh_script_progression --message="Configuring permissions..." --weight=1 -# Make app public if necessary -if [ $is_public -eq 1 ] +# Make app public if necessary or protect it +if [ $is_public -eq 0 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + ynh_permission_update --permission="main" --remove="visitors" fi #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2b42959..bd9a225 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,9 +20,8 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=admin) is_public=$(ynh_app_setting_get --app=$app --key=is_public) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) -service_config=$(ynh_app_setting_get --app=$app --key=service_config) +#service_config=$(ynh_app_setting_get --app=$app --key=service_config) #================================================= # CHECK VERSION @@ -35,25 +34,23 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 -fi - # If final_path doesn't exist, create it if [ -z "$final_path" ]; then final_path=/opt/yunohost/$app ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi -# If service_config doesn't exist, create it -if [ -z "$service_config" ]; then - service_config="/etc/default/$app" - ynh_app_setting_set --app=$app --key=service_config --value=$service_config +# # If service_config doesn't exist, create it +# if [ -z "$service_config" ]; then +# service_config="/etc/default/$app" +# ynh_app_setting_set --app=$app --key=service_config --value=$service_config +# fi + +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public fi #================================================= @@ -200,14 +197,16 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config -ynh_backup_if_checksum_is_different --file="$service_config" +# ynh_backup_if_checksum_is_different --file="$service_config" -# Copy config. template to right location -cp ../conf/systemd-sysconfig $service_config +# # Copy config. template to right location +# cp ../conf/systemd-sysconfig $service_config -ynh_replace_string --match_string="__FINALPATH__" --replace_string=$final_path --target_file="$service_config" -ynh_replace_string --match_string="__PORT__" --replace_string=$port --target_file="$service_config" -ynh_replace_string --match_string="__PATH__" --replace_string=$path_url --target_file="$service_config" +# ynh_replace_string --match_string="__FINALPATH__" --replace_string=$final_path --target_file="$service_config" +# ynh_replace_string --match_string="__PORT__" --replace_string=$port --target_file="$service_config" +# ynh_replace_string --match_string="__PATH__" --replace_string=$path_url --target_file="$service_config" + +ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/default/$app" #================================================= # GENERIC FINALIZATION @@ -224,18 +223,6 @@ chown -R $app: $final_path yunohost service add $app --description="Airsonic daemon" --log="$final_path/$app.log" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1 - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -fi - #================================================= # START SYSTEMD SERVICE #=================================================