From 66a872ce9c196bc0e1f65441e02350670f81960a Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Fri, 7 Aug 2015 21:39:48 +0200 Subject: [PATCH 01/11] Truely random secret string --- conf/ampache.cfg.php | 3 +-- scripts/install | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/ampache.cfg.php b/conf/ampache.cfg.php index bc3450e..929858a 100644 --- a/conf/ampache.cfg.php +++ b/conf/ampache.cfg.php @@ -62,7 +62,7 @@ database_password = "yunopass" ; Cryptographic secret ; This MUST BE changed with your own secret key. Ampache-specific, just pick any random string you want. -secret_key = "abcdefghijklmnoprqstuvwyz0123456" +secret_key = "RANDOMKEYTOCHANGE" ; Length that a session will last expressed in seconds. Default is ; one hour. @@ -984,4 +984,3 @@ force_ssl = "true" ; so that the ordering is sane. ; DEFAULT: auto ;mb_detect_order = "ASCII,UTF-8,EUC-JP,ISO-2022-JP,SJIS,JIS" - diff --git a/scripts/install b/scripts/install index c78524f..401c768 100644 --- a/scripts/install +++ b/scripts/install @@ -46,6 +46,8 @@ sudo sed -i "s/yunobase/$db_user/g" $final_path/config/ampache.cfg.php sudo sed -i "s/yunoadmin/$admin_ampache/g" /tmp/admin.sql sed -i "s@PATHTOCHANGE@$path@g" $final_path/config/ampache.cfg.php sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php +random_key=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') +sed -i "s@RANDOMKEYTOCHANGE@$random_key@g" $final_path/config/ampache.cfg.php # Set permissions to roundcube directory sudo chown -R www-data: $final_path From f53364446d98c351de00dfb9c2841402b332ff08 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Fri, 7 Aug 2015 23:23:57 +0200 Subject: [PATCH 02/11] Change admin default language to English --- conf/admin.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/admin.sql b/conf/admin.sql index 0e2a2a9..d600862 100644 --- a/conf/admin.sql +++ b/conf/admin.sql @@ -1,6 +1,6 @@ INSERT INTO user(id,username,fullname,access) VALUES("", "yunoadmin", "yunoadmin", "100"); -UPDATE `user_preference` SET `value` = 'fr_FR' WHERE `preference` = 31 ; +UPDATE `user_preference` SET `value` = 'en_US' WHERE `preference` = 31 ; SET @lastid = LAST_INSERT_ID(); @@ -14,7 +14,7 @@ INSERT INTO `user_preference` (`user`, `preference`, `value`) VALUES (@lastid, 25, '80'), (@lastid, 41, 'mpd'), (@lastid, 29, 'web_player'), -(@lastid, 31, 'fr_FR'), +(@lastid, 31, 'en_US'), (@lastid, 32, 'm3u'), (@lastid, 33, 'reborn'), (@lastid, 34, '27'), From 27fcff41deeeb682bcbd3ac206457aafbdcf3499 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Fri, 7 Aug 2015 22:46:12 +0200 Subject: [PATCH 03/11] Enable LDAP authentication --- conf/ampache.cfg.php | 8 ++++---- conf/nginx.conf | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/conf/ampache.cfg.php b/conf/ampache.cfg.php index 929858a..72d728f 100644 --- a/conf/ampache.cfg.php +++ b/conf/ampache.cfg.php @@ -102,7 +102,7 @@ session_cookiesecure = 0 ; If auto_create isn't enabled the user must exist locally. ; DEFAULT: mysql ; VALUES: mysql,ldap,http,pam,external,openid -auth_methods = "http,mysql" +auth_methods = "ldap" ; External authentication ; This sets the helper used for external authentication. It should conform to @@ -613,13 +613,13 @@ show_footer_statistics = "true" ; For OpenLDAP use "uid" ; For Microsoft Active Directory (MAD) use "sAMAccountName" ; DEFAULT: null -;ldap_filter = "(sAMAccountName=%v)" +ldap_filter = "(uid=%v)" ; LDAP objectclass (required) ; OpanLDAP objectclass = "*" ; MAD objectclass = "organizationalPerson" ; DEFAULT null -ldap_objectclass = "posixAccount" +ldap_objectclass = "mailAccount" ; Initial credentials to bind with for searching (optional) ; DEFAULT: null @@ -632,7 +632,7 @@ ldap_objectclass = "posixAccount" ; This is the search dn used to find users (required) ; DEFAULT: null -ldap_search_dn = "dc=yunohost,dc=org" +ldap_search_dn = "ou=users,dc=yunohost,dc=org" ; This is the address of your ldap server (required) ; DEFAULT: null diff --git a/conf/nginx.conf b/conf/nginx.conf index 8417a81..fe41442 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -22,6 +22,6 @@ location PATHTOCHANGE { rewrite ^PATHTOCHANGE/rest/(.*)\.view$ PATHTOCHANGE/rest/index.php?action=$1 last; } # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + # include conf.d/yunohost_panel.conf.inc; } From 146a9eab9d8239afbc5b5cdfe9d19aec82a940c5 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Fri, 7 Aug 2015 22:50:13 +0200 Subject: [PATCH 04/11] Personal preferences --- conf/ampache.cfg.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/ampache.cfg.php b/conf/ampache.cfg.php index 72d728f..cdc4526 100644 --- a/conf/ampache.cfg.php +++ b/conf/ampache.cfg.php @@ -216,7 +216,7 @@ require_localnet_session = "true" ; still need to enabled downloading for the specific user you ; want to be able to use this function ; DEFAULT: false -;allow_zip_download = "false" +allow_zip_download = "true" Allow Zip Types ; This setting allows/disallows zip download of specific object types @@ -224,7 +224,7 @@ Allow Zip Types ; Otherwise, only the given object list can be zipped. ; POSSIBLE VALUES: artist, album, playlist, search, tmp_playlist ; DEFAULT: none -;allow_zip_types = "album" +allow_zip_types = "artist,album,playlist" ; File Zip Comment ; This is an optional configuration option that adds a comment @@ -275,16 +275,16 @@ getid3_tag_order = "id3v2,id3v1,vorbiscomment,quicktime,matroska,ape,asf,avi,mpe ; This determines if file metadata should be write back to files ; as id3 metadata when updated. ; DEFAULT: false -;write_id3 = "false" +write_id3 = "true" ; This determines if album art should be write back to files ; as id3 metadata when updated. ; DEFAULT: false -;write_id3_art = "false" +write_id3_art = "true" ; This determines if catalog manager users can delete medias from disk. ; DEFAULT: false -;delete_from_disk = "false" +delete_from_disk = "true" ; This determines the order in which metadata sources are used (and in the ; case of plugins, checked) @@ -670,7 +670,7 @@ auto_create = "true" ; sign up for an account on your server. ; REMEMBER: don't forget to set the mail from address further down in the config. ; DEFAULT: false -;allow_public_registration = "false" +allow_public_registration = "false" ; Require Captcha Text on Image confirmation ; Turning this on requires the user to correctly From 68c53e761b8af7a899db9a61daa7e505ddcd7c6d Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Mon, 24 Aug 2015 15:06:32 +0200 Subject: [PATCH 05/11] Fixed install for install as root of domain --- conf/nginx.conf | 15 +++++++++++++++ scripts/install | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index fe41442..1e34e7b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -16,11 +16,26 @@ location PATHTOCHANGE { fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; } + + location ^~ /bin/ { + deny all; + return 403; + } rewrite ^PATHTOCHANGE/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/name/(.*)$ PATHTOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&name=$5 last; + rewrite ^PATHTOCHANGE/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/name/(.*)$ PATHTOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&name=$7 last; + + #enable subsonic api if ( !-d $request_filename ) { rewrite ^PATHTOCHANGE/rest/(.*)\.view$ PATHTOCHANGE/rest/index.php?action=$1 last; + rewrite ^PATHTOCHANGE/rest/fake/(.+)$ PATHTOCHANGE/play/$1 last; } + location /rest { + limit_except GET POST { + deny all; + } + } + # Include SSOWAT user panel. # include conf.d/yunohost_panel.conf.inc; diff --git a/scripts/install b/scripts/install index 401c768..0b423b8 100644 --- a/scripts/install +++ b/scripts/install @@ -7,6 +7,9 @@ admin_ampache=$3 debianversionname=$(lsb_release -a | grep Codename | awk -F' ' '{print $2}') +# Remove trailing "/" for next commands +path=${path%/} + # Check domain/path availability sudo yunohost app checkurl $domain$path -a ampache if [[ ! $? -eq 0 ]]; then @@ -49,7 +52,7 @@ sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php random_key=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') sed -i "s@RANDOMKEYTOCHANGE@$random_key@g" $final_path/config/ampache.cfg.php -# Set permissions to roundcube directory +# Set permissions to ampache directory sudo chown -R www-data: $final_path # Modify Nginx configuration file and copy it to Nginx conf directory From dd1fdca7038ffa3c6014f3faaf0e7445be4f5c93 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Mon, 24 Aug 2015 15:22:41 +0200 Subject: [PATCH 06/11] Added upgrade script --- scripts/upgrade | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 scripts/upgrade diff --git a/scripts/upgrade b/scripts/upgrade new file mode 100644 index 0000000..9a9877b --- /dev/null +++ b/scripts/upgrade @@ -0,0 +1,59 @@ +#!/bin/bash + + +debianversionname=$(lsb_release -a | grep Codename | awk -F' ' '{print $2}') + +# Retrieve arguments +domain=$(sudo yunohost app setting syncthing domain) +path=$(sudo yunohost app setting syncthing path) +db_user=ampache +db_pwd=$(sudo yunohost app setting syncthing mysqlpwd) +admin_ampache=$(sudo yunohost app setting syncthing admin) + +# Remove trailing "/" for next commands +path=${path%/} + + +# first make a copy of the db +mysqldump -u $db_user -p$db_pwd --add-drop-table --allow-keywords ampache > $final_path/ampache-db-backup.sql + +# Copy files to the right place +final_path=/var/www/ampache +sudo cp -a ../sources/* $final_path +sudo cp ../conf/ampache.cfg.php $final_path/config/ampache.cfg.php + +# Change variables in Ampache configuration +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 +sed -i "s@PATHTOCHANGE@$path@g" $final_path/config/ampache.cfg.php +sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php + + +# Set permissions to roundcube directory +sudo chown -R www-data: $final_path + +# Modify Nginx configuration file and copy it to Nginx conf directory +sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf* +sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf* +sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/ampache.conf + + +# Reload Nginx and regenerate SSOwat conf +sudo service nginx reload +sudo yunohost app setting ampache skipped_uris -v "/" +sudo yunohost app ssowatconf + +# Ampache installation +echo "127.0.0.1 $domain #yunoampache" | sudo tee -a /etc/hosts +sleep 1 +curl -kL -X POST http://$domain$path/update.php?action=update > /dev/null 2>&1 +sleep 5 +[ "$debianversionname" == "wheezy" ] && \ +sudo sed -i 's/;transcode_cmd = "ffmpeg"/transcode_cmd = "ffmpeg"/g' /var/www/ampache/config/ampache.cfg.php && \ +sudo sed -i 's/^transcode_cmd = "avconv"/;transcode_cmd = "avconv"/g' /var/www/ampache/config/ampache.cfg.php +sudo yunohost app setting ampache skipped_uris -d +sudo yunohost app setting ampache skipped_uris -v "/rest" +sudo yunohost app ssowatconf +sudo sed '/yunoampache/d' /etc/hosts > /tmp/hosts.tmp +sudo cp /tmp/hosts.tmp /etc/hosts ; sudo rm -f /tmp/hosts.tmp From ad3fd441a4c3c29cc26ce976f0c6c4e7c32f1cd4 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Mon, 24 Aug 2015 15:23:01 +0200 Subject: [PATCH 07/11] One more edit to enable LDAP login --- conf/ampache.cfg.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/ampache.cfg.php b/conf/ampache.cfg.php index cdc4526..fa494eb 100644 --- a/conf/ampache.cfg.php +++ b/conf/ampache.cfg.php @@ -120,7 +120,7 @@ auth_methods = "ldap" ; Logout redirection target ; Defaults to our own login.php, but we can override it here if, for instance, ; we want to redirect to an SSO provider instead. -logout_redirect = "https://DOMAINTOCHANGE/yunohost/sso/?action=logout" +; logout_redirect = "https://DOMAINTOCHANGE/yunohost/sso/?action=logout" ;##################### ; Program Settings # From 104cec356aa003e250a86c7ee3cc7efb9a143920 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Mon, 24 Aug 2015 15:23:18 +0200 Subject: [PATCH 08/11] Add ffmpeg dependency to install script --- scripts/install | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/install b/scripts/install index 0b423b8..b7af813 100644 --- a/scripts/install +++ b/scripts/install @@ -66,6 +66,9 @@ sudo service nginx reload sudo yunohost app setting ampache skipped_uris -v "/" sudo yunohost app ssowatconf +# Install dependency +sudo apt-get install ffmpeg -y + # Ampache installation echo "127.0.0.1 $domain #yunoampache" | sudo tee -a /etc/hosts sleep 1 From 3dd2e65d505d142d86a6754e198e70a2cbdbee34 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Fri, 28 Aug 2015 20:53:51 +0200 Subject: [PATCH 09/11] Adding config directory to nginx config This is according to the template from the Ampache documentation --- conf/nginx.conf | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 1e34e7b..0c9dca4 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -22,8 +22,13 @@ location PATHTOCHANGE { return 403; } + location ^~ /config/ { + deny all; + return 403; + } + rewrite ^PATHTOCHANGE/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/name/(.*)$ PATHTOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&name=$5 last; - rewrite ^PATHTOCHANGE/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/name/(.*)$ PATHTOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&name=$7 last; + rewrite ^PATHTOCHANGE/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/name/(.*)$ PATHTOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&name=$7 last; #enable subsonic api if ( !-d $request_filename ) { @@ -35,7 +40,7 @@ location PATHTOCHANGE { deny all; } } - + # Include SSOWAT user panel. # include conf.d/yunohost_panel.conf.inc; From 2e020488f1fea9e5708844888af840f338d041f8 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Sat, 29 Aug 2015 01:05:00 +0200 Subject: [PATCH 10/11] Errors in scripts --- scripts/install | 6 +++--- scripts/upgrade | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/install b/scripts/install index b7af813..a3bf986 100644 --- a/scripts/install +++ b/scripts/install @@ -47,10 +47,10 @@ 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" /tmp/admin.sql -sed -i "s@PATHTOCHANGE@$path@g" $final_path/config/ampache.cfg.php -sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php +sudo sed -i "s@PATHTOCHANGE@$path@g" $final_path/config/ampache.cfg.php +sudo sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php random_key=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') -sed -i "s@RANDOMKEYTOCHANGE@$random_key@g" $final_path/config/ampache.cfg.php +sudo sed -i "s@RANDOMKEYTOCHANGE@$random_key@g" $final_path/config/ampache.cfg.php # Set permissions to ampache directory sudo chown -R www-data: $final_path diff --git a/scripts/upgrade b/scripts/upgrade index 9a9877b..e8eeb78 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -4,18 +4,18 @@ debianversionname=$(lsb_release -a | grep Codename | awk -F' ' '{print $2}') # Retrieve arguments -domain=$(sudo yunohost app setting syncthing domain) -path=$(sudo yunohost app setting syncthing path) +domain=$(sudo yunohost app setting ampache domain) +path=$(sudo yunohost app setting ampache path) db_user=ampache -db_pwd=$(sudo yunohost app setting syncthing mysqlpwd) -admin_ampache=$(sudo yunohost app setting syncthing admin) +db_pwd=$(sudo yunohost app setting ampache mysqlpwd) +admin_ampache=$(sudo yunohost app setting ampache admin) # Remove trailing "/" for next commands path=${path%/} # first make a copy of the db -mysqldump -u $db_user -p$db_pwd --add-drop-table --allow-keywords ampache > $final_path/ampache-db-backup.sql +# mysqldump -u $db_user -p$db_pwd --add-drop-table --allow-keywords ampache > $final_path/ampache-db-backup.sql # Copy files to the right place final_path=/var/www/ampache @@ -26,8 +26,8 @@ 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 -sed -i "s@PATHTOCHANGE@$path@g" $final_path/config/ampache.cfg.php -sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php +sudo sed -i "s@PATHTOCHANGE@$path@g" $final_path/config/ampache.cfg.php +sudo sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php # Set permissions to roundcube directory From a2eed0379a8b04b1b2c8889fdcf347cfec81d55a Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Sat, 29 Aug 2015 16:29:42 +0200 Subject: [PATCH 11/11] Error in scripts when using subdomain --- scripts/install | 7 ++----- scripts/upgrade | 8 ++------ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/scripts/install b/scripts/install index a3bf986..49ec8c7 100644 --- a/scripts/install +++ b/scripts/install @@ -7,9 +7,6 @@ admin_ampache=$3 debianversionname=$(lsb_release -a | grep Codename | awk -F' ' '{print $2}') -# Remove trailing "/" for next commands -path=${path%/} - # Check domain/path availability sudo yunohost app checkurl $domain$path -a ampache if [[ ! $? -eq 0 ]]; then @@ -47,7 +44,7 @@ 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" /tmp/admin.sql -sudo sed -i "s@PATHTOCHANGE@$path@g" $final_path/config/ampache.cfg.php +sudo sed -i "s@PATHTOCHANGE@${path%/}@g" $final_path/config/ampache.cfg.php sudo sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php random_key=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') sudo sed -i "s@RANDOMKEYTOCHANGE@$random_key@g" $final_path/config/ampache.cfg.php @@ -72,7 +69,7 @@ sudo apt-get install ffmpeg -y # Ampache installation echo "127.0.0.1 $domain #yunoampache" | sudo tee -a /etc/hosts sleep 1 -curl -kL -X POST http://$domain$path/update.php?action=update > /dev/null 2>&1 +curl -kL -X POST http://$domain${path%/}/update.php?action=update > /dev/null 2>&1 sleep 5 [ "$debianversionname" == "wheezy" ] && \ sudo sed -i 's/;transcode_cmd = "ffmpeg"/transcode_cmd = "ffmpeg"/g' /var/www/ampache/config/ampache.cfg.php && \ diff --git a/scripts/upgrade b/scripts/upgrade index e8eeb78..7d00f8b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -10,10 +10,6 @@ db_user=ampache db_pwd=$(sudo yunohost app setting ampache mysqlpwd) admin_ampache=$(sudo yunohost app setting ampache admin) -# Remove trailing "/" for next commands -path=${path%/} - - # first make a copy of the db # mysqldump -u $db_user -p$db_pwd --add-drop-table --allow-keywords ampache > $final_path/ampache-db-backup.sql @@ -26,7 +22,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@PATHTOCHANGE@$path@g" $final_path/config/ampache.cfg.php +sudo sed -i "s@PATHTOCHANGE@${path%/}@g" $final_path/config/ampache.cfg.php sudo sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php @@ -47,7 +43,7 @@ sudo yunohost app ssowatconf # Ampache installation echo "127.0.0.1 $domain #yunoampache" | sudo tee -a /etc/hosts sleep 1 -curl -kL -X POST http://$domain$path/update.php?action=update > /dev/null 2>&1 +curl -kL -X POST http://$domain${path%/}/update.php?action=update > /dev/null 2>&1 sleep 5 [ "$debianversionname" == "wheezy" ] && \ sudo sed -i 's/;transcode_cmd = "ffmpeg"/transcode_cmd = "ffmpeg"/g' /var/www/ampache/config/ampache.cfg.php && \