commit: 26e8ae85e284ba49fef6ac7b2c7e74b697b3c2ed Author: band-a-prend <torokhov-s-a <AT> yandex <DOT> ru> AuthorDate: Tue Apr 13 21:00:22 2021 +0000 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> CommitDate: Tue May 4 15:55:51 2021 +0000 URL: https://gitweb.gentoo.org/proj/kde.git/commit/?id=26e8ae85
media-sound/amarok: Add optfeature and pkg_config to create database Add optfeature 'kde-apps/audiocd-kio' for Audio CD support. Add additional pkg_postinst() elog messages with URLs to pages with preliminary configuration of MySQL/MariaDB Server. Add elog messages with steps to create Amarok external database with 'emerge --config amarok' command and switching to use it. Add simple short pkg_config() to create Amarok external database with it's default username/password. Committer-comment: Drop unrelated minor changes and fix mix of ewarn/einfo. Closes: https://github.com/gentoo/kde/pull/899 Signed-off-by: Sergey Torokhov <torokhov-s-a <AT> yandex.ru> Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> media-sound/amarok/amarok-9999.ebuild | 37 +++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/media-sound/amarok/amarok-9999.ebuild b/media-sound/amarok/amarok-9999.ebuild index 4f26e37cef..397a86c538 100644 --- a/media-sound/amarok/amarok-9999.ebuild +++ b/media-sound/amarok/amarok-9999.ebuild @@ -6,7 +6,7 @@ EAPI=7 ECM_HANDBOOK="forceoptional" KFMIN=5.74.0 QTMIN=5.15.2 -inherit ecm kde.org +inherit ecm kde.org optfeature DESCRIPTION="Advanced audio player based on KDE frameworks" HOMEPAGE="https://amarok.kde.org/" @@ -111,11 +111,40 @@ pkg_postinst() { echo "${1} ($(has_version ${1} || echo "not ")installed)" } + optfeature "Audio CD support" kde-apps/audiocd-kio + if [[ -z "${REPLACING_VERSIONS}" ]]; then - elog "You'll have to configure amarok to use an external db server:" - use mariadb && elog " $(pkg_is_installed dev-db/mariadb)" || + elog "You'll have to configure amarok to use an external database server:" + if use mariadb ; then + elog " $(pkg_is_installed dev-db/mariadb)" + elog " For preliminary configuration of MariaDB Server please refer to" + elog " https://wiki.gentoo.org/wiki/MariaDB#Configuration" + else elog " $(pkg_is_installed dev-db/mysql)" + elog " For preliminary configuration of MySQL Server please refer to" + elog " https://wiki.gentoo.org/wiki/MySQL#Configuration" + fi elog "Please read https://community.kde.org/Amarok/Community/MySQL for details on how" - elog "to configure the external db and migrate your data from the embedded database." + elog "to configure the external database and migrate your data from the embedded database." + elog "To create external amarok database with default user/password please:" + elog " 1. Make sure that MySQL or MariaDB is installed and configured (see above)" + elog " 2. Ensure that 'mysql' service is started and then run command 'emerge --config amarok'" + elog " 3. On 'Configure Amarok - Database' menu page check 'Use external MySQL database' and press OK" + fi +} + +pkg_config() { + # Create external mysql database with amarok default user/password + local AMAROK_DB_NAME="amarokdb" + local AMAROK_DB_USER_NAME="amarokuser" + local AMAROK_DB_USER_PWD="password" + + einfo "Initializing ${PN} MySQL database 'amarokdb':" + einfo "If prompted for a password, please enter your MySQL root password." + einfo + + if [[ -e "${EROOT}"/usr/bin/mysql ]]; then + "${EROOT}"/usr/bin/mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS ${AMAROK_DB_NAME}; GRANT ALL PRIVILEGES ON ${AMAROK_DB_NAME}.* TO '${AMAROK_DB_USER_NAME}' IDENTIFIED BY '${AMAROK_DB_USER_PWD}'; FLUSH PRIVILEGES;" fi + einfo "${PN} MySQL database 'amarokdb' successfully initialized!" }
