#!/bin/sh # # /etc/runit/2: Normally for run the services (Stage 2). # # Version: (#) 1.01 2010-05-18 (MAF) # (#) 1.02 2010-07-02 (MAF) # (#) 2.00 2010-07-09 (MAF) # (#) 2.01 2010-07-20 (MAF) # (#) 2.02 2010-07-31 (MAF) # (#) 2.03 2010-08-21 (MAF) # (#) 2.04 2010-10-23 (MAF) # (#) 2.05 2010-11-18 (MAF) # (#) 2.06 2010-11-25 (MAF) # (#) 2.07 2010-12-16 (MAF) # # Author: Matías A. Fonzo, . # # Under the terms of the GNU General Public License. PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin # Functions. # A function for display a message: msg() { printf '%s\n' "$@"; } # A function for append a log service: exec_runsvdir() { exec env - PATH=$PATH runsvdir -P /service 'log: ..........' } # Check the single user-mode: if grep -q single /proc/cmdline ; then # You are alone on the Rainbow. runsvchdir single > /dev/null exec_runsvdir fi # Update the documentation. # # GNU info documents: if [ -x /usr/bin/install-info ]; then msg "Updating .info documents..." for file in /usr/info/*.gz ; do if [ "$file" -nt "/usr/info/dir" ]; then UPDATE=y break; fi done if [ "$UPDATE" = "y" ] || [ ! -e /usr/info/dir ]; then find /usr/info -maxdepth 1 -type f -name '*.gz' \ -exec /usr/bin/install-info --quiet "{}" /usr/info/dir \; fi fi # Manual pages: if [ -x /usr/bin/mandb ]; then msg "Updating database for manual pages..." MANPATH=/usr/local/man:/usr/man /usr/bin/mandb -q -s -p fi # Initialize the IrDA daemon: # # We need this before to run the PCMCIA subsystem, # if we don't want to leave out some models. if [ -x /etc/rc.d/rc.irda ]; then /etc/rc.d/rc.irda start fi # Initialize the PCMCIA subsystem: if [ -x /etc/rc.d/rc.pcmcia ]; then /etc/rc.d/rc.pcmcia start if [ $? -eq 0 ]; then # Extra time to initialize the PCMCIA card: for number in 5 4 3 2 1 0; do printf "$number " sleep 1 done echo fi fi # Load ALSA sound system: if [ -x /etc/rc.d/rc.alsa ]; then /etc/rc.d/rc.alsa fi # Start the local interface: if [ -x /etc/rc.d/rc.iface_lo ]; then /etc/rc.d/rc.iface_lo start fi # Loading the runit services: runsvchdir default > /dev/null for file in /service/* ; do if [ -L "$file" ] && [ -e "$file" ]; then msg "runit: service: ${file##*/}" fi done # Start message bus daemon: if [ -x /etc/rc.d/rc.messagebus ]; then /etc/rc.d/rc.messagebus start fi # Start HAL daemon: if [ -x /etc/rc.d/rc.hald ]; then /etc/rc.d/rc.hald start fi # Start bluetooth daemon: if [ -x /etc/rc.d/rc.bluez ]; then /etc/rc.d/rc.bluez start fi # Re-populate /sys in order to "coldplug" # devices that have already been discovered: udevadm trigger --action=add # Start the quota support (if needed): if egrep -q -m 1 '(usr|grp)quota' /etc/fstab ; then for mountpoint in \ $(awk '/usrquota/ || /grpquota/ { print $2 }' /etc/fstab) do rm -f ${mountpoint}/*quota.{user,group}.new done if [ -x /usr/sbin/quotacheck ]; then msg "Checking quotas: /usr/sbin/quotacheck -avugm" /usr/sbin/quotacheck -avugm fi if [ -x /usr/sbin/quotaon ]; then msg "Turning on quotas: /usr/sbin/quotaon -avug" /usr/sbin/quotaon -avug fi fi # Update the X database. # Sanity check: mkdir -p -m 1777 /tmp/.ICE-unix /tmp/.X11-unix # X font index cache: if [ -x /usr/bin/fc-cache ]; then msg "Updating X font index cache: /usr/bin/fc-cache -s &" /usr/bin/fc-cache -s & fi # Update pango modules: if [ -x /usr/bin/pango-querymodules ]; then msg "Updating pango modules: /usr/bin/pango-querymodules" /usr/bin/pango-querymodules > /etc/pango/pango.modules fi # Update gtk-2.0 modules: if [ -x /usr/bin/gtk-query-immodules-2.0 ]; then msg "Updating gtk-2.0 modules: /usr/bin/gtk-query-immodules-2.0" /usr/bin/gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules fi # Update gdk pixbuffer loaders: if [ -x /usr/bin/gdk-pixbuf-query-loaders ]; then msg "Updating gdk pixbuffer loaders: /usr/bin/gdk-pixbuf-query-loaders" /usr/bin/gdk-pixbuf-query-loaders --update-cache /usr/bin/gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders fi # Update GIO modules: if [ -x /usr/bin/gio-querymodules ]; then msg "Updating GIO modules cache: /usr/bin/gio-querymodules" if [ -d /usr/lib64/gio/modules ]; then /usr/bin/gio-querymodules /usr/lib64/gio/modules else /usr/bin/gio-querymodules /usr/lib/gio/modules fi fi # MIME database: if [ -x /usr/bin/update-mime-database ]; then msg "Updating mime database: /usr/bin/update-mime-database /usr/share/mime" /usr/bin/update-mime-database /usr/share/mime fi # Desktop database: if [ -x /usr/bin/update-desktop-database ]; then msg "Updating desktop database: /usr/bin/update-desktop-database -q" /usr/bin/update-desktop-database -q fi # Icon cache: if [ -x /usr/bin/gtk-update-icon-cache ] && [ -d /usr/share/icons ]; then msg "Updating icon \`index.theme' cache on /usr/share/icons ..." find /usr/share/icons -type f -name 'index.theme' -printf '%h\n' | \ while read directory ; do /usr/bin/gtk-update-icon-cache -qfi $directory done fi # Start fuse (if not already available): if [ -x /etc/rc.d/rc.fuse ]; then /etc/rc.d/rc.fuse start fi # Start the rc.local script: if [ -x /etc/rc.d/rc.local ]; then msg "Running /etc/rc.d/rc.local..." . /etc/rc.d/rc.local fi exec_runsvdir