shadow-securetty_4.6.bb 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. SUMMARY = "Provider of the machine specific securetty file"
  2. SECTION = "base utils"
  3. LICENSE = "MIT"
  4. LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
  5. INHIBIT_DEFAULT_DEPS = "1"
  6. PR = "r3"
  7. SRC_URI = "file://securetty"
  8. S = "${WORKDIR}"
  9. # Since SERIAL_CONSOLES is likely to be set from the machine configuration
  10. PACKAGE_ARCH = "${MACHINE_ARCH}"
  11. do_install () {
  12. # Ensure we add a suitable securetty file to the package that has
  13. # most common embedded TTYs defined.
  14. install -d ${D}${sysconfdir}
  15. install -m 0400 ${WORKDIR}/securetty ${D}${sysconfdir}/securetty
  16. if [ ! -z "${SERIAL_CONSOLES}" ]; then
  17. # Our SERIAL_CONSOLES contains a baud rate and sometimes extra
  18. # options as well. The following pearl :) takes that and converts
  19. # it into newline-separated tty's and appends them into
  20. # securetty. So if a machine has a weird looking console device
  21. # node (e.g. ttyAMA0) that securetty does not know, it will get
  22. # appended to securetty and root logins will be allowed on that
  23. # console.
  24. tmp="${SERIAL_CONSOLES}"
  25. for entry in $tmp ; do
  26. ttydev=`echo "$entry" | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'`
  27. if ! grep -q $ttydev ${D}${sysconfdir}/securetty; then
  28. echo $ttydev >> ${D}${sysconfdir}/securetty
  29. fi
  30. done
  31. fi
  32. }