mirror of
https://github.com/YunoHost-Apps/airsonic_ynh.git
synced 2024-09-03 18:06:14 +02:00
commit
b2c946a6e3
8 changed files with 64 additions and 71 deletions
|
@ -14,7 +14,7 @@
|
||||||
"email": "gofannon@riseup.net"
|
"email": "gofannon@riseup.net"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 3.8.1"
|
"yunohost": ">= 4.1.7"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
|
@ -25,29 +25,17 @@
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
|
||||||
"en": "Choose a domain name for Airsonic",
|
|
||||||
"fr": "Choisissez un nom de domaine pour Airsonic"
|
|
||||||
},
|
|
||||||
"example": "example.com"
|
"example": "example.com"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"ask": {
|
|
||||||
"en": "Choose a path for Airsonic",
|
|
||||||
"fr": "Choisissez un chemin pour Airsonic"
|
|
||||||
},
|
|
||||||
"example": "/airsonic",
|
"example": "/airsonic",
|
||||||
"default": "/airsonic"
|
"default": "/airsonic"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user",
|
||||||
"ask": {
|
|
||||||
"en": "Choose an admin user",
|
|
||||||
"fr": "Choisissez l’administrateur"
|
|
||||||
},
|
|
||||||
"help": {
|
"help": {
|
||||||
"en": "This user will have full control on this application and will be able to configure it.",
|
"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."
|
"fr": "Cet utilisateur aura le controle total de l'application et pourra la configurer."
|
||||||
|
@ -57,10 +45,6 @@
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"ask": {
|
|
||||||
"en": "Is it a public application?",
|
|
||||||
"fr": "Est-ce une application publique ?"
|
|
||||||
},
|
|
||||||
"default": true
|
"default": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -11,12 +11,6 @@
|
||||||
- [ ] Upgrade from last version tested.
|
- [ ] Upgrade from last version tested.
|
||||||
- [ ] Can be reviewed and tested.
|
- [ ] Can be reviewed and tested.
|
||||||
|
|
||||||
## Validation
|
|
||||||
---
|
|
||||||
- [ ] **Code review**
|
|
||||||
- [ ] **Approval (LGTM)**
|
|
||||||
*Code review and approval have to be from a member of @YunoHost/apps group*
|
|
||||||
|
|
||||||
## Package_check results
|
## Package_check results
|
||||||
---
|
---
|
||||||
* 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!"*
|
* 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!"*
|
||||||
|
|
|
@ -28,7 +28,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
service_config=$(ynh_app_setting_get --app=$app --key=service_config)
|
#service_config=$(ynh_app_setting_get --app=$app --key=service_config)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
@ -60,7 +60,7 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
ynh_backup --src_path="$service_config"
|
ynh_backup --src_path="/etc/default/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP DATA
|
# BACKUP DATA
|
||||||
|
|
|
@ -28,9 +28,26 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
service_config=$(ynh_app_setting_get --app=$app --key=service_config)
|
# service_config=$(ynh_app_setting_get --app=$app --key=service_config)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1
|
||||||
|
|
||||||
|
# Backup the current version of the app
|
||||||
|
ynh_backup_before_upgrade
|
||||||
|
ynh_clean_setup () {
|
||||||
|
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||||
|
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
|
||||||
|
# Restore it if the upgrade fails
|
||||||
|
ynh_restore_upgradebackup
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -95,14 +112,16 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=3
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_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
|
# 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="__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="__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="__PATH__" --replace_string=$path_url --target_file="$service_config"
|
||||||
|
|
||||||
|
ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/default/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
|
@ -111,7 +130,7 @@ ynh_replace_string --match_string="__PATH__" --replace_string=$path_url --target
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=12
|
ynh_script_progression --message="Starting a systemd service..." --weight=12
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/airsonic.log" --line_match="Started Application in"
|
ynh_systemd_action --service_name=$app --action=start --log_path="$final_path/airsonic.log" --line_match="Started Application in"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
|
|
@ -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=domain --value=$domain
|
||||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
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=admin --value=$admin
|
||||||
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -156,27 +155,23 @@ ynh_add_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Path of the systemd service configuration
|
# 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
|
# 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="__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="__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="__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
|
# Copy configuration file of airsonic
|
||||||
cp ../conf/airsonic.properties $final_path/airsonic.properties
|
cp ../conf/airsonic.properties $final_path/airsonic.properties
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE THE CONFIG FILES CHECKSUM
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
# 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="$final_path/airsonic.properties"
|
||||||
ynh_store_file_checksum --file="$service_config"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -207,7 +202,7 @@ yunohost service add $app --description="Airsonic daemon" --log="$final_path/$ap
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=12
|
ynh_script_progression --message="Starting a systemd service..." --weight=12
|
||||||
|
|
||||||
# Start a systemd service
|
# 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
|
# SETUP APPLICATION WITH CURL
|
||||||
|
@ -219,6 +214,8 @@ ynh_permission_update --permission="main" --add="visitors"
|
||||||
# Reload Nginx
|
# Reload Nginx
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
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)
|
mailadmin=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
|
|
||||||
#http://www.subsonic.org/pages/api.jsp
|
#http://www.subsonic.org/pages/api.jsp
|
||||||
|
|
|
@ -19,7 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
service_config=$(ynh_app_setting_get --app=$app --key=service_config)
|
#service_config=$(ynh_app_setting_get --app=$app --key=service_config)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
@ -80,7 +80,7 @@ ynh_remove_logrotate
|
||||||
# REMOVE FILES
|
# REMOVE FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_secure_remove --file="$service_config"
|
ynh_secure_remove --file="/etc/default/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -30,7 +30,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
service_config=$(ynh_app_setting_get --app=$app --key=service_config)
|
#service_config=$(ynh_app_setting_get --app=$app --key=service_config)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
|
@ -108,7 +108,7 @@ chown $app: $final_path/transcode
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
ynh_restore_file --origin_path="$service_config"
|
ynh_restore_file --origin_path="/etc/default/$app"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable $app.service --quiet
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -20,9 +20,8 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
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)
|
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
|
# CHECK VERSION
|
||||||
|
@ -35,25 +34,23 @@ upgrade_type=$(ynh_check_app_version_changed)
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
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 final_path doesn't exist, create it
|
||||||
if [ -z "$final_path" ]; then
|
if [ -z "$final_path" ]; then
|
||||||
final_path=/opt/yunohost/$app
|
final_path=/opt/yunohost/$app
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If service_config doesn't exist, create it
|
# # If service_config doesn't exist, create it
|
||||||
if [ -z "$service_config" ]; then
|
# if [ -z "$service_config" ]; then
|
||||||
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
|
||||||
|
# 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
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -200,14 +197,16 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_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
|
# # 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="__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="__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="__PATH__" --replace_string=$path_url --target_file="$service_config"
|
||||||
|
|
||||||
|
ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/default/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
Loading…
Add table
Reference in a new issue