e2fsck.init 620 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2008 OpenWrt.org
  3. # Vasilis Tsiligiannis <[email protected]>
  4. START=15
  5. e2fsck() {
  6. local args
  7. local cfg="$1"
  8. config_get device "$cfg" device
  9. [ -b "$device" ] || return 0
  10. config_get fstype "$cfg" fstype
  11. case "$fstype" in
  12. ext2|ext3)
  13. /usr/sbin/e2fsck -p "$device"
  14. local status="$?"
  15. case "$status" in
  16. 0|1) continue;;
  17. 2) reboot;;
  18. 4) echo "e2fsck ($device): Warning! Uncorrected errors.";;
  19. *) echo "e2fsck ($device): Error $status. Check not complete.";;
  20. esac
  21. ;;
  22. *)
  23. ;;
  24. esac
  25. }
  26. start() {
  27. config_load fstab
  28. config_foreach e2fsck mount
  29. }