#!/bin/sh
# Description: Launch diverses Mandrake Scripts on boot.
# (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com>
# 	$Id: mandrake_everytime,v 1.2 2000/08/28 22:07:12 chmouel Exp $	

. /etc/init.d/functions

SourceIfNotEmpty /etc/sysconfig/system
SourceIfNotEmpty /etc/sysconfig/i18n

# Build KdmSession
if [ -x /usr/sbin/fndSession ]; then
	action "Building Window Manager Sessions:" /usr/sbin/fndSession
fi

# Disabling supermount if not here
if [[ $(uname -m) != sparc*  ]]; then
    if [[ $(uname -r) != 2.4.* ]]; then
	if grep -qs '^\/.*supermount.*' /etc/fstab && \
	  [ ! -f "/lib/modules/$(uname -r)/fs/supermount.o" ] && [ -x /usr/bin/perl ]; then
		action "Disabling Supermount:" /usr/sbin/supermount -i disable
	fi
    else
	if grep -qs '^\/.*supermount.*' /etc/fstab && \
	  [ ! -f "/lib/modules/$(uname -r)/kernel/fs/supermount/supermount.o" ] && \
	   [ -x /usr/bin/perl ]; then
		action "Disabling Supermount:" /usr/sbin/supermount -i disable
	fi
    fi
fi

# check if /etc/resolv.conf exist - if not creates it
[ -f /etc/resolv.conf ] || touch /etc/resolv.conf

# check if /mnt/cdrom , /mnt/floppy and /mnt/disk are here - if not create them
[ -d /mnt/cdrom ] || action "Creating /mnt/cdrom:" mkdir -p /mnt/cdrom
[ -d /mnt/floppy ] || action "Creating /mnt/floppy:" mkdir -p /mnt/floppy
[ -d /mnt/disk ] || action "Creating /mnt/disk:" mkdir -p /mnt/disk

# Autogenerate kernel headers.
ExecIfExecutable /etc/rc.d/scripts/gen_kernel_headers ||
ExecIfExecutable /etc/init.d/kheader
