#!/bin/bash

#2do: echo whats done

#change the default keymap, create the
ln -sf i386/qwertz/de-latin1-nodeadkeys.map.gz /usr/share/kbd/keymaps/defkeymap.map.gz

#another way: patch kernel to use correct keymap
#works already before init scripts, i.e. in maintenance mode:
#loadkeys -m /usr/share/kbd/keymaps/defkeymap.map.gz > /usr/src/linux/drivers/char/defkeymap.c



#Setting the root password:
passwd root



#configure the setclock script:
cat > /etc/sysconfig/clock << "EOF"
# Begin /etc/sysconfig/clock

UTC=0

# End /etc/sysconfig/clock
EOF

#2do:   Now, you may want to take a look at a very good hint explaining how we
#   deal with time on LFS at
#   [411]http://www.linuxfromscratch.org/hints/downloads/files/time.txt.
#   It explains issues such as time zones, UTC, and the TZ environment
#   variable.



#Configuring the sysklogd script:
#   The sysklogd script invokes the syslogd program with the -m 0 option.
#   This option turns off the periodic timestamp mark that syslogd writes
#   to the log files every 20 minutes by default. If you want to turn on
#   this periodic timestamp mark, edit the sysklogd script and make the
#   changes accordingly. See man syslogd for more information.



#Configuring the localnet script:
#no fully qualified name here, FQDN will be put in /etc/hosts
echo ""
echo -n "Enter name of this computer: "
read NAME
echo "HOSTNAME=$NAME" >/etc/sysconfig/network

#Creating the /etc/hosts file:
echo -n "Enter IP of this computer: "
read IP
echo "# Begin /etc/hosts (network card version)" >/etc/hosts
echo "" >>/etc/hosts
echo "127.0.0.1 localhost.localdomain localhost" >>/etc/hosts
echo "$IP $NAME.bigboss.local $NAME" >>/etc/hosts
echo "" >>/etc/hosts
echo "# End /etc/hosts (network card version)" >>/etc/hosts



#Configuring the network script:

#Configuring default gateway:
cat >>/etc/sysconfig/network <<"EOF"
GATEWAY=192.168.0.1
GATEWAY_IF=eth0
EOF


#Creating network interface configuration files:
echo "ONBOOT=yes" >/etc/sysconfig/network-devices/ifconfig.eth0
echo "IP=$IP" >>/etc/sysconfig/network-devices/ifconfig.eth0
echo "PREFIX=24" >>/etc/sysconfig/network-devices/ifconfig.eth0
echo "NETMASK=255.255.255.0" >>/etc/sysconfig/network-devices/ifconfig.eth0
echo "BROADCAST=192.168.0.255" >>/etc/sysconfig/network-devices/ifconfig.eth0
echo "SERVICE=ipv4-static" >>/etc/sysconfig/network-devices/ifconfig.eth0


#Create /etc/fstab
cat > /etc/fstab << "EOF"
# Begin /etc/fstab

# fs-location   mount point   fs-type     options

proc            /proc         proc        defaults             0 0
devpts          /dev/pts      devpts      gid=4,mode=620       0 0
shm             /dev/shm      tmpfs       defaults             0 0
usbfs           /proc/bus/usb usbfs       defaults             0 0
none            /sys          sysfs       defaults             0 0

/dev/hde7       /             ext2        defaults             1 1
/dev/hde5       swap          swap        pri=1                0 0

/dev/fd0        /mnt/floppy   auto        defaults,user,noauto 0 0
/dev/hde1       /mnt/w2k  ntfs        defaults,user,ro,exec,umask=000     0 0
/dev/hde3       /mnt/w98  vfat        defaults,users,rw,exec,umask=000,shortname=mixed     0 0
/dev/hde6       /mnt/data vfat        defaults,users,rw,exec,umask=000,shortname=mixed     0 0
/dev/hde2       /mnt/lfs      ext2        defaults             0 0
/dev/hdc        /mnt/cdrom    iso9660     ro,user,noauto,exec  0 0
/dev/hdd        /mnt/cdr      iso9660     ro,user,noauto,exec  0 0

//komet/data_mob /mnt/komet/data_mob   smbfs     defaults,user,noauto,exec,suid,dev,username=dueffert 0 0

#/dev/sda4      /mnt/zip      vfat        defaults,user,rw     0 0

# End /etc/fstab
EOF

# For all the details on the six fields in this table, see man 5 fstab.

# When using a reiserfs partition, the 1 1 at the end of the line should
# be replaced with 0 0, as such a partition does not need to be dumped
# or checked

# The /dev/shm mount point for tmpfs is included to enable POSIX shared
# memory. Your kernel must have the required support built into it for
# this to work. More about this in the next section. Please note that
# currently, very little software actually uses POSIX shared memory.



cat > /etc/resolv.conf << "EOF"
# /etc/resolv.conf - DNS setup file
#
# possible entries are:
#
#       domain <domain>                 Local domain name. If not present, the
#                                       gethostbyname syscall is used to
#                                       determine the local domain name.
#
#       search <list_of_domains>        Search list for hostname lookup.
#                                       The search list is normally determined
#                                       from the local domain name but it
#                                       can be set to a list of domains.
#
#       nameserver <ip_addr>            Define which server to contact
#                                       for DNS lookups. If there are
#                                       multiple nameserver lines (Max=3),
#                                       they are queried in the listed order.
#
#domain informatik.hu-berlin.de
#search informatik.hu-berlin.de rz.hu-berlin.de hu-berlin.de
#nameserver 141.20.20.50
domain bigboss.local
EOF
