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.

138 lines
3.9 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 - 2006 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 pkginstalled runit; 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 -i -e "s,D_logdir,$logdir,g" $1
  68. }
  69. runitconfdir=$base/package/mnemoc/runit
  70. runit_has_script=0
  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. runit_has_script=1
  80. case "${y##*/}" in
  81. run|finish) runitxmode=1 ;;
  82. *) runitxmode= ;;
  83. esac
  84. hook_add postmake 8 "mkdir -p ${y%/*}; \
  85. ${runitxmode:+chmod 755 ${y%/*};} \
  86. rock_substitute $runitconfdir/packages/$x > $y; \
  87. runit_substitute $y; \
  88. ${runitxmode:+chmod 755 $y;}"
  89. done
  90. # fake ROCK' standard install_init if sysvinit will not be built
  91. if ! pkgcheck sysvinit X; then
  92. if [ $runit_has_script -eq 1 ]; then
  93. install_init() {
  94. # i have already installed the script
  95. true
  96. }
  97. else
  98. install_init() {
  99. name=$1 ; file=$2 ; initdir="$root/etc/rc.d"
  100. echo -n "Install SysV Init script '$name' (xx/xx): "
  101. m4 -Dinitstyle=$ROCKCFG_PKG_SYSVINIT_INITSTYLE \
  102. -D"D_prefix=/$prefix" -D"D_sysconfdir=$sysconfdir" \
  103. -D"D_docdir=$docdir" -D"D_localstatedir=$localstatedir" \
  104. -D"D_datadir=$datadir" -D"D_infodir=$infodir" \
  105. -D"D_bindir=$bindir" -D"D_sbindir=$sbindir" \
  106. -D"D_libdir=$libdir" -D"D_mandir=$mandir" \
  107. $base/package/base/sysvinit/init_macros.m4 \
  108. $file > $initdir/init.d/$name
  109. chmod +x $initdir/init.d/$name
  110. echo " done."
  111. }
  112. fi
  113. fi
  114. unset runitconfdir runitxmode runit_has_script
  115. # minimal services
  116. case "$pkg" in
  117. cron)
  118. hook_add postmake 9 'ln -svf /etc/runit/cron $pkg_djb_servicedir/cron'
  119. ;;
  120. sysklogd)
  121. hook_add postmake 9 'ln -svf /etc/runit/syslogd $pkg_djb_servicedir/syslogd'
  122. hook_add postmake 9 'ln -svf /etc/runit/klogd $pkg_djb_servicedir/klogd'
  123. ;;
  124. esac
  125. fi