gentoo-vdr-scripts-2.5.ebuild 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils user
  5. DESCRIPTION="Scripts necessary for use of vdr as a set-top-box"
  6. HOMEPAGE="https://www.gentoo.org/"
  7. SRC_URI="mirror://gentoo/${P}.tar.bz2
  8. https://dev.gentoo.org/~hd_brummy/distfiles/${P}.tar.bz2"
  9. LICENSE="GPL-2"
  10. SLOT="0"
  11. KEYWORDS="amd64 ~arm ~ppc x86"
  12. IUSE="nvram"
  13. RDEPEND="nvram? ( sys-power/nvram-wakeup )
  14. app-admin/sudo
  15. sys-process/wait_on_pid"
  16. VDR_HOME=/var/vdr
  17. pkg_setup() {
  18. enewgroup vdr
  19. # Add user vdr to these groups:
  20. # video - accessing dvb-devices
  21. # audio - playing sound when using software-devices
  22. # cdrom - playing dvds/audio-cds ...
  23. enewuser vdr -1 /bin/bash "${VDR_HOME}" vdr,video,audio,cdrom
  24. }
  25. src_prepare() {
  26. # moved into own package
  27. sed -e '/SUBDIRS =/s# bin # #' -i usr/Makefile
  28. sed -e '/all:/s#compile##' -i Makefile
  29. }
  30. src_install() {
  31. emake -s install DESTDIR="${D}" || die "make install failed"
  32. dodoc README TODO ChangeLog README.grub2 README.shutdown README.shutdown-jobs README.systemd README.vdrcaps
  33. # create necessary directories
  34. diropts -ovdr -gvdr
  35. keepdir "${VDR_HOME}"
  36. local kd
  37. for kd in shutdown-data merged-config-files dvd-images tmp; do
  38. keepdir "${VDR_HOME}/${kd}"
  39. done
  40. }
  41. pkg_preinst() {
  42. local PLUGINS_NEW=0
  43. if [[ -f "${ROOT}"/etc/conf.d/vdr.plugins ]]; then
  44. PLUGINS_NEW=$(grep -v '^#' "${ROOT}"/etc/conf.d/vdr.plugins |grep -v '^$'|wc -l)
  45. fi
  46. if [[ ${PLUGINS_NEW} > 0 ]]; then
  47. cp "${ROOT}"/etc/conf.d/vdr.plugins "${D}"/etc/conf.d/vdr.plugins
  48. else
  49. einfo "Migrating PLUGINS setting from /etc/conf.d/vdr to /etc/conf.d/vdr.plugins"
  50. local PLUGIN
  51. for PLUGIN in $(source "${ROOT}"/etc/conf.d/vdr;echo $PLUGINS); do
  52. echo ${PLUGIN} >> "${D}"/etc/conf.d/vdr.plugins
  53. done
  54. fi
  55. has_version "<${CATEGORY}/${PN}-0.5.4"
  56. previous_less_than_0_5_4=$?
  57. }
  58. VDRSUDOENTRY="vdr ALL=NOPASSWD:/usr/share/vdr/bin/vdrshutdown-really.sh"
  59. pkg_postinst() {
  60. if [[ $previous_less_than_0_5_4 = 0 ]] ; then
  61. einfo "\nVDR use now default the --cachedir parameter to store the epg.file"
  62. einfo "Please do not override this with the EPGFILE variable\n"
  63. einfo "svdrp port 2001 support removed\n"
  64. einfo "--rcu support removed, use media-plugin/vdr-rcu\n"
  65. fi
  66. elog "nvram wakeup is optional."
  67. elog "To make use of it emerge sys-power/nvram-wakeup."
  68. elog
  69. elog "Plugins which should be used are now set via its"
  70. elog "own config-file called /etc/conf.d/vdr.plugins"
  71. elog "or enabled via the frontend eselect vdr-plugin."
  72. elog
  73. if [[ -f "${ROOT}/etc/init.d/dvbsplash" ]]; then
  74. ewarn
  75. ewarn "You have dvbsplash installed!"
  76. ewarn "/etc/init.d/dvbsplash will now be deleted"
  77. ewarn "as it causes difficult to debug problems."
  78. ewarn
  79. rm "${ROOT}/etc/init.d/dvbsplash"
  80. fi
  81. if [[ -f "${ROOT}"/etc/conf.d/vdr.dvdswitch ]] &&
  82. grep -q ^DVDSWITCH_BURNSPEED= "${ROOT}"/etc/conf.d/vdr.dvdswitch
  83. then
  84. ewarn "You are setting DVDSWITCH_BURNSPEED in /etc/conf.d/vdr.dvdswitch"
  85. ewarn "This no longer has any effect, please use"
  86. ewarn "VDR_DVDBURNSPEED in /etc/conf.d/vdr.cd-dvd"
  87. fi
  88. einfo "systemd is now supported by gentoo-vdr-scripts"
  89. einfo "Please read for detailed info on this vdr's README.systemd"
  90. }
  91. pkg_config() {
  92. if grep -q /usr/share/vdr/bin/vdrshutdown-really.sh "${ROOT}"/etc/sudoers; then
  93. einfo "Removing depricated entry from /etc/sudoers:"
  94. einfo "- ${VDRSUDOENTRY}"
  95. cd "${T}"
  96. cat >sudoedit-vdr.sh <<-SUDOEDITOR
  97. #!/bin/bash
  98. sed -i \${1} -e '/\/usr\/share\/vdr\/bin\/vdrshutdown-really.sh *$/d'
  99. SUDOEDITOR
  100. chmod a+x sudoedit-vdr.sh
  101. VISUAL="${T}"/sudoedit-vdr.sh visudo -f "${ROOT}"/etc/sudoers || die "visudo failed"
  102. einfo "Edited /etc/sudoers"
  103. fi
  104. }