fsck.sh 794 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/sh
  2. # Copyright 2010 Vertical Communications
  3. # This is free software, licensed under the GNU General Public License v2.
  4. # See /LICENSE for more information.
  5. #
  6. libmount_fsck() {
  7. local device="$1"
  8. local fsck_fstype="$2"
  9. local fsck_enabled="$3"
  10. local known_type
  11. local found_fsck=0
  12. grep -q "$device" /proc/swaps || grep -q "$device" /proc/mounts || {
  13. [ -e "$device" ] && [ "$fsck_enabled" -eq 1 ] && {
  14. for known_type in $libmount_known_fsck; do
  15. if [ "$known_type" = "$fsck_fstype" ]; then
  16. fsck_${known_type} "$device"
  17. found_fsck=1
  18. break
  19. fi
  20. done
  21. if [ "$found_fsck" -ne 1 ]; then
  22. logger -t 'fstab' "Unable to check/repair $device; no known fsck for filesystem type $fstype"
  23. fi
  24. }
  25. }
  26. }
  27. libmount_known_fsck=""
  28. pi_include /lib/functions/fsck