mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
3.0 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/package/mnemoc/runit/parse-config
  9. # ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; either version 2 of the License, or
  14. # (at your option) any later version. A copy of the GNU General Public
  15. # License can be found at Documentation/COPYING.
  16. #
  17. # Many people helped and are helping developing ROCK Linux. Please
  18. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  19. # file for details.
  20. #
  21. # --- ROCK-COPYRIGHT-NOTE-END ---
  22. #
  23. # prepare root links for DJB filesystem hierarchy inside chrooted env.
  24. #
  25. if [ "$ROCKCFG_PKG_DJB_LAYOUT" == "1" ]; then
  26. for x in package command service; do
  27. eval "pkg_djb_${x}dir='$x'"
  28. var_append flistroot ' ' $x
  29. done
  30. #pkg_djb_compatdir="usr/local/bin"
  31. elif [ "$ROCKCFG_PKG_DJB_LAYOUT" == "0" ]; then
  32. pkg_djb_packagedir=""
  33. pkg_djb_commanddir=""
  34. pkg_djb_servicedir="var/service"
  35. #pkg_djb_compatdir=""
  36. fi
  37. # package
  38. if [ "$pkg_djb_packagedir" ]; then
  39. mkdir -p $xroot/$pkg_djb_packagedir
  40. chmod 1755 $xroot/$pkg_djb_packagedir
  41. pkg_djb_packagedir=$root/$pkg_djb_packagedir
  42. fi
  43. # service
  44. if [ "$pkg_djb_servicedir" ]; then
  45. mkdir -p $xroot/$pkg_djb_servicedir
  46. chmod 1755 $xroot/$pkg_djb_servicedir
  47. pkg_djb_servicedir=$root/$pkg_djb_servicedir
  48. fi
  49. # command
  50. if [ "$pkg_djb_commanddir" ]; then
  51. mkdir -p $xroot/$pkg_djb_commanddir
  52. pkg_djb_commanddir=$root/$pkg_djb_commanddir
  53. fi
  54. #
  55. # add init scripts
  56. #
  57. if pkgcheck runit X; then
  58. # runit_substitute
  59. #
  60. runit_substitute() {
  61. local logdir
  62. if [ "${localstatedir%$pkg}" != "$localstatedir" ]; then
  63. logdir=$localstatedir/log
  64. else
  65. logdir=$localstatedir/log/$pkg
  66. fi
  67. sed -e "s,D_logdir,$logdir,g" $1 > $1.new
  68. mv $1.new $1
  69. }
  70. runitconfdir=$base/package/mnemoc/runit
  71. for x in $( cd $runitconfdir/packages; ls -1 $pkg-*.txt 2> /dev/null ); do
  72. y=${x#$pkg-}; y=${y%.txt}; y=${y//_/\/}
  73. if [ "${y#runit-}" != "$y" ]; then
  74. y=\$root/etc/runit/${y#runit-}
  75. else
  76. y=\$sysconfdir/$y
  77. fi
  78. echo_status "runit: Setting conf to install $y"
  79. case "${y##*/}" in
  80. run|finish) runitxmode=1 ;;
  81. *) runitxmode= ;;
  82. esac
  83. hook_add postmake 8 "mkdir -p ${y%/*}; \
  84. ${runitxmode:+chmod 755 ${y%/*};} \
  85. rock_substitute $runitconfdir/packages/$x > $y; \
  86. runit_substitute $y; \
  87. ${runitxmode:+chmod 755 $y;}"
  88. done
  89. unset runitconfdir runitxmode
  90. # minimal services
  91. case "$pkg" in
  92. cron)
  93. hook_add postmake 9 'ln -svf /etc/runit/cron $pkg_djb_servicedir/cron'
  94. ;;
  95. sysklogd)
  96. hook_add postmake 9 'ln -svf /etc/runit/syslogd $pkg_djb_servicedir/syslogd'
  97. hook_add postmake 9 'ln -svf /etc/runit/klogd $pkg_djb_servicedir/klogd'
  98. ;;
  99. esac
  100. fi