SHARE
TWEET

start_udev rc.single rc.multi

a guest Jun 8th, 2019 11 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # start_udev -------------------------------------------------------------------
  2.  
  3. #!/bin/sh
  4.  
  5. # - if /dev is not mounted - mount as a devtmpfs (CONFIG_DEVTMPFS=y)
  6. # - if /dev is mounted (e.g. due to handover from initramfs or
  7. #   CONFIG_DEVTMPFS_MOUNT=y), remount with specific options
  8. # - some video drivers require exec access in /dev, thus it's set here
  9. # - for completness, we add few sanity limits (2k non-empty files, 16k inodes)
  10.  
  11. UDEVOPTS="exec,nosuid,noatime,mode=0755,nr_blocks=2048,nr_inodes=16384"
  12. if /bin/mountpoint -q /dev ; then
  13.         /bin/mount -n -o remount,${UDEVOPTS} dev /dev
  14. else
  15.         /bin/mount -n -t devtmpfs -o ${UDEVOPTS} dev /dev
  16. fi
  17.  
  18. # mount /run directory
  19. /bin/mountpoint -q /run || \
  20. /bin/mount -n -t tmpfs -o mode=0755,nosuid,nodev,exec tmpfs /run
  21.  
  22. # copy devcies from /lib/udev/devices
  23. cp -ar /lib/udev/devices/* /dev
  24.  
  25. # launch udev daemon, make sure it's not running first
  26. test -z "$(/bin/pidof -s udevd)" && /sbin/udevd --daemon
  27.  
  28. # coldplug devices and wait for the queue to be processed
  29. /sbin/udevadm trigger --type=subsystems --action=add
  30. /sbin/udevadm trigger --type=devices --action=add
  31. /sbin/udevadm settle
  32.  
  33.  
  34. # rc.single ---------------------------------------------------------------------
  35.  
  36. #!/bin/bash
  37. #
  38. # /etc/rc.single: single-user startup script
  39. #
  40.  
  41. # Load configuration
  42. . /etc/rc.conf
  43.  
  44. if [ "$PREVLEVEL" = "2" ]; then
  45.         # Shutdown services
  46.         if [ "${SERVICES[*]}" ]; then
  47.                 for service in "${SERVICES[@]}"; do
  48.                         R_SERVICES=($service ${R_SERVICES[@]})
  49.                 done
  50.                 for service in "${R_SERVICES[@]}"; do
  51.                         /etc/rc.d/$service stop &> /tmp/rc.$$
  52.                         /usr/bin/logger -t $service -f /tmp/rc.$$
  53.                         /bin/rm -f /tmp/rc.$$
  54.                 done
  55.         fi
  56. fi
  57.  
  58. if [ "$PREVLEVEL" != "S" ]; then
  59.  
  60.         # Terminate all processes
  61.         /sbin/killall5 -15
  62.         /bin/sleep 5
  63.         /sbin/killall5 -9
  64.  
  65.         # Start udev
  66.         /bin/mountpoint -q /run || /bin/mount -n -t proc none /proc
  67.         /bin/mountpoint -q /run || /bin/mount -n -t sysfs none /sys
  68.         /sbin/start_udev
  69.  
  70.         if [ -f /etc/rc.d/$SYSLOG -a -x /etc/rc.d/$SYSLOG ]; then
  71.                 /etc/rc.d/$SYSLOG start &> /dev/null
  72.         fi
  73. fi
  74.  
  75. if [ "$RUNLEVEL" = "1" ]; then
  76.         # Enter single-user mode
  77.         exec /sbin/init -t1 S
  78. fi
  79.  
  80. # End of file
  81.  
  82. # rc.multi ----------------------------------------------------------------------
  83.  
  84. #!/bin/bash
  85. #
  86. # /etc/rc.multi: multi-user startup script
  87. #
  88.  
  89. # Load configuration
  90. . /etc/rc.conf
  91.  
  92. # Run fixes startup file
  93. if [ -x /etc/rc.fix ]; then
  94.         /etc/rc.fix
  95. fi
  96.  
  97. # Start services
  98. if [ "$SYSLOG" -o "${SERVICES[*]}" ]; then
  99.         echo -n "starting services:"
  100.         if pidof -x syslogd -o $$ >/dev/null; then
  101.                 echo -n " $SYSLOG"
  102.         else
  103.                 if [ -f /etc/rc.d/$SYSLOG -a -x /etc/rc.d/$SYSLOG ]; then
  104.                         echo -n " $SYSLOG"
  105.                         /etc/rc.d/$SYSLOG start &> /dev/null || echo -n "[ERROR]"
  106.                 fi
  107.         fi
  108.         for service in ${SERVICES[@]}; do
  109.                 echo -n " $service"
  110.                 /etc/rc.d/$service start &> /tmp/rc.$$ || echo -n "[ERROR]"
  111.                 /usr/bin/logger -t $service -f /tmp/rc.$$
  112.                 /bin/rm -f /tmp/rc.$$
  113.         done
  114.         echo
  115. fi
  116.  
  117. # Run local startup script
  118. if [ -x /etc/rc.local ]; then
  119.         /etc/rc.local
  120. fi
  121.  
  122. # End of file
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top