--- ../overlay.orig/media-sound/squeezeboxserver/squeezeboxserver-7.4.1.ebuild 2009-12-11 13:00:31.761529503 +0100 +++ media-sound/squeezeboxserver/squeezeboxserver-7.4.1.ebuild 2009-12-11 12:58:03.885825235 +0100 @@ -26,7 +26,6 @@ # Note: common-sense currently required due to bundled EV (Gentoo bug#287257) DEPEND=" !media-sound/squeezecenter - virtual/logger virtual/mysql avahi? ( net-dns/avahi ) >=dev-perl/common-sense-2.01 @@ -35,7 +34,6 @@ # (http://bugs.slimdevices.com/show_bug.cgi?id=6143). RDEPEND=" dev-perl/File-Which - virtual/logger virtual/mysql avahi? ( net-dns/avahi ) >=dev-lang/perl-5.8.8 @@ -186,7 +184,7 @@ # Build Audio::Scan and EV present because of bug#287264 and bug#287857. src_compile() { einfo "Building bundled Perl modules (some warnings are normal here)..." - "${FILESDIR}/build-modules.sh" "${DISTDIR}" || die "Unable to build Perl modules" + bash "${FILESDIR}/build-modules.sh" "${DISTDIR}" || die "Unable to build Perl modules" } src_install() { @@ -203,6 +201,11 @@ # The custom OS module for Gentoo - provides OS-specific path details cp "${FILESDIR}/gentoo-filepaths.pm" "Slim/Utils/OS/Custom.pm" || die "Unable to install Gentoo custom OS module" + + # Adjust gentoo-filepaths.pm to prefix + sed -i -e "s|/usr|${EPREFIX}/usr|" "Slim/Utils/OS/Custom.pm" || die "sed failed" + sed -i -e "s|/var|${EPREFIX}/var|" "Slim/Utils/OS/Custom.pm" || die "sed failed" + sed -i -e "s|/etc|${EPREFIX}/etc|" "Slim/Utils/OS/Custom.pm" || die "sed failed" # The server Perl modules dodir "/usr/lib/${package}/vendor_perl/${version}" @@ -388,11 +391,11 @@ einfo "Configuring Squeezebox Server database preferences (${MY_PREFS}) ..." TMPPREFS="${T}"/squeezeboxserver-prefs-$$ - touch "${EROOT}${MY_PREFS}" - sed -e '/^dbusername:/d' -e '/^dbpassword:/d' -e '/^dbsource:/d' < "${EROOT}${MY_PREFS}" > "${TMPPREFS}" - mv "${TMPPREFS}" "${EROOT}${MY_PREFS}" + touch "${MY_PREFS}" + sed -e '/^dbusername:/d' -e '/^dbpassword:/d' -e '/^dbsource:/d' < "${MY_PREFS}" > "${TMPPREFS}" + mv "${TMPPREFS}" "${MY_PREFS}" chown squeezeboxserver:squeezeboxserver "${EROOT}${MY_PREFS}" - chmod 660 "${EROOT}${MY_PREFS}" + chmod 660 "${MY_PREFS}" } sc_update_prefs() { @@ -400,9 +403,9 @@ MY_DBUSER=$2 MY_DBUSER_PASSWD=$3 - echo "dbusername: ${MY_DBUSER}" >> "${EROOT}${MY_PREFS}" - echo "dbpassword: ${MY_DBUSER_PASSWD}" >> "${EROOT}${MY_PREFS}" - echo "dbsource: dbi:mysql:database=${MY_DBUSER};mysql_socket=/var/run/mysqld/mysqld.sock" >> "${EROOT}${MY_PREFS}" + echo "dbusername: ${MY_DBUSER}" >> "${MY_PREFS}" + echo "dbpassword: ${MY_DBUSER_PASSWD}" >> "${MY_PREFS}" + echo "dbsource: dbi:mysql:database=${MY_DBUSER};mysql_socket=${EPREFIX}/var/run/mysqld/mysqld.sock" >> "${MY_PREFS}" } pkg_config() { @@ -460,11 +463,11 @@ # from this as it probably just indicates that the database wasn't # yet present. einfo "Dropping old Squeezebox Server database and user ..." - sed -e "s/__DATABASE__/${DBUSER}/" -e "s/__DBUSER__/${DBUSER}/" < "${SHAREDIR}/SQL/mysql/dbdrop-gentoo.sql" | mysql --user=root --password="${ROOT_PASSWD}" >/dev/null 2>&1 + sed -e "s/__DATABASE__/${DBUSER}/" -e "s/__DBUSER__/${DBUSER}/" < "${EPREFIX}${SHAREDIR}/SQL/mysql/dbdrop-gentoo.sql" | mysql --user=root --password="${ROOT_PASSWD}" >/dev/null 2>&1 # Drop and create the Squeezebox Server user and database. einfo "Creating Squeezebox Server MySQL user and database (${DBUSER}) ..." - sed -e "s/__DATABASE__/${DBUSER}/" -e "s/__DBUSER__/${DBUSER}/" -e "s/__DBPASSWORD__/${DBUSER_PASSWD}/" < "${SHAREDIR}/SQL/mysql/dbcreate-gentoo.sql" | mysql --user=root --password="${ROOT_PASSWD}" || die "Unable to create MySQL database and user" + sed -e "s/__DATABASE__/${DBUSER}/" -e "s/__DBUSER__/${DBUSER}/" -e "s/__DBPASSWORD__/${DBUSER_PASSWD}/" < "${EPREFIX}${SHAREDIR}/SQL/mysql/dbcreate-gentoo.sql" | mysql --user=root --password="${ROOT_PASSWD}" || die "Unable to create MySQL database and user" # Migrate old preferences, if present. if [ -d "${OLDPREFSDIR}" ]; then @@ -501,12 +504,12 @@ fi # Remove the existing MySQL preferences from Squeezebox Server (if any). - sc_remove_db_prefs "${PREFS}" - [ -f "${LIVE_PREFS}" ] && sc_remove_db_prefs ${LIVE_PREFS} + sc_remove_db_prefs "${EPREFIX}${PREFS}" + [ -f "${EPREFIX}${LIVE_PREFS}" ] && sc_remove_db_prefs "${EPREFIX}${LIVE_PREFS}" # Insert the external MySQL configuration into the preferences. - sc_update_prefs "${PREFS}" "${DBUSER}" "${DBUSER_PASSWD}" - [ -f "${LIVE_PREFS}" ] && sc_update_prefs "${LIVE_PREFS}" "${DBUSER}" "${DBUSER_PASSWD}" + sc_update_prefs "${EPREFIX}${PREFS}" "${DBUSER}" "${DBUSER_PASSWD}" + [ -f "${EPREFIX}${LIVE_PREFS}" ] && sc_update_prefs "${EPREFIX}${LIVE_PREFS}" "${DBUSER}" "${DBUSER_PASSWD}" # Phew - all done. Give some tips on what to do now. einfo "Database configuration complete."