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.

130 lines
3.7 KiB

  1. #!/bin/sh
  2. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # T2 SDE: package/.../runit/runit.conf
  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. # --- T2-COPYRIGHT-NOTE-END ---
  16. [ "$prefix" = usr ] && sbindir="sbin"
  17. . $base/package/*/runit/djb-config admin $sbindir
  18. hook_add postmake 6 'pkg_runit_addservices'
  19. if ! pkginstalled daemontools; then
  20. hook_add postmake 7 ' \
  21. [ "$pkg_djb_commanddir" ] && add_flist $pkg_djb_commanddir; \
  22. [ "$pkg_djb_servicedir" ] && add_flist $pkg_djb_servicedir; \
  23. [ "$pkg_djb_packagedir" ] && add_flist $pkg_djb_packagedir; '
  24. fi
  25. pkg_runit_addservices() {
  26. local agettyargs speed
  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. fi
  79. fi
  80. ln -sfv forced_reboot $pkg_djb_commanddir/forced_poweroff
  81. # Emulate daemontools if not present using chpst
  82. if ! pkginstalled daemontools; then
  83. echo "Emulate functionality of daemontools with chpst."
  84. for x in softlimit envdir envuidgid pgrphack setlock setuidgid;
  85. do
  86. ln -sfv chpst $pkg_djb_commanddir/$x
  87. done
  88. fi
  89. }
  90. if [ "$SDECFG_PKG_DJB_LAYOUT" == "1" ]; then
  91. hook_add premake 5 "for x in ./doc/debian/*; do \
  92. if [ -f \$x ]; then \
  93. echo Fixing \$x... ; \
  94. sed -i -e 's,/var/service,/service,g' \$x ; \
  95. fi ; \
  96. done"
  97. runit_profile_d() {
  98. cat <<-EOP > $root/etc/profile.d/runit
  99. export PATH=/command:\$PATH
  100. EOP
  101. }
  102. hook_add postmake 5 'runit_profile_d'
  103. else
  104. hook_add premake 5 "for x in ./doc/debian/*; do \
  105. if [ -f \$x ]; then \
  106. echo Fixing \$x... ; \
  107. sed -i -e 's,/command:,,g' \$x ; \
  108. fi ; \
  109. done"
  110. hook_add postinstall 8 'sed -i -e "s,/service,/var/service,g" \
  111. $root/lib/network/runit.sh'
  112. fi