sebastian404

ext4check.sh

Sep 29th, 2012
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.96 KB | None | 0 0
  1. #!/system/bin/sh
  2.  
  3. if [ $1 == "USERDATA" ]
  4. then
  5.     /system/bin/checkdata /system/bin/mke2fs -T ext4 -j -m 0 -b 4096 -L $1 $2
  6.     case "$?" in
  7.         0)  echo "format in checkdata"
  8.             ;;
  9.     esac
  10.     exit
  11. fi
  12.  
  13. /system/bin/e2fsck -p $2
  14. case "$?" in
  15.    2) echo "need to reboot the phone"
  16.    /system/bin/reboot  
  17.    ;;
  18.    
  19.    8) echo "need to format the partition..."
  20.    /system/bin/mke2fs -T ext4 -j -m 0 -b 4096 -L $1 $2
  21. #   /system/bin/tune2fs -j $1
  22.    /system/bin/tune2fs -C 1 $2
  23.    ;;
  24. esac
  25.  
  26. # EXIT CODE for e2fsck:
  27. #     The exit code returned by e2fsck is the sum of the following conditions:
  28. #       0    - No errors
  29. #       1    - File system errors corrected
  30. #       2    - File system errors corrected, system should be rebooted
  31. #       4    - File system errors left uncorrected
  32. #       8    - Operational error
  33. #       16   - Usage or syntax error
  34. #       32   - E2fsck canceled by user request
  35. #       128  - Shared library error
Advertisement
Add Comment
Please, Sign In to add comment