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.

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