#!/bin/bash

echo "-- $0 --"

. /etc/profile

if [ "${SERIAL}" = "1" ]; then
  if [ "${SYSTEMD}" = "0" ] ; then
  # serial
    echo "s0:12345:respawn:/sbin/agetty 115200 ${SERIALDEV} vt100" >>/etc/inittab
  elif [ "${SYSTEMD}" = "1" ] ; then
    systemctl enable serial-getty@ttyS0.service
    systemctl start serial-getty@ttyS0.service
  fi
else
  echo "Serial is not set!"
fi
