mirror of
https://github.com/YunoHost-Apps/ampache_ynh.git
synced 2024-09-03 18:15:55 +02:00
commit
3f340fceb4
9 changed files with 64 additions and 93 deletions
|
@ -9,7 +9,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
|
|||
## Overview
|
||||
[Ampache](http://ampache.org) for the love of music. A web based audio/video streaming application and file manager allowing you to access your music & videos from anywhere, using almost any internet enabled device.
|
||||
|
||||
**Shipped version:** 4.4.0
|
||||
**Shipped version:** 4.4.1
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
@ -25,7 +25,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
|
|||
## Documentation
|
||||
|
||||
* Official documentation: https://github.com/ampache/ampache/wiki
|
||||
* YunoHost documentation: https://yunohost.org/#/app_ampache
|
||||
* YunoHost documentation: https://yunohost.org/en/app_ampache
|
||||
|
||||
## YunoHost specific features
|
||||
|
||||
|
@ -44,8 +44,8 @@ this package:
|
|||
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/ampache/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/ampache/)
|
||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/ampache/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/ampache/)
|
||||
|
||||
## Limitations
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
upgrade=1 from_commit=919c3359d9fe21c29bad1cabf0e7b9a8e368f20e
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=0
|
||||
|
@ -20,6 +21,6 @@
|
|||
Email=aymhce@gmail.com
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=11caf9791c48fdcd632193a1c82ea52d4819b328
|
||||
name=add ynh_abort_if_errors
|
||||
; commit=919c3359d9fe21c29bad1cabf0e7b9a8e368f20e
|
||||
name=Merge pull request #70 from YunoHost-Apps/4.2.6
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&
|
||||
|
|
|
@ -23,7 +23,7 @@ config_version = 40
|
|||
; If not set, retrieved automatically from client request.
|
||||
; This setting is required for WebSocket server
|
||||
; DEFAULT: ""
|
||||
http_host = "__DOMAINTOCHANGE__"
|
||||
http_host = "__DOMAIN__"
|
||||
|
||||
; The public http port of your server.
|
||||
; If not set, retrieved automatically from client request.
|
||||
|
@ -37,7 +37,7 @@ http_host = "__DOMAINTOCHANGE__"
|
|||
; if it is located at http://localhost/music you need to
|
||||
; set web_path to /music
|
||||
; DEFAULT: ""
|
||||
web_path = "__PATHTOCHANGE__"
|
||||
web_path = "__PATH__"
|
||||
|
||||
; The local http url of your server.
|
||||
; This is used to access the server from within the
|
||||
|
@ -66,17 +66,17 @@ database_hostname = localhost
|
|||
|
||||
; Name of your ampache database
|
||||
; DEFAULT: ampache
|
||||
database_name = "__DBNAME__"
|
||||
database_name = "__DB_NAME__"
|
||||
|
||||
; Username for your ampache database
|
||||
; DEFAULT: ""
|
||||
database_username = "__DBUSER__"
|
||||
database_username = "__DB_USER__"
|
||||
|
||||
; Password for your ampache database, this can not be blank
|
||||
; this is a 'forced' security precaution, the default value
|
||||
; will not work (except if using socket authentication)
|
||||
; DEFAULT: ""
|
||||
database_password = "__DBPWD__"
|
||||
database_password = "__DB_PWD__"
|
||||
|
||||
|
||||
;#########################################################
|
||||
|
@ -85,7 +85,7 @@ database_password = "__DBPWD__"
|
|||
|
||||
; Cryptographic secret
|
||||
; This MUST BE changed with your own secret key. Ampache-specific, just pick any random string you want.
|
||||
secret_key = "__RANDOMKEYTOCHANGE__"
|
||||
secret_key = "__SECRET_KEY__"
|
||||
|
||||
; Length that a session will last expressed in seconds. Default is
|
||||
; one hour.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/ampache/ampache/archive/4.4.0.tar.gz
|
||||
SOURCE_SUM=8b5bbce6ef7c6bc7b70b3e481e66e4e5be0a4d0a6467bf929f5357f08b473bbb
|
||||
SOURCE_URL=https://github.com/ampache/ampache/archive/4.4.1.tar.gz
|
||||
SOURCE_SUM=7ff3f8ae4eb18709adc4b91477d083c0f306cec85183290deedb2aacdf4809e8
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Web based audio/video streaming application",
|
||||
"fr": "Application de streaming audio et vidéo"
|
||||
},
|
||||
"version": "4.4.0~ynh1",
|
||||
"version": "4.4.1~ynh1",
|
||||
"url": "http://ampache.org",
|
||||
"license": "AGPL-3.0",
|
||||
"maintainer": {
|
||||
|
@ -14,7 +14,7 @@
|
|||
"email": "aymhce@gmail.com"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.0.0"
|
||||
"yunohost": ">= 4.1.7"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services" : [
|
||||
|
@ -27,38 +27,22 @@
|
|||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain name for Ampache",
|
||||
"fr": "Choisissez un nom de domaine pour Ampache"
|
||||
},
|
||||
"example": "domain.org"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path for Ampache",
|
||||
"fr": "Choisissez un chemin pour Ampache"
|
||||
},
|
||||
"example": "/ampache",
|
||||
"default": "/ampache"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Choose the Ampache administrator (must be an existing YunoHost user)",
|
||||
"fr": "Administrateur du serveur Ampache (doit être un utilisateur YunoHost existant)"
|
||||
},
|
||||
"example": "homer"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Is it a public application?",
|
||||
"fr": "Est-ce une application publique ?"
|
||||
},
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
|
|
|
@ -29,6 +29,23 @@ ynh_script_progression --message="Loading installation settings..."
|
|||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --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
|
||||
#=================================================
|
||||
|
|
|
@ -46,7 +46,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_ampache
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
|
@ -67,6 +66,14 @@ db_user=$db_name
|
|||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -84,14 +91,6 @@ ynh_script_progression --message="Configuring NGINX web server..."
|
|||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -107,20 +106,10 @@ ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencie
|
|||
#=================================================
|
||||
ynh_script_progression --message="Preconfiguring Ampache..." --weight=2
|
||||
|
||||
conf_file="$final_path/config/ampache.cfg.php"
|
||||
cp ../conf/ampache.cfg.php "$conf_file"
|
||||
|
||||
ynh_replace_string --match_string="__DBUSER__" --replace_string="$db_user" --target_file="$conf_file"
|
||||
ynh_replace_string --match_string="__DBPWD__" --replace_string="$db_pwd" --target_file="$conf_file"
|
||||
ynh_replace_string --match_string="__DBNAME__" --replace_string="$db_name" --target_file="$conf_file"
|
||||
ynh_replace_string --match_string="__PATHTOCHANGE__" --replace_string="$path_url" --target_file="$conf_file"
|
||||
ynh_replace_string --match_string="__DOMAINTOCHANGE__" --replace_string="$domain" --target_file="$conf_file"
|
||||
secret_key=$(ynh_string_random --length=24)
|
||||
ynh_replace_string --match_string="__RANDOMKEYTOCHANGE__" --replace_string="$secret_key" --target_file="$conf_file"
|
||||
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$conf_file"
|
||||
ynh_add_config --template="../conf/ampache.cfg.php" --destination="$final_path/config/ampache.cfg.php"
|
||||
|
||||
#=================================================
|
||||
# LOAD DEFAULT DATABASE
|
||||
|
@ -179,7 +168,8 @@ ynh_secure_remove --file=/tmp/admin.sql
|
|||
ynh_script_progression --message="Securing files and directories..."
|
||||
|
||||
# Set permissions to ampache directory
|
||||
chown -R $app: $final_path
|
||||
chown -R $app:$app $final_path
|
||||
chmod 600 $final_path/config/ampache.cfg.php
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
|
@ -69,7 +69,8 @@ ynh_system_user_create --username=$app
|
|||
ynh_script_progression --message="Restoring user rights..."
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R $app: $final_path
|
||||
chown -R $app:$app $final_path
|
||||
chmod 600 $final_path/config/ampache.cfg.php
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
|
|
|
@ -23,6 +23,7 @@ is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
|||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
|
||||
|
||||
#=================================================
|
||||
|
@ -37,21 +38,6 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
# If is_public doesn't exist, create it
|
||||
if [ -z $is_public ]; then
|
||||
is_public=1
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||
fi
|
||||
|
||||
# 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 db_name doesn't exist, create it
|
||||
if [ -z "$db_name" ]; then
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
|
@ -92,6 +78,14 @@ ynh_clean_setup () {
|
|||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -119,14 +113,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=5
|
|||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -145,19 +131,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|||
then
|
||||
ynh_script_progression --message="Upgrading Ampache configuration..."
|
||||
|
||||
conf_file="$final_path/config/ampache.cfg.php"
|
||||
ynh_backup_if_checksum_is_different --file="$conf_file"
|
||||
|
||||
ynh_replace_string --match_string="__DBUSER__" --replace_string="$db_user" --target_file="$conf_file"
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_replace_string --match_string="__DBPWD__" --replace_string="$db_pwd" --target_file="$conf_file"
|
||||
ynh_replace_string --match_string="__DBNAME__" --replace_string="$db_name" --target_file="$conf_file"
|
||||
ynh_replace_string --match_string="__PATHTOCHANGE__" --replace_string="$path_url" --target_file="$conf_file"
|
||||
ynh_replace_string --match_string="__DOMAINTOCHANGE__" --replace_string="$domain" --target_file="$conf_file"
|
||||
ynh_replace_string --match_string="__RANDOMKEYTOCHANGE__" --replace_string="$secret_key" --target_file="$conf_file"
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$conf_file"
|
||||
ynh_add_config --template="../conf/ampache.cfg.php" --destination="$final_path/config/ampache.cfg.php"
|
||||
|
||||
#=================================================
|
||||
# UPDATE AMPACHE WITH COMPOSER
|
||||
|
@ -184,8 +158,11 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|||
then
|
||||
ynh_script_progression --message="Upgrading Ampache with cURL..." --weight=6
|
||||
|
||||
# Set the app as temporarily public for curl call
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
# Set the app as temporarily public for cURL call
|
||||
if ! ynh_permission_has_user --permission="main" --user="visitors"
|
||||
then
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
# Reload NGINX
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
@ -202,7 +179,8 @@ fi
|
|||
ynh_script_progression --message="Securing files and directories..."
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R $app: $final_path
|
||||
chown -R $app:$app $final_path
|
||||
chmod 600 $final_path/config/ampache.cfg.php
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
Loading…
Add table
Reference in a new issue