Advertisement
Fighter19

INIT hook

Apr 22nd, 2012
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. # vim: set ft=sh:
  2. run_hook ()
  3. {
  4. #Taken from the original init script to init before it checks, for the boot parameter "root=" and would abort then.
  5. init=${init:-/sbin/init}
  6. # mount /usr if it exists
  7. realtab=/new_root/etc/fstab
  8. if [ -f "$realtab" ]; then
  9. if usr_source=$(findmnt -snero source --tab-file="$realtab" /usr); then
  10. mountopts=$(findmnt -snero options --tab-file="$realtab" /usr)
  11. fsck_device "$usr_source"
  12. msg ":: mounting '$usr_source' on /usr"
  13. mount "$usr_source" /new_root/usr -o "$mountopts"
  14. fi
  15. fi
  16.  
  17. if [ "${break}" = "postmount" ]; then
  18. echo ":: Post-mount break requested, type 'exit' to resume operation"
  19. launch_interactive_shell
  20. fi
  21.  
  22. # Stop udevd if is running
  23. if [ "${udevd_running}" -eq 1 ]; then
  24. udevadm control --exit
  25. udevadm info --cleanup-db
  26. fi
  27.  
  28. echo exec env -i "TERM=$TERM" /sbin/switch_root /new_root $init "$@"
  29. exec env -i "TERM=$TERM" /sbin/switch_root /new_root $init "$@"
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement