rc.multiuser 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. #! /bin/sh -
  2. #
  3. # Multi-user mode script
  4. #
  5. # Copyright (c) 2018-2021 Matias Fonzo, <selk@dragora.org>.
  6. #
  7. # Licensed under the Apache License, Version 2.0 (the "License");
  8. # you may not use this file except in compliance with the License.
  9. # You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS,
  15. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. # See the License for the specific language governing permissions and
  17. # limitations under the License.
  18. # To reflect the name of this script
  19. RC="[${0##*/}]"
  20. umask 022
  21. IFS='
  22. '
  23. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin
  24. LC_ALL=C
  25. ### X11-related database
  26. echo "${RC}: Updating X11 database (X.Org), if available"
  27. echo "${RC}: X font index cache ..."
  28. if command -v mkfontscale > /dev/null
  29. then
  30. for directory in /usr/share/fonts/X11/*
  31. do
  32. if test ! -e "${directory}/fonts.dir"
  33. then
  34. echo "Using \`mkfontscale' for missing fonts.dir at $directory" 1>&2
  35. mkfontscale -b -s -l "$directory" && mkfontscale "$directory"
  36. fi
  37. done
  38. unset -v directory
  39. fi
  40. echo "${RC}: fontconfig cache: fc-cache --system-only /usr/share/fonts/X11 &"
  41. if command -v fc-cache > /dev/null
  42. then
  43. fc-cache --system-only /usr/share/fonts/X11 &
  44. else
  45. echo " Could not find fc-cache(1)" 1>&2
  46. fi
  47. echo "${RC}: GTK+-2.0 modules: gtk-query-immodules-2.0 --update-cache &"
  48. if command -v gtk-query-immodules-2.0 > /dev/null
  49. then
  50. gtk-query-immodules-2.0 --update-cache &
  51. else
  52. echo " Could not find gtk-query-immodules-2.0" 1>&2
  53. fi
  54. echo "${RC}: GTK+-3.0 modules: gtk-query-immodules-3.0 --update-cache &"
  55. if command -v gtk-query-immodules-3.0 > /dev/null
  56. then
  57. gtk-query-immodules-3.0 --update-cache &
  58. else
  59. echo " Could not find gtk-query-immodules-3.0" 1>&2
  60. fi
  61. echo "${RC}: GDK pixbuffer loaders: gdk-pixbuf-query-loaders --update-cache &"
  62. if command -v gdk-pixbuf-query-loaders > /dev/null
  63. then
  64. gdk-pixbuf-query-loaders --update-cache &
  65. else
  66. echo " Could not find gdk-pixbuf-query-loaders(1)" 1>&2
  67. fi
  68. echo "${RC}: GIO modules: gio-querymodules /usr/lib/gio/modules &"
  69. if command -v gio-querymodules > /dev/null
  70. then
  71. if test -r /usr/lib/gio/modules
  72. then
  73. gio-querymodules /usr/lib/gio/modules &
  74. else
  75. echo " Could not read /usr/lib/gio/modules" 1>&2
  76. fi
  77. else
  78. echo " Could not find gio-querymodules(1)" 1>&2
  79. fi
  80. echo "${RC}: Glib schemas: glib-compile-schemas /usr/share/glib-2.0/schemas"
  81. if command -v glib-compile-schemas > /dev/null
  82. then
  83. if test -r /usr/share/glib-2.0/schemas
  84. then
  85. glib-compile-schemas /usr/share/glib-2.0/schemas
  86. else
  87. echo " Could not read /usr/share/glib-2.0/schemas" 1>&2
  88. fi
  89. else
  90. echo " Could not find glib-compile-schemas(1)" 1>&2
  91. fi
  92. echo "${RC}: MIME database: update-mime-database /usr/share/mime &"
  93. if command -v update-mime-database > /dev/null
  94. then
  95. update-mime-database /usr/share/mime &
  96. else
  97. echo " Could not find update-mime-database(1)" 1>&2
  98. fi
  99. echo "${RC}: Desktop database: update-desktop-database -q &"
  100. if command -v update-desktop-database > /dev/null
  101. then
  102. update-desktop-database -q &
  103. else
  104. echo " Could not find update-desktop-database(1)" 1>&2
  105. fi
  106. ### ^ End Of 'X11-related database'
  107. # Start FUSE filesystem
  108. if test -x /etc/rc.d/rc.fuse
  109. then
  110. /etc/rc.d/rc.fuse start
  111. fi
  112. # Start services through perpd(8) instances
  113. echo "${RC}: Starting process supervisor under perpd(8) instances"
  114. if ! pidof perpd > /dev/null
  115. then
  116. perpboot -d /etc/perp
  117. else
  118. echo " perpd(8) is already running." 1>&2
  119. fi
  120. # Start GPM (General Purpose Mouse daemon)
  121. if test -x /etc/rc.d/rc.gpm
  122. then
  123. /etc/rc.d/rc.gpm
  124. fi
  125. # Verify the /etc/fstab file to activate the quota file system
  126. echo "${RC}: Checking quota availability"
  127. if grep -E -q -m 1 '(usr|grp)quota' /etc/fstab
  128. then
  129. echo "${RC}: Checking /etc/fstab for quota usage"
  130. if quotacheck -vugcm
  131. then
  132. echo "${RC}: Turning ON quota file system: quotaon -vaug"
  133. quotaon -vaug
  134. fi
  135. else
  136. echo "${RC}: No quota filesystem declared on /etc/fstab." 1>&2
  137. fi
  138. # Start user-local instructions
  139. if test -x /etc/rc.d/rc.local
  140. then
  141. echo "${RC}: Running /etc/rc.d/rc.local"
  142. /etc/rc.d/rc.local
  143. fi