# Copyright 1999-2016 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 EAPI=7 inherit user DESCRIPTION="Scripts necessary for use of vdr as a set-top-box" HOMEPAGE="https://www.gentoo.org/" SRC_URI="http://vdr.websitec.de/download/${PN}/${P}.tar.bz2" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86" IUSE="nvram" RDEPEND="nvram? ( sys-power/nvram-wakeup ) app-admin/sudo sys-process/wait_on_pid" VDR_HOME=/var/vdr pkg_setup() { enewgroup vdr # Add user vdr to these groups: # video - accessing dvb-devices # audio - playing sound when using software-devices # cdrom - playing dvds/audio-cds ... enewuser vdr -1 /bin/bash "${VDR_HOME}" vdr,video,audio,cdrom } src_install() { local DOCS=( README* TODO ChangeLog ) default # create necessary directories diropts -ovdr -gvdr keepdir "${VDR_HOME}" local kd for kd in shutdown-data merged-config-files dvd-images; do keepdir "${VDR_HOME}/${kd}" done } pkg_preinst() { local PLUGINS_NEW=0 if [[ -f "${EROOT}"/etc/conf.d/vdr.plugins ]]; then PLUGINS_NEW=$(grep -v '^#' "${EROOT}"/etc/conf.d/vdr.plugins |grep -v '^$'|wc -l) fi if [[ ${PLUGINS_NEW} > 0 ]]; then cp "${EROOT}"/etc/conf.d/vdr.plugins "${ED}"/etc/conf.d/vdr.plugins else einfo "Migrating PLUGINS setting from /etc/conf.d/vdr to /etc/conf.d/vdr.plugins" local PLUGIN for PLUGIN in $(source "${EROOT}"/etc/conf.d/vdr;echo $PLUGINS); do echo ${PLUGIN} >> "${ED}"/etc/conf.d/vdr.plugins done fi } pkg_postinst() { elog "${CATEGORY}/${PN} supports an init script" elog "to start a X server" elog "Please refer for detailed info to" elog "/usr/share/doc/${PF} README.x11-setup\n" if use nvram; then elog "nvram wakeup is optional." elog "To make use of it emerge sys-power/nvram-wakeup.\n" fi elog "Plugins which should be used are set via its" elog "own config-file called /etc/conf.d/vdr.plugins" elog "or enabled via the frontend eselect vdr-plugin.\n" if [[ -f "${EROOT}"/etc/conf.d/vdr.dvdswitch ]] && grep -q ^DVDSWITCH_BURNSPEED= "${EROOT}"/etc/conf.d/vdr.dvdswitch then ewarn "You are setting DVDSWITCH_BURNSPEED in /etc/conf.d/vdr.dvdswitch" ewarn "This no longer has any effect, please use" ewarn "VDR_DVDBURNSPEED in /etc/conf.d/vdr.cd-dvd" fi elog "systemd is supported by ${CATEGORY}/${PN}" elog "This are described in the README.systemd file" elog "in /usr/share/doc/${PF}" } VDRSUDOENTRY="vdr ALL=NOPASSWD:/usr/share/vdr/bin/vdrshutdown-really.sh" pkg_config() { if grep -q /usr/share/vdr/bin/vdrshutdown-really.sh "${EROOT}"/etc/sudoers; then einfo "Removing depricated entry from /etc/sudoers:" einfo "- ${VDRSUDOENTRY}" cd "${T}" cat >sudoedit-vdr.sh <<-SUDOEDITOR #!/bin/bash sed -i \${1} -e '/\/usr\/share\/vdr\/bin\/vdrshutdown-really.sh *$/d' SUDOEDITOR chmod a+x sudoedit-vdr.sh VISUAL="${T}"/sudoedit-vdr.sh visudo -f "${EROOT}"/etc/sudoers || die "visudo failed" einfo "Edited /etc/sudoers" fi }