summaryrefslogtreecommitdiff
path: root/configs/releng/root-image/etc/rc.d/functions.d/setup_special_console
blob: 7badfe378ab953055a82fbac555d79fa04061e0a (plain)
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
# If an alternate console was specified on the kernel command line,
# start agetty on it too.
setup_special_console()
{
    local cmdline_console
    if cmdline_console=$(kernel_cmdline console); then
        stat_busy "Starting agetty on console: ${cmdline_console}"
            local port options baud rts
            port=${cmdline_console%%,*}
            options=${cmdline_console#${port}}
            options=${options#,}
            baud=${options%%[neo]*}
            [[ ${options} == *r ]] && rts="-h"
            if ! grep -q "^${port}" /etc/securetty; then
                echo ${port} >> /etc/securetty
            fi
            if ! grep -q "^z0:" /etc/inittab; then
                echo "z0:2345:respawn:/sbin/agetty -8 -s ${rts} ${baud:-9600} ${port} linux" >> /etc/inittab
            fi
            /sbin/telinit q
        stat_done
    fi
}

add_hook sysinit_end setup_special_console