File: 20-stty

package info (click to toggle)
python-diskimage-builder 3.37.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,572 kB
  • sloc: sh: 7,380; python: 6,444; makefile: 37
file content (29 lines) | stat: -rwxr-xr-x 1,038 bytes parent folder | download | duplicates (3)
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
26
27
28
29
#!/bin/bash

if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
    set -x
fi
set -eu
set -o pipefail

SCRIPTDIR=$(dirname $0)

if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
    install -m 0644 -o root -g root ${SCRIPTDIR}/ttySx.conf /etc/init/ttySx.conf
elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then
    install -D -g root -o root -m 0644 ${SCRIPTDIR}/serial-console-udev.rules /etc/udev/rules.d/99-serial-console.rules
elif [ "$DIB_INIT_SYSTEM" == "openrc" ]; then
    sed -r 's/^#(.*ttyS[0,1].*$)/\1/' -i /etc/inittab
    echo '# diskimage-builder serial console' >> /etc/inittab
    echo -n 's0:12345:respawn:/sbin/agetty -L 115200 ' >> /etc/inittab
    if [[ -n "${DIB_BOOTLOADER_SERIAL_CONSOLE}" ]]; then
        echo -n "${DIB_BOOTLOADER_SERIAL_CONSOLE}" >> /etc/inittab
    elif [[ "powerpc ppc64 ppc64le" =~ ${ARCH} ]]; then
        echo -n "hvc0" >> /etc/inittab
    elif [[ "arm64" =~ ${ARCH} ]]; then
        echo -n "ttyAMA0" >> /etc/inittab
    else
        echo -n "ttyS0" >> /etc/inittab
    fi
    echo ' vt100' >> /etc/inittab
fi