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).
| Runlevel | Description |
|---|---|
| 0 | Halt |
| 1 (S) | Single-user Mode |
| 2 | Multi-user Mode |
| 3-5 | (Not used) |
| 6 | Reboot |
Layout
The initialization scripts used in Kwort follow the BSD-style (as opposed to the SysV-style) and have the following layout.
| File | Description |
|---|---|
| /etc/rc.d/init/rc | System boot script |
| /etc/rc.d/init/rc.single | Single-user startup script |
| /etc/rc.d/init/rc.multi | Multi-user startup script |
| /etc/rc.d/init/rc.local | Local multi-user startup script (empty by default) |
| /etc/rc.d/init/rc.shutdown | System shutdown script |
| /etc/rc.conf | System configuration |
| /etc/rc.d | Service 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.
| Variable | Description |
|---|---|
| FONT | Specifies 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 |
| KEYMAP | Specifies 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 |
| TIMEZONE | Specifies the timezone used by the system. The available zone description files are located in /usr/share/zoneinfo/. Example: TIMEZONE=Europe/Stockholm |
| CLOCK | Specifies whether the hardware clock, which is synchronized from on bootup and to on shutdown, stores UTC time, or the localtime. Only utc or local are accepted here Example: CLOCK=utc |
| HOSTNAME | Specifies the hostname. Example: HOSTNAME=Aquiles |
| MODULES | You can indicate the list of modules that will be loaded during startup. Example: MODULES=(8139too ov511) |
| SERVICES | Specifies 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_SElocaledef -i sv_SE -f ISO-8859-1 sv_SE.ISO-8859-1localedef -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
|
