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.

129 lines
3.7 KiB

  1. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # T2 SDE: package/.../runit/runit.conf
  5. # Copyright (C) 2004 - 2006 The T2 SDE Project
  6. # Copyright (C) 1998 - 2003 Clifford Wolf
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- T2-COPYRIGHT-NOTE-END ---
  15. [ "$prefix" = usr ] && sbindir="sbin"
  16. . $base/package/*/runit/djb-config admin $sbindir
  17. hook_add postmake 6 'pkg_runit_addservices'
  18. if ! pkginstalled daemontools; then
  19. hook_add postmake 7 ' \
  20. [ "$pkg_djb_commanddir" ] && add_flist $pkg_djb_commanddir; \
  21. [ "$pkg_djb_servicedir" ] && add_flist $pkg_djb_servicedir; \
  22. [ "$pkg_djb_packagedir" ] && add_flist $pkg_djb_packagedir; '
  23. fi
  24. pkg_runit_addservices() {
  25. local agettyargs speed
  26. # main scripts and virtual consoles
  27. # only if it is INIT
  28. if [ "$SDECFG_INIT" == "runit" ]; then
  29. #if [ ! -f $root/$sysconfdir/1 ]; then
  30. echo "Creating main scripts and virtual consoles..."
  31. mkdir -p $root/$sysconfdir
  32. cp -vf ./doc/debian/[123] $root/$sysconfdir/
  33. cp -vf ./doc/debian/ctrlaltdel $root/$sysconfdir/
  34. chmod 744 $root/$sysconfdir/[123]
  35. chmod 744 $root/$sysconfdir/ctrlaltdel
  36. mkdir -p $root/$sysconfdir/{1,3}.d
  37. for i in console 1 2 3 4 5 6; do
  38. if [ "$i" == "console" ]; then
  39. echo "Creating getty $i..."
  40. speed=9600
  41. else
  42. echo "Creating getty tty$i..."
  43. i="vc/$i"
  44. speed=38400
  45. fi
  46. mkdir -p $root/$sysconfdir/getty-${i#vc/}
  47. if [ "$i" == "console" -o "$i" == "vc/1" ]; then
  48. agettyargs='-L -i -I '"'"'\012\015\012Maintenance Console:\012'"'"
  49. else
  50. agettyargs='-f /etc/issue.ansi'
  51. fi
  52. cat << EOT > $root/$sysconfdir/getty-${i#vc/}/run
  53. #!/bin/sh
  54. exec /sbin/agetty $agettyargs $speed $i linux
  55. EOT
  56. cat << EOT > $root/$sysconfdir/getty-${i#vc/}/finish
  57. #!/bin/sh
  58. exec ${pkg_djb_commanddir#$root}/utmpset -w $i
  59. EOT
  60. chmod 755 $root/$sysconfdir/getty-${i#vc/}/{run,finish}
  61. done
  62. #fi
  63. # getties to svscan
  64. echo "Make getties available to svscan..."
  65. for i in 1 2 3 4 5 6; do
  66. ln -snfv $sysconfdir/getty-$i $pkg_djb_servicedir/
  67. done
  68. # HACK, runit need it's own system initializer
  69. install_init system $confdir/../sysvinit/system.init
  70. ln -snfv /etc/rc.d/init.d/system "$root/$sysconfdir/1.d/01system"
  71. ln -snfv /etc/rc.d/init.d/system "$root/$sysconfdir/3.d/99system"
  72. # init at /sbin
  73. if [ ${pkg_djb_commanddir} != $root/$sbindir ]; then
  74. echo "Copying init files to /sbin..."
  75. cp -vf $root$( readlink ${pkg_djb_commanddir}/runit ) $root/$sbindir/
  76. cp -vf $root$( readlink ${pkg_djb_commanddir}/runit-init ) $root/$sbindir/init
  77. fi
  78. fi
  79. ln -sfv forced_reboot $pkg_djb_commanddir/forced_poweroff
  80. # Emulate daemontools if not present using chpst
  81. if ! pkginstalled daemontools; then
  82. echo "Emulate functionality of daemontools with chpst."
  83. for x in softlimit envdir envuidgid pgrphack setlock setuidgid;
  84. do
  85. ln -sfv chpst $pkg_djb_commanddir/$x
  86. done
  87. fi
  88. }
  89. if [ "$SDECFG_PKG_DJB_LAYOUT" == "1" ]; then
  90. hook_add premake 5 "for x in ./doc/debian/*; do \
  91. if [ -f \$x ]; then \
  92. echo Fixing \$x... ; \
  93. sed -i -e 's,/var/service,/service,g' \$x ; \
  94. fi ; \
  95. done"
  96. runit_profile_d() {
  97. cat <<-EOP > $root/etc/profile.d/runit
  98. export PATH=/command:\$PATH
  99. EOP
  100. }
  101. hook_add postmake 5 'runit_profile_d'
  102. else
  103. hook_add premake 5 "for x in ./doc/debian/*; do \
  104. if [ -f \$x ]; then \
  105. echo Fixing \$x... ; \
  106. sed -i -e 's,/command:,,g' \$x ; \
  107. fi ; \
  108. done"
  109. hook_add postinstall 8 'sed -i -e "s,/service,/var/service,g" \
  110. $root/lib/network/runit.sh'
  111. fi