#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here
if [ -x "/usr/bin/rpm" -a -e "/tmp/ltib" ]
then
    echo "rebuilding rpm database"
    rm -rf /tmp/ltib
    rpm --rebuilddb
fi

# fix up permissions
if [ -d /home/user ]
then
    chown -R user.user /home/user
fi

# Add nodes when running under the hypervisor and static devices
if [ -r /sys/class/misc/fsl-hv/dev -a ! -r /dev/fsl-hv ]
then
   echo "creating hypervisor nodes"
   DEVID=`cat /sys/class/misc/fsl-hv/dev`
   if [ -n "$DEVID" ]
   then
       MAJOR="${DEVID%:*}"
       MINOR="${DEVID##*:}"

       if [ \( "$MAJOR" -gt 0 \) -a \( "$MINOR" -gt 0 \) ]
       then
	   rm -f /dev/fsl-hv
	   mknod /dev/fsl-hv c $MAJOR $MINOR
       fi
   fi
   for i in 0 1 2 3 4 5 6 7
   do
       mknod /dev/hvc$i c 229 $i
   done
fi

# add the fm device nodes
if [ -n "$(cat /proc/devices | grep fm | sed 's/\([0-9]*\).*/\1/')" -a ! -r /dev/fm0 ]
then
    echo "creating fman device nodes"
    cd /usr/share/doc/fmd-uspace-01.01/test/
    sh fm_dev_create
    cd -
fi

for i in 0 1 2; do
    if [ -e /sys/class/graphics/fb$i ]; then
        chmod 0666 /sys/class/graphics/fb$i/pan
    fi
done
#web server
/sbin/boa 
#lighttpd
#/forlinx/web/lighttpd/sbin/lighttpd -f /forlinx/web/lighttpd/config/lighttpd.conf
#lighttpd
alsactl restore
echo 252 > /sys/class/gpio/export
echo 0 > /sys/class/gpio/gpio252/value
ulimit -c unlimited
echo /usr/local/core.%e.%p> /proc/sys/kernel/core_pattern
source /etc/rc.d/qt_env.sh
source /etc/rc.d/apps.sh &
