--- plasma-workspace-5.17.2.ebuild 2019-10-29 23:44:57.111955169 +0100 +++ plasma-workspace-5.17.2-r1.ebuild 2019-11-12 02:35:50.184081639 +0100 @@ -123,6 +123,12 @@ 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 + src_prepare() { kde5_src_prepare @@ -149,25 +155,40 @@ kde5_src_configure } -src_install() { - kde5_src_install - - # startup and shutdown scripts - insinto /etc/plasma/startup - doins "${FILESDIR}/10-agent-startup.sh" +pkg_preinst () { + kde5_pkg_preinst - insinto /etc/plasma/shutdown - doins "${FILESDIR}/10-agent-shutdown.sh" + # migrate existing agent startup/shutdown scripts to new places + # use FILESDIR/ scripts otherwise + mkdir -p "${ED}"$(dirname ${NEWST}) || die + if [[ -r "${EROOT}"${OLDST} ]]; then + cp "${EROOT}"${OLDST} "${ED}"${NEWST} || die + elog "${EROOT}${OLDST} has been migrated to ${EROOT}${NEWST}, please delete old file." + else + cp "${FILESDIR}"/$(basename ${OLDST}) "${ED}"${NEWST} || die + fi + mkdir -p "${ED}"$(dirname ${NEWSH}) || die + if [[ -r "${EROOT}"${OLDSH} ]]; then + cp "${EROOT}"${OLDSH} "${ED}"${NEWSH} || die + elog "${EROOT}${OLDSH} has been migrated to ${EROOT}${NEWSH}, please delete old file." + else + cp "${FILESDIR}"/$(basename ${OLDSH}) "${ED}"${NEWSH} || die + fi + chmod +x "${ED}"${NEWSH} || die } pkg_postinst () { kde5_pkg_postinst - elog "To enable gpg-agent and/or ssh-agent in Plasma sessions, do the following:" - elog " * Copy the necessary files to your home directory:" - elog " - cp /etc/plasma/startup/10-agent-startup.sh ~/.config/plasma-workspace/env/" - elog " - cp /etc/plasma/shutdown/10-agent-shutdown.sh ~/.config/plasma-workspace/shutdown/" - elog " * Edit 10-agent-startup.sh and uncomment the lines enabling ssh-agent." - elog " * In 10-agent-shutdown.sh uncomment the respective lines to properly kill" - elog " the agent when the session ends." + # 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" + 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." }