ConfiguringTheSystem

System Configuration

Runlevels

The next documentation was taken from the CRUX documentation and slighted modified to apply to Kwort

The following runlevels are used in Kwort (defined in /etc/inittab).

RunlevelDescription
0Halt
1 (S)Single-user Mode
2Multi-user Mode
3-5(Not used)
6Reboot

Layout

The initialization scripts used in Kwort follow the BSD-style (as opposed to the SysV-style) and have the following layout.

FileDescription
/etc/rc.d/init/rcSystem boot script
/etc/rc.d/init/rc.singleSingle-user startup script
/etc/rc.d/init/rc.multiMulti-user startup script
/etc/rc.d/init/rc.localLocal multi-user startup script (empty by default)
/etc/rc.d/init/rc.shutdownSystem shutdown script
/etc/rc.confSystem configuration
/etc/rc.dService start/stop script directory

Modify /etc/rc.d/init/rc.local and /etc/rc.conf according to your needs.

Configuration Variables in /etc/rc.conf

The following configuration variables are found in /etc/rc.conf.

VariableDescription
FONTSpecifies which console font to load at system startup. The contents of this variable will be passed as argument to setfont(1). The available fonts are located in /usr/share/kbd/consolefonts/.
Example: FONT=default
KEYMAPSpecifies which console keyboard map to load at system startup. The contents of this variable will be passed as argument to loadkeys(1). The available keyboard maps are located in /usr/share/kbd/keymaps/.
Example: KEYMAP=es-latin1
TIMEZONESpecifies the timezone used by the system. The available zone description files are located in /usr/share/zoneinfo/.
Example: TIMEZONE=Europe/Stockholm
Example: TIMEZONE=UTC
HOSTNAMESpecifies the hostname.
Example: HOSTNAME=Aquiles
MODULESYou can indicate the list of modules that will be loaded during startup.
Example: MODULES=(8139too ov511)
SERVICESSpecifies which services to start at system startup. The services specified in this array must have a matching start/stop script in /etc/rc.d/. When entering multi-user mode the specified scripts will be called in the specified order with the argument start. At system shutdown or when entering single-user mode these scripts will be called in the reverse order with the argument stop.
Example: SERVICES=(sysklogd net sshd)

Generating locales

Since Kwort 3 is based on CRUX, glibc does not contain all possible locales anymore, thus you'll have to generate the locales you need/use. The following example is a typical setup for swedish users, replace sv_SE* with the locale you want:

  localedef -i sv_SE -f ISO-8859-1 sv_SE
  localedef -i sv_SE -f ISO-8859-1 sv_SE.ISO-8859-1
  localedef -i sv_SE -f UTF-8 sv_SE.utf8

Network Configuration

The network configuration is found in the service script /etc/rc.d/net. To enable this service you need to add net to the SERVICES array in /etc/rc.conf. By default this service script only configures the lo device.

Static IP setup

You have to add additional ip(8) commands if you want to setup other network devices (eth0, eth1, etc). Example:

#!/bin/sh
#
# /etc/rc.d/net: start/stop network
#

case $1 in
    start)
	# loopback
	/sbin/ip addr add 127.0.0.1/8 dev lo broadcast + scope host
	/sbin/ip link set lo up
	# ethernet
	/sbin/ip addr add 192.168.1.100/24 dev eth0 broadcast +
	/sbin/ip link set eth0 up
	# default route
	/sbin/ip route add default via 192.168.1.1
	;;
    stop)
	/sbin/ip route del default
	/sbin/ip link set eth0 down
	/sbin/ip addr del 192.168.1.100/24 dev eth0
	/sbin/ip link set lo down
	/sbin/ip addr del 127.0.0.1/8 dev lo
	;;
    restart)
	$0 stop
	$0 start
	;;
    *)
	echo "usage: $0 [start|stop|restart]"
	;;
esac

# End of file

Don't forget to setup your DNS to /etc/resolv.conf.

Dynamic IP setup

If you want to configure your system to be a DHCP client you use the dhcpcd(8) command (instead of ip(8)). Example:

#!/bin/sh
#
# /etc/rc.d/net: start/stop network
#

case $1 in
    start)
	# loopback
	/sbin/ip addr add 127.0.0.1/8 dev lo broadcast + scope host
	/sbin/ip link set lo up
	# ethernet
	/sbin/dhcpcd -t 10 -h $HOSTNAME eth0
	;;
    stop)
	/usr/bin/killall -q /sbin/dhcpcd
	/sbin/ip link set lo down
	/sbin/ip addr del 127.0.0.1/8 dev lo
	;;
    restart)
	$0 stop
	$0 start
	;;
    *)
	echo "usage: $0 [start|stop|restart]"
	;;
esac

# End of file