gentoo-vdr-scripts-2.7.2.ebuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. default
  32. dodoc README* TODO ChangeLog
  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; 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. has_version "<${CATEGORY}/${PN}-2.6"
  58. previous_less_than_2_6=$?
  59. }
  60. VDRSUDOENTRY="vdr ALL=NOPASSWD:/usr/share/vdr/bin/vdrshutdown-really.sh"
  61. pkg_postinst() {
  62. if [[ $previous_less_than_0_5_4 = 0 ]] ; then
  63. elog "\nVDR use now default the --cachedir parameter to store the epg.file"
  64. elog "Please do not override this with the EPGFILE variable\n"
  65. elog "svdrp port 2001 support removed\n"
  66. elog "--rcu support removed, use media-plugin/vdr-rcu\n"
  67. fi
  68. if [[ $previous_less_than_2_6 = 0 ]]; then
  69. elog "${CATEGORY}/${PN} supports now a init script"
  70. elog "to start a X server"
  71. elog "Please refer for detailed info to"
  72. elog "${CATGORY}/${PN} README.x11-setup\n"
  73. fi
  74. if use nvram; then
  75. elog "nvram wakeup is optional."
  76. elog "To make use of it emerge sys-power/nvram-wakeup.\n"
  77. fi
  78. elog "Plugins which should be used are now set via its"
  79. elog "own config-file called /etc/conf.d/vdr.plugins"
  80. elog "or enabled via the frontend eselect vdr-plugin.\n"
  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. elog "systemd is supported by ${CATEGORY}/${PN}"
  89. elog "Please read for detailed info on this"
  90. elog "${CATEGORY}/${PN} README.systemd"
  91. }
  92. pkg_config() {
  93. if grep -q /usr/share/vdr/bin/vdrshutdown-really.sh "${ROOT}"/etc/sudoers; then
  94. einfo "Removing depricated entry from /etc/sudoers:"
  95. einfo "- ${VDRSUDOENTRY}"
  96. cd "${T}"
  97. cat >sudoedit-vdr.sh <<-SUDOEDITOR
  98. #!/bin/bash
  99. sed -i \${1} -e '/\/usr\/share\/vdr\/bin\/vdrshutdown-really.sh *$/d'
  100. SUDOEDITOR
  101. chmod a+x sudoedit-vdr.sh
  102. VISUAL="${T}"/sudoedit-vdr.sh visudo -f "${ROOT}"/etc/sudoers || die "visudo failed"
  103. einfo "Edited /etc/sudoers"
  104. fi
  105. }