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.

137 lines
3.9 KiB

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