about summary refs log tree commit diff
path: root/core-services/05-misc.sh
blob: fba6d2a8477a251ef5d7683fa3866963b9f7cc7c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
# vim: set ts=4 sw=4 et:

. /etc/runit/functions
[ -r /etc/rc.conf ] && . /etc/rc.conf

msg "Setting up loopback interface...\n"
ip link set up dev lo

if [ -n "$HOSTNAME" ]; then
    echo "$HOSTNAME" > /proc/sys/kernel/hostname
elif [ -r /etc/hostname ]; then
    HOSTNAME=$(cat /etc/hostname)
    echo "$HOSTNAME" > /proc/sys/kernel/hostname
fi
msg "Setting up hostname to '${HOSTNAME}'...\n"

if [ -n "$TIMEZONE" ]; then
    msg "Setting up timezone to '${TIMEZONE}'...\n"
    ln -sf "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
fi

msg "Initializing random seed...\n"
cp /var/lib/random-seed /dev/urandom >/dev/null 2>&1 || true
( umask 077; dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=512 >/dev/null 2>&1 )