#!/bin/bash set -eu #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= # Retrieve arguments app=$YNH_APP_INSTANCE_NAME domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH admin_ampache=$YNH_APP_ARG_ADMIN #================================================= # IMPORT GENERIC HELPERS #================================================= # Source helpers . /usr/share/yunohost/helpers . _common.sh #================================================= # MANAGE SCRIPT FAILURE #================================================= ynh_abort_if_errors #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= # Check domain/path availability path_url=$(ynh_normalize_url_path $path_url) ynh_webpath_available $domain $path_url ynh_webpath_register $app $domain $path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= ynh_app_setting_set $app admin $admin_ampache #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= # get sources and copy files to the right place ampache_ynh_getsources cp ../conf/admin.sql /tmp/ #================================================= # CREATE A MYSQL DATABASE #================================================= # Generate random password db_pwd=$(ynh_string_random 24) # Initialize database and store mysql password for upgrade ynh_app_setting_set $app mysqlpwd $db_pwd ynh_mysql_setup_db "$app" "$app" "$db_pwd" ynh_mysql_connect_as "$app" "$db_pwd" "$app" < "$final_path/sql/ampache.sql" #================================================= # MODIFY A CONFIG FILE #================================================= # Change variables in Ampache configuration ampache_ynh_prepareconfig ynh_replace_string "yunoadmin" "$admin_ampache" /tmp/admin.sql random_key=db_pwd=$(ynh_string_random 24) ynh_replace_string "RANDOMKEYTOCHANGE" "$random_key" $final_path/config/ampache.cfg.php #================================================= # NGINX CONFIGURATION #================================================= ynh_add_nginx_config #================================================= # INSTALL DEPENDENCIES #================================================= # Install dependency ynh_install_app_dependencies libav-tools #================================================= # SPECIFIC SETUP #================================================= # Ampache installation ampache_ynh_install #================================================= # RELOAD SSOWAT #================================================= # Regenerate SSOwat conf ampache_ynh_reloadservices #================================================= # SETUP APPLICATION WITH CURL #================================================= # Pre config ampache ampache_ynh_doconfig ynh_mysql_connect_as "$app" "$db_pwd" "$app" < /tmp/admin.sql #================================================= # CLEANING #================================================= # Clean install ynh_secure_remove ../ampache-$version ynh_secure_remove /tmp/admin.sql