#!/bin/sh
# Vector Linux Setup Configuration
# This script is supposed to be executed in a chrooted environment
# to configure the Vector Linux virgin
# Called by setup-install like this:
#    setup-config  <ROOT_DEVICE>
#
# We are going to do a quick setup thus this baby can boot properly 
# - initialisation
# - liloconf
# - autosetup 
# - hwset
# - user setup
# - DONE
#
# (c) Eko M. Budi, 2004
# (c) Vector Linux, 2004
#
# Released under GNU GPL
#

export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/opt/bin"

ROOT_DEVICE=$1

# Ok, now get the functions
vdir=$(dirname $0)
. $vdir/vasm-functions

infobox "Initialising ...... hold on.\n" "SYSTEM CONFIGURATION" 

# Mount procfs
if ! mount | grep -e '^proc'; then
    mkdir -p /proc   &> /dev/null
    mount -t proc none /proc &> /dev/null
fi
# mount -t usbdevfs none /proc/bus/usb

# Reset the library first
ldconfig

sleep 2

## LILO first, so at least we can boot this puppy
if [ -x $vdir/vliloconfig ]; then
    $vdir/vliloconfig / $ROOT_DEVICE
else
    liloconfig / $ROOT_DEVICE
fi

## Ask hardware, give chances to the user to enable PCMCIA
$vdir/vhwset
if [ $? = 0 ]; then
    # Start the hardware
    infobox "Initialising the hardware ..... "
    [ -x /etc/rc.d/rc.hotplug ] && /etc/rc.d/rc.hotplug start &> /dev/null
    [ -x /etc/rc.d/rc.pcmcia  ] && /etc/rc.d/rc.pcmcia start &> /dev/null
fi

## AUTO SETUP hardware, X-Window, network, sound
$vdir/vlautosetup

## USER: change root passwd and add a new user
TEXT="\n
Linux is a secure system, thus every user must have an account to\n
login into the system. The first and the most powerfull account is\n
called a 'root'. You should login as root for special occasion only\n
such as administering the system. For normal every day working, use\n
an ordinary user account.\n 
The following steps allow you to change the root password and to\n
create a new ordinary user."

$DCMD --backtitle "$BACKTITLE" --title "SET USERS" --msgbox "$TEXT" 14 74

$vdir/vpasswd root
$vdir/vuseradd

infobox " Quick configuration has been performed." 
sleep 3

