rc 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. set -x
  3. export PATH=/bin:/sbin:/usr/bin:/usr/sbin
  4. ln -s /proc/self/fd/2 /dev/stderr
  5. : ${rcquiet=0}
  6. if [ $rcquiet -ne 1 ];then
  7. echo "System initialization ..."
  8. fi
  9. # remount /dev with smaller size
  10. mount -o remount,nosuid,size=128k,mode=0755 -t tmpfs mdev /dev
  11. # start mdev dynamic device node management
  12. echo >/dev/mdev.seq
  13. if [ -f /proc/sys/kernel/hotplug ];then
  14. echo "/sbin/mdev" >/proc/sys/kernel/hotplug
  15. fi
  16. # creates f.e. /dev/root
  17. mdev -s
  18. # seed some random
  19. cat /etc/.rnd >/dev/urandom 2>&1
  20. # setup cfgfs
  21. [ -x /sbin/cfgfs ] && {
  22. cfgfs setup
  23. mount -o remount,ro /
  24. }
  25. # remount /tmp with smaller size
  26. size=$(cat /etc/tmpfs 2>/dev/null)
  27. [ -z $size ] && size=2048
  28. mount -o remount,nosuid,nodev,mode=1777,size=${size}k -t tmpfs tmpfs /tmp
  29. # create some useful directories in tmpfs
  30. mkdir -p /var/log
  31. mkdir -p /var/run
  32. mkdir -p /var/tmp
  33. touch /var/log/lastlog
  34. touch /var/log/wtmp
  35. HOSTNAME=
  36. [[ -s /etc/hostname ]] && HOSTNAME=$(cat /etc/hostname)
  37. HOSTNAME=${HOSTNAME%%.*}
  38. echo ${HOSTNAME:=openadk} >/proc/sys/kernel/hostname
  39. chown 0:0 /tmp; chmod 1777 /tmp