phctool-0.5.2.2-r3.ebuild 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. PYTHON_COMPAT=( python2_7 )
  5. inherit python-single-r1 user
  6. DESCRIPTION="Processor Hardware Control userland configuration tool"
  7. HOMEPAGE="http://www.linux-phc.org/"
  8. SRC_URI="http://www.linux-phc.org/forum/download/file.php?id=50 -> ${P}.tar.gz"
  9. LICENSE="GPL-2"
  10. SLOT="0"
  11. KEYWORDS="~amd64 ~x86"
  12. IUSE="doc sudo"
  13. DEPEND="${PYTHON_DEPS}
  14. dev-python/egg-python[${PYTHON_USEDEP}]
  15. dev-python/pygtk:2[${PYTHON_USEDEP}]"
  16. RDEPEND="${DEPEND}
  17. sudo? ( app-admin/sudo )"
  18. REQUIRED_USE="${PYTHON_REQUIRED_USE}"
  19. S="${WORKDIR}/${PV%.*}-${PV##*.}/${PN}"
  20. pkg_setup() {
  21. MY_PROGDIR="/usr/share/${PN}"
  22. if use sudo ; then
  23. MY_GROUPNAME="phcusers"
  24. enewgroup ${MY_GROUPNAME}
  25. fi
  26. python-single-r1_pkg_setup
  27. }
  28. src_prepare() {
  29. eapply "${FILESDIR}"/${P}_all_paths_tray.patch
  30. if use sudo ; then
  31. eapply "${FILESDIR}"/${P}_all_paths_tool_sudo.patch
  32. else
  33. eapply "${FILESDIR}"/${P}_all_paths_tool_no_sudo.patch
  34. fi
  35. eapply "${FILESDIR}"/${P}_kernel_2.6.36.patch
  36. eapply "${FILESDIR}"/${P}_gui_kernel_2.6.38.patch
  37. eapply_user
  38. find . -name "*.pyc" -delete || die
  39. python_fix_shebang .
  40. }
  41. src_install() {
  42. newbin phctool.sh phctool
  43. newbin phctray.sh phctray
  44. exeinto ${MY_PROGDIR}
  45. doexe phc{tool,tray}.py subphctool.sh
  46. python_moduleinto ${MY_PROGDIR}
  47. python_domodule inc
  48. if use sudo ; then
  49. fowners -R ":${MY_GROUPNAME}" "${MY_PROGDIR}"
  50. fperms g+rX "${MY_PROGDIR}"
  51. dodir /etc/sudoers.d
  52. echo "#%${MY_GROUPNAME} ALL=(root) NOPASSWD:${MY_PROGDIR}/subphctool.sh" \
  53. > "${ED}"/etc/sudoers.d/${PN} || die
  54. fperms a-w,o-r /etc/sudoers.d/${PN}
  55. fi
  56. dodoc CHANGELOG
  57. if use doc; then
  58. docinto html
  59. dodoc -r doc/docfiles doc/index.htm
  60. fi
  61. }
  62. pkg_postinst() {
  63. if use sudo; then
  64. einfo "You have to add a line to /etc/sudoers to get access to"
  65. einfo "/sys/devices/system/cpu/cpu1/cpufreq/phc_controls from the phctool/phctray"
  66. einfo "Please check and uncomment the content of /etc/sudoers.d/${PN}"
  67. else
  68. einfo "Group not automatically added. Please run phctool as root."
  69. fi
  70. }