2013-11-07 04:25:34 +00:00
|
|
|
#!/bin/bash
|
2014-09-04 04:56:29 +00:00
|
|
|
|
|
|
|
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
|
|
|
set -eu
|
2014-04-03 02:24:15 +00:00
|
|
|
set -o pipefail
|
2014-09-04 04:56:29 +00:00
|
|
|
|
2014-03-19 20:21:43 +00:00
|
|
|
SCRIPTDIR=$(dirname $0)
|
2013-05-09 06:39:37 +00:00
|
|
|
|
2014-01-13 18:02:54 +00:00
|
|
|
if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
|
2014-03-19 20:21:43 +00:00
|
|
|
install -m 0644 -o root -g root ${SCRIPTDIR}/ttySx.conf /etc/init/ttySx.conf
|
2014-01-13 18:02:54 +00:00
|
|
|
elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then
|
2014-03-19 20:21:43 +00:00
|
|
|
install -D -g root -o root -m 0644 ${SCRIPTDIR}/serial-console-udev.rules /etc/udev/rules.d/99-serial-console.rules
|
2020-07-14 18:46:53 +00:00
|
|
|
elif [ "$DIB_INIT_SYSTEM" == "openrc" ]; then
|
|
|
|
sed -r 's/^#(.*ttyS[0,1].*$)/\1/' -i /etc/inittab
|
2020-08-22 00:29:21 +00:00
|
|
|
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
|
2014-01-13 18:02:54 +00:00
|
|
|
fi
|