OpenSDE Packages Database (without history before r20070)
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.

118 lines
3.3 KiB

  1. #!/bin/sh
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: package/.../runit/parse-config
  6. # Copyright (C) 2008 The OpenSDE Project
  7. # Copyright (C) 2004 - 2006 The T2 SDE Project
  8. # Copyright (C) 1998 - 2003 Clifford Wolf
  9. #
  10. # More information can be found in the files COPYING and README.
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; version 2 of the License. A copy of the
  15. # GNU General Public License can be found in the file COPYING.
  16. # --- SDE-COPYRIGHT-NOTE-END ---
  17. #
  18. # add init scripts
  19. #
  20. if pkginstalled runit; then
  21. # runit_substitute
  22. #
  23. runit_substitute() {
  24. local logdir
  25. if [ "${localstatedir%$pkg}" != "$localstatedir" ]; then
  26. logdir=$localstatedir/log
  27. else
  28. logdir=$localstatedir/log/$pkg
  29. fi
  30. sed -e "s,D_logdir,$logdir,g" $1
  31. }
  32. # runit_tail_prepare /foo/bar/$pkg-$service.tail
  33. #
  34. runit_tail_prepare() {
  35. local tailfile=$1 pkg=$2
  36. local service=` echo $tailfile | sed -e "s,^.*/$pkg-,," -e "s,\.tail\$,," -e "s,_,/,g"`
  37. local servicedir=
  38. if [ "${service#runit-}" != "$service" ]; then
  39. servicedir=\$root/etc/runit/${service#runit-}
  40. else
  41. servicedir=\$root\$sysconfdir/$service
  42. fi
  43. echo_status "runit: Setting conf to install ${servicedir#\$root}/ (TAIL)"
  44. hook_add postdoc 5 "tail_install runit '$tailfile' '$servicedir'"
  45. }
  46. runitconfdir=$base/package/*/runit
  47. runit_has_script=0
  48. for x in $( ls -1 $runitconfdir/packages/$pkg-*.tail 2> /dev/null ); do
  49. runit_tail_prepare $x $pkg
  50. runit_has_script=1
  51. done
  52. for x in $( cd $runitconfdir/packages; ls -1 $pkg-*.txt 2> /dev/null ); do
  53. y=${x#$pkg-}; y=${y%.txt}; y=${y//_/\/}
  54. if [ "${y#runit-}" != "$y" ]; then
  55. y=\$root/etc/runit/${y#runit-}
  56. else
  57. y=\$root/\$sysconfdir/$y
  58. fi
  59. echo_status "runit: Setting conf to install $y"
  60. runit_has_script=1
  61. case "${y##*/}" in
  62. run|finish) runitxmode=1 ;;
  63. *) runitxmode= ;;
  64. esac
  65. hook_add postmake 8 "mkdir -p ${y%/*}; \
  66. ${runitxmode:+chmod 755 ${y%/*};} \
  67. cat $runitconfdir/packages/$x | rock_substitute \
  68. | runit_substitute > $y; \
  69. ${runitxmode:+chmod 755 $y;}"
  70. done
  71. if [ "$SDECFG_INIT" == "runit" ]; then
  72. if [ $runit_has_script -eq 1 ]; then
  73. install_init() {
  74. # i have already installed the script
  75. true
  76. }
  77. else
  78. install_init() {
  79. name=$1 ; file=$2 ; initdir="$root/etc/rc.d"
  80. echo -n "Install SysV Init script '$name' (xx/xx): "
  81. m4 -Dinitstyle=$SDECFG_INIT_STYLE \
  82. -D"D_prefix=/$prefix" -D"D_sysconfdir=$sysconfdir" \
  83. -D"D_docdir=$docdir" -D"D_localstatedir=$localstatedir" \
  84. -D"D_datadir=$datadir" -D"D_infodir=$infodir" \
  85. -D"D_bindir=$bindir" -D"D_sbindir=$sbindir" \
  86. -D"D_libdir=$libdir" -D"D_mandir=$mandir" \
  87. $base/package/base/sysvinit/init_macros.m4 \
  88. $file > $initdir/init.d/$name
  89. chmod +x $initdir/init.d/$name
  90. echo " done."
  91. }
  92. fi
  93. fi
  94. unset runitconfdir runitxmode runit_has_script
  95. # minimal services
  96. case "$pkg" in
  97. cron)
  98. hook_add postmake 9 'ln -svnf /etc/runit/cron $pkg_djb_servicedir/cron'
  99. ;;
  100. sysklogd)
  101. hook_add postmake 9 'ln -svnf /etc/runit/syslogd $pkg_djb_servicedir/syslogd'
  102. hook_add postmake 9 'ln -svnf /etc/runit/klogd $pkg_djb_servicedir/klogd'
  103. ;;
  104. esac
  105. fi