diff --git a/conf/ampache.cfg.php b/conf/ampache.cfg.php index ff9bd85..03eb7b1 100644 --- a/conf/ampache.cfg.php +++ b/conf/ampache.cfg.php @@ -287,7 +287,7 @@ use_auth = "true" ; if use_auth if false ; POSSIBLE VALUES: user, admin, manager, guest ; DEFAULT: admin -default_auth_level = "admin" +default_auth_level = "user" ; 5 Star Ratings ; This allows ratings for almost any object in ampache @@ -554,7 +554,7 @@ ldap_search_dn = "dc=yunohost,dc=org" ; This is the address of your ldap server (required) ; DEFAULT: null -ldap_url = "192.168.1.88" +ldap_url = "localhost" ; Attributes where additional user information is stored (optional) ; OpenLDAP ldap_name_field = "cn" @@ -613,7 +613,7 @@ auto_create = "true" ; added as a guest and must be promoted by the admin. ; POSSIBLE VALUES: guest, user, admin ; DEFAULT: guest -auto_user = "admin" +auto_user = "yunoadmin" ; This will display the user agreement when registering ; For agreement text, edit templates/user_agreement.php diff --git a/manifest.json b/manifest.json index ad32394..941d5a6 100644 --- a/manifest.json +++ b/manifest.json @@ -29,6 +29,14 @@ }, "example": "/ampache", "default": "/ampache" + }, + { + "name": "admin", + "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" } ] } diff --git a/scripts/install b/scripts/install index e6542d4..d900210 100644 --- a/scripts/install +++ b/scripts/install @@ -3,6 +3,7 @@ # Retrieve arguments domain=$1 path=$2 +admin_ampache=$3 # Check domain/path availability sudo yunohost app checkurl $domain$path -a ampache @@ -10,6 +11,15 @@ if [[ ! $? -eq 0 ]]; then exit 1 fi +# Check if admin exists +sudo yunohost user list --json | grep -q "\"username\": \"$admin_ampache\"" +if [[ ! $? -eq 0 ]]; then + echo "Wrong admin" + exit 1 +fi + +sudo yunohost app setting ampache admin -v $admin_ampache + # Generate random password db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p') @@ -30,6 +40,7 @@ sudo cp ../conf/ampache.cfg.php $final_path/config/ampache.cfg.php sudo sed -i "s/yunouser/$db_user/g" $final_path/config/ampache.cfg.php sudo sed -i "s/yunopass/$db_pwd/g" $final_path/config/ampache.cfg.php sudo sed -i "s/yunobase/$db_user/g" $final_path/config/ampache.cfg.php +sudo sed -i "s/yunoadmin/$admin_ampache/g" $final_path/config/ampache.cfg.php sed -i "s@PATHTOCHANGE@$path@g" $final_path/config/ampache.cfg.php sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php