e2fsck.sh 784 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/sh
  2. # Copyright 2010 Vertical Communications
  3. # Copyright 2012 OpenWrt.org
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. fsck_e2fsck() {
  8. set -o pipefail
  9. e2fsck -p "$device" 2>&1 | logger -t "fstab: e2fsck ($device)"
  10. local status="$?"
  11. set +o pipefail
  12. case "$status" in
  13. 0|1) ;; #success
  14. 2) reboot;;
  15. 4) echo "e2fsck ($device): Warning! Uncorrected errors."| logger -t fstab
  16. return 1
  17. ;;
  18. *) echo "e2fsck ($device): Error $status. Check not complete."| logger -t fstab;;
  19. esac
  20. return 0
  21. }
  22. fsck_ext2() {
  23. fsck_e2fsck "$@"
  24. }
  25. fsck_ext3() {
  26. fsck_e2fsck "$@"
  27. }
  28. fsck_ext4() {
  29. fsck_e2fsck "$@"
  30. }
  31. append libmount_known_fsck "ext2"
  32. append libmount_known_fsck "ext3"
  33. append libmount_known_fsck "ext4"