gentoo-vdr-scripts-2.7.5.ebuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit 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_install() {
  26. local DOCS=( README* TODO ChangeLog )
  27. default
  28. # create necessary directories
  29. diropts -ovdr -gvdr
  30. keepdir "${VDR_HOME}"
  31. local kd
  32. for kd in shutdown-data merged-config-files dvd-images; do
  33. keepdir "${VDR_HOME}/${kd}"
  34. done
  35. }
  36. pkg_preinst() {
  37. local PLUGINS_NEW=0
  38. if [[ -f "${ROOT}"/etc/conf.d/vdr.plugins ]]; then
  39. PLUGINS_NEW=$(grep -v '^#' "${ROOT}"/etc/conf.d/vdr.plugins |grep -v '^$'|wc -l)
  40. fi
  41. if [[ ${PLUGINS_NEW} > 0 ]]; then
  42. cp "${ROOT}"/etc/conf.d/vdr.plugins "${D}"/etc/conf.d/vdr.plugins
  43. else
  44. einfo "Migrating PLUGINS setting from /etc/conf.d/vdr to /etc/conf.d/vdr.plugins"
  45. local PLUGIN
  46. for PLUGIN in $(source "${ROOT}"/etc/conf.d/vdr;echo $PLUGINS); do
  47. echo ${PLUGIN} >> "${D}"/etc/conf.d/vdr.plugins
  48. done
  49. fi
  50. has_version "<${CATEGORY}/${PN}-0.5.4"
  51. previous_less_than_0_5_4=$?
  52. has_version "<${CATEGORY}/${PN}-2.6"
  53. previous_less_than_2_6=$?
  54. }
  55. VDRSUDOENTRY="vdr ALL=NOPASSWD:/usr/share/vdr/bin/vdrshutdown-really.sh"
  56. pkg_postinst() {
  57. if [[ $previous_less_than_0_5_4 = 0 ]] ; then
  58. elog "\nVDR use now default the --cachedir parameter to store the epg.file"
  59. elog "Please do not override this with the EPGFILE variable\n"
  60. elog "svdrp port 2001 support removed\n"
  61. elog "--rcu support removed, use media-plugin/vdr-rcu\n"
  62. fi
  63. if [[ $previous_less_than_2_6 = 0 ]]; then
  64. elog "${CATEGORY}/${PN} supports now a init script"
  65. elog "to start a X server"
  66. elog "Please refer for detailed info to"
  67. elog "${CATGORY}/${PN} README.x11-setup\n"
  68. fi
  69. if use nvram; then
  70. elog "nvram wakeup is optional."
  71. elog "To make use of it emerge sys-power/nvram-wakeup.\n"
  72. fi
  73. elog "Plugins which should be used are now set via its"
  74. elog "own config-file called /etc/conf.d/vdr.plugins"
  75. elog "or enabled via the frontend eselect vdr-plugin.\n"
  76. if [[ -f "${ROOT}"/etc/conf.d/vdr.dvdswitch ]] &&
  77. grep -q ^DVDSWITCH_BURNSPEED= "${ROOT}"/etc/conf.d/vdr.dvdswitch
  78. then
  79. ewarn "You are setting DVDSWITCH_BURNSPEED in /etc/conf.d/vdr.dvdswitch"
  80. ewarn "This no longer has any effect, please use"
  81. ewarn "VDR_DVDBURNSPEED in /etc/conf.d/vdr.cd-dvd"
  82. fi
  83. elog "systemd is supported by ${CATEGORY}/${PN}"
  84. elog "Please read for detailed info on this"
  85. elog "${CATEGORY}/${PN} README.systemd"
  86. }
  87. pkg_config() {
  88. if grep -q /usr/share/vdr/bin/vdrshutdown-really.sh "${ROOT}"/etc/sudoers; then
  89. einfo "Removing depricated entry from /etc/sudoers:"
  90. einfo "- ${VDRSUDOENTRY}"
  91. cd "${T}"
  92. cat >sudoedit-vdr.sh <<-SUDOEDITOR
  93. #!/bin/bash
  94. sed -i \${1} -e '/\/usr\/share\/vdr\/bin\/vdrshutdown-really.sh *$/d'
  95. SUDOEDITOR
  96. chmod a+x sudoedit-vdr.sh
  97. VISUAL="${T}"/sudoedit-vdr.sh visudo -f "${ROOT}"/etc/sudoers || die "visudo failed"
  98. einfo "Edited /etc/sudoers"
  99. fi
  100. }