bootmisc.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: bootmisc
  4. # Required-Start: $local_fs mountvirtfs
  5. # Required-Stop: $local_fs
  6. # Default-Start: S
  7. # Default-Stop: 0 6
  8. # Short-Description: Misc and other.
  9. ### END INIT INFO
  10. . /etc/default/rcS
  11. #
  12. # Put a nologin file in /etc to prevent people from logging in before
  13. # system startup is complete.
  14. #
  15. if test "$DELAYLOGIN" = yes
  16. then
  17. echo "System bootup in progress - please wait" > /etc/nologin
  18. cp /etc/nologin /etc/nologin.boot
  19. fi
  20. #
  21. # Set pseudo-terminal access permissions.
  22. #
  23. if test -c /dev/ttyp0
  24. then
  25. chmod 666 /dev/tty[p-za-e][0-9a-f]
  26. chown root:tty /dev/tty[p-za-e][0-9a-f]
  27. fi
  28. #
  29. # Apply /proc settings if defined
  30. #
  31. SYSCTL_CONF="/etc/sysctl.conf"
  32. if [ -f "${SYSCTL_CONF}" ]
  33. then
  34. if [ -x "/sbin/sysctl" ]
  35. then
  36. # busybox sysctl does not support -q
  37. VERBOSE_REDIR="1>/dev/null"
  38. if [ "${VERBOSE}" != "no" ]; then
  39. VERBOSE_REDIR="1>&1"
  40. fi
  41. eval /sbin/sysctl -p "${SYSCTL_CONF}" $VERBOSE_REDIR
  42. else
  43. echo "To have ${SYSCTL_CONF} applied during boot, install package <procps>."
  44. fi
  45. fi
  46. #
  47. # Update /etc/motd.
  48. #
  49. if test "$EDITMOTD" != no
  50. then
  51. uname -a > /etc/motd.tmp
  52. sed 1d /etc/motd >> /etc/motd.tmp
  53. mv /etc/motd.tmp /etc/motd
  54. fi
  55. #
  56. # This is as good a place as any for a sanity check
  57. #
  58. # Set the system clock from hardware clock
  59. # If the timestamp is more recent than the current time,
  60. # use the timestamp instead.
  61. test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh start
  62. if test -e /etc/timestamp
  63. then
  64. SYSTEMDATE=`date -u +%4Y%2m%2d%2H%2M%2S`
  65. read TIMESTAMP < /etc/timestamp
  66. if [ ${TIMESTAMP} -gt $SYSTEMDATE ]; then
  67. # format the timestamp as date expects it (2m2d2H2M4Y.2S)
  68. TS_YR=${TIMESTAMP%??????????}
  69. TS_SEC=${TIMESTAMP#????????????}
  70. TS_FIRST12=${TIMESTAMP%??}
  71. TS_MIDDLE8=${TS_FIRST12#????}
  72. date -u ${TS_MIDDLE8}${TS_YR}.${TS_SEC}
  73. test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh stop
  74. fi
  75. fi
  76. : exit 0