rc.multiuser 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. #! /bin/sh -
  2. #
  3. # Multi-user mode script
  4. #
  5. # Copyright (c) 2018-2022 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}: Glib schemas: glib-compile-schemas /usr/share/glib-2.0/schemas"
  69. if command -v glib-compile-schemas > /dev/null
  70. then
  71. if test -r /usr/share/glib-2.0/schemas
  72. then
  73. glib-compile-schemas /usr/share/glib-2.0/schemas
  74. else
  75. echo " Could not read /usr/share/glib-2.0/schemas" 1>&2
  76. fi
  77. else
  78. echo " Could not find glib-compile-schemas(1)" 1>&2
  79. fi
  80. echo "${RC}: MIME database: update-mime-database /usr/share/mime &"
  81. if command -v update-mime-database > /dev/null
  82. then
  83. update-mime-database /usr/share/mime &
  84. else
  85. echo " Could not find update-mime-database(1)" 1>&2
  86. fi
  87. echo "${RC}: Desktop database: update-desktop-database -q &"
  88. if command -v update-desktop-database > /dev/null
  89. then
  90. update-desktop-database -q &
  91. else
  92. echo " Could not find update-desktop-database(1)" 1>&2
  93. fi
  94. ### ^ End Of 'X11-related database'
  95. # Start FUSE filesystem
  96. if test -x /etc/rc.d/rc.fuse
  97. then
  98. /etc/rc.d/rc.fuse start
  99. fi
  100. # Start services through perpd(8) instances
  101. echo "${RC}: Starting process supervisor under perpd(8) instances"
  102. if ! pidof perpd > /dev/null
  103. then
  104. perpboot -d /etc/perp
  105. else
  106. echo " perpd(8) is already running." 1>&2
  107. fi
  108. # Start GPM (General Purpose Mouse daemon)
  109. if test -x /etc/rc.d/rc.gpm
  110. then
  111. /etc/rc.d/rc.gpm
  112. fi
  113. # Verify the /etc/fstab file to activate the quota file system
  114. echo "${RC}: Checking quota availability"
  115. if grep -E -q -m 1 '(usr|grp)quota' /etc/fstab
  116. then
  117. echo "${RC}: Checking /etc/fstab for quota usage"
  118. if quotacheck -vugcm
  119. then
  120. echo "${RC}: Turning ON quota file system: quotaon -vaug"
  121. quotaon -vaug
  122. fi
  123. else
  124. echo "${RC}: No quota filesystem declared on /etc/fstab." 1>&2
  125. fi
  126. # Start user-local instructions
  127. if test -x /etc/rc.d/rc.local
  128. then
  129. echo "${RC}: Running /etc/rc.d/rc.local"
  130. /etc/rc.d/rc.local
  131. fi