From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2513A138334 for ; Sun, 22 Dec 2019 18:58:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5E8DCE0AD1; Sun, 22 Dec 2019 18:58:25 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 34927E0AD1 for ; Sun, 22 Dec 2019 18:58:25 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1795534DA86 for ; Sun, 22 Dec 2019 18:58:24 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3094B12EB8 for ; Sun, 22 Dec 2019 18:58:22 +0000 (UTC) From: "Andreas Sturmlechner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andreas Sturmlechner" Message-ID: <1577041068.77aa9069fe3cc4680c446a3d9ecd2f5f695f171d.asturm@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: kde-plasma/plasma-workspace/ X-VCS-Repository: repo/gentoo X-VCS-Files: kde-plasma/plasma-workspace/plasma-workspace-5.17.4-r1.ebuild X-VCS-Directories: kde-plasma/plasma-workspace/ X-VCS-Committer: asturm X-VCS-Committer-Name: Andreas Sturmlechner X-VCS-Revision: 77aa9069fe3cc4680c446a3d9ecd2f5f695f171d X-VCS-Branch: master Date: Sun, 22 Dec 2019 18:58:22 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 43c7cf97-1113-46cd-8e82-0d79d8cab565 X-Archives-Hash: d9b4e952f67383bdb4588f99480fae70 commit: 77aa9069fe3cc4680c446a3d9ecd2f5f695f171d Author: Andreas Sturmlechner gentoo org> AuthorDate: Sun Dec 22 17:06:58 2019 +0000 Commit: Andreas Sturmlechner gentoo org> CommitDate: Sun Dec 22 18:57:48 2019 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77aa9069 kde-plasma/plasma-workspace: Improve old script detection/migration - Drop mkdir and chmod commands - Add missing || die - No need for subshells to detect constant paths - Use md5sum to detect if existing scripts were modified at all - Clean up pre-5.17.4 scripts, they were owned by plasma-workspace anyway Bug: https://bugs.gentoo.org/688366 Package-Manager: Portage-2.3.82, Repoman-2.3.20 Signed-off-by: Andreas Sturmlechner gentoo.org> .../plasma-workspace-5.17.4-r1.ebuild | 82 +++++++++++++--------- 1 file changed, 48 insertions(+), 34 deletions(-) diff --git a/kde-plasma/plasma-workspace/plasma-workspace-5.17.4-r1.ebuild b/kde-plasma/plasma-workspace/plasma-workspace-5.17.4-r1.ebuild index 981850375fc..58f1c7f27b3 100644 --- a/kde-plasma/plasma-workspace/plasma-workspace-5.17.4-r1.ebuild +++ b/kde-plasma/plasma-workspace/plasma-workspace-5.17.4-r1.ebuild @@ -130,15 +130,42 @@ PATCHES=( RESTRICT+=" test" -# used for agent scripts migration -OLDST=/etc/plasma/startup/10-agent-startup.sh -NEWST=/etc/xdg/plasma-workspace/env/10-agent-startup.sh -OLDSH=/etc/plasma/shutdown/10-agent-shutdown.sh -NEWSH=/etc/xdg/plasma-workspace/shutdown/10-agent-shutdown.sh +pkg_setup() { + ecm_pkg_setup + + local md5 + local srcfile=/etc/plasma/XX/10-agent-XX.sh + local newdir="${EPREFIX}"/etc/xdg/plasma-workspace + + if [[ -f "${EROOT}"${srcfile//XX/startup} ]]; then + md5=$(md5sum "${EROOT}"${srcfile//XX/startup}) + if [[ ${md5%% *} != 90caaabb40b56bfbe65388841a6dd6ca ]]; then + elog "Existing modified ${EPREFIX}${srcfile//XX/startup} detected." + elog "Copying to ${newdir}/env/10-agent-startup.sh..." + cp -v "${EROOT}"${srcfile//XX/startup} "${T}"/ || die + fi + fi + + if [[ -f "${EROOT}"${srcfile//XX/shutdown} ]]; then + md5=$(md5sum "${EROOT}"${srcfile//XX/shutdown}) + if [[ ${md5%% *} != d7bffa0273f92abd999c7c3c43dbc23d ]]; then + elog "Existing modified ${EPREFIX}${srcfile//XX/shutdown} detected." + elog "Copying to ${newdir}/shutdown/10-agent-shutdown.sh..." + cp -v "${EROOT}"${srcfile//XX/shutdown} "${T}"/ || die + fi + fi +} src_prepare() { ecm_src_prepare + if [[ ! -f "${T}"/10-agent-startup.sh ]]; then + cp "${FILESDIR}"/10-agent-startup.sh "${T}"/ || die + fi + if [[ ! -f "${T}"/10-agent-shutdown.sh ]]; then + cp "${FILESDIR}"/10-agent-shutdown.sh "${T}"/ || die + fi + cmake_comment_add_subdirectory libkworkspace # delete colliding libkworkspace translations if [[ ${KDE_BUILD_TYPE} = release ]]; then @@ -166,41 +193,28 @@ src_install() { ecm_src_install # default startup and shutdown scripts - insinto "$(dirname ${NEWST})" - doins "${FILESDIR}/$(basename ${NEWST})" + insinto /etc/xdg/plasma-workspace/env + doins "${T}"/10-agent-startup.sh - insinto "$(dirname ${NEWSH})" - doins "${FILESDIR}/$(basename ${NEWSH})" - fperms +x "${NEWSH}" -} - -pkg_preinst() { - ecm_pkg_preinst - - # migrate existing agent scripts to new layout if no files there yet - if [[ -r "${EROOT}${OLDST}" && ! -f "${EROOT}${NEWST}" ]]; then - mkdir -p "${EROOT}$(dirname ${NEWST})" && cp "${EROOT}${OLDST}" "${EROOT}${NEWST}" && \ - elog "${EROOT}${OLDST} has been migrated to ${EROOT}${NEWST}, please delete old file." - fi - if [[ -r "${EROOT}${OLDSH}" && ! -f "${EROOT}${NEWSH}" ]]; then - mkdir -p "${EROOT}$(dirname ${NEWSH})" && cp "${EROOT}${OLDSH}" "${EROOT}${NEWSH}" && \ - chmod +x "${EROOT}${NEWSH}" && \ - elog "${EROOT}${OLDSH} has been migrated to ${EROOT}${NEWSH}, please delete old file." - fi + insinto /etc/xdg/plasma-workspace/shutdown + doins "${T}"/10-agent-shutdown.sh + fperms +x /etc/xdg/plasma-workspace/shutdown/10-agent-shutdown.sh } pkg_postinst () { ecm_pkg_postinst - # warn about any leftover user scripts - if [[ -d "${EROOT}"/etc/plasma/startup && -n "$(ls "${EROOT}"/etc/plasma/startup)" ]] || \ - [[ -d "${EROOT}"/etc/plasma/shutdown && -n "$(ls "${EROOT}"/etc/plasma/shutdown)" ]]; then - elog "You appear to have scripts in ${EROOT}/etc/plasma/{startup,shutdown}." - elog "They will no longer work since plasma-workspace-5.17" + # Clean up pre-5.17.4 scripts + if [[ -e "${EROOT}"/etc/plasma/startup/10-agent-startup.sh ]]; then + rm "${EROOT}"/etc/plasma/startup/10-agent-startup.sh || die + elog "Removed obsolete ${EPREFIX}/etc/plasma/startup/10-agent-startup.sh" + fi + if [[ -e "${EROOT}"/etc/plasma/shutdown/10-agent-shutdown.sh ]]; then + rm "${EROOT}"/etc/plasma/shutdown/10-agent-shutdown.sh || die + elog "Removed obsolete ${EPREFIX}/etc/plasma/shutdown/10-agent-shutdown.sh" fi - elog " * Edit ${EROOT}${NEWST} and uncomment" - elog " the lines enabling ssh-agent." - elog " * Edit ${EROOT}${NEWSH} uncomment" - elog " the respective lines to properly kill the agent when the session ends." + elog "To enable gpg-agent and/or ssh-agent in Plasma sessions," + elog "edit ${EPREFIX}/etc/xdg/plasma-workspace/env/10-agent-startup.sh" + elog "and ${EPREFIX}/etc/xdg/plasma-workspace/shutdown/10-agent-shutdown.sh" }