hfsprogs: initial import
[feed/packages.git] / utils / hfsprogs / files / hfsfsck.sh
diff --git a/utils/hfsprogs/files/hfsfsck.sh b/utils/hfsprogs/files/hfsfsck.sh
new file mode 100644 (file)
index 0000000..8bcd2c1
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+# Copyright 2015 OpenWrt.org
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+fsck_hfsfsck() {
+       hfsfsck "$device" 2>&1 | logger -t "fstab: hfsfsck ($device)"
+       local status="$?"
+       case "$status" in
+               0) ;; #success
+               4) reboot;;
+               8) echo "hfsfsck ($device): Warning! Uncorrected errors."| logger -t fstab
+                       return 1
+                       ;;
+               *) echo "hfsfsck ($device): Error $status. Check not complete."| logger -t fstab;;
+       esac
+       return 0
+}
+
+fsck_hfs() {
+       fsck_hfsfsck "$@"
+}
+
+fsck_hfsplus() {
+       fsck_hfsfsck "$@"
+}
+
+append libmount_known_fsck "hfs"
+append libmount_known_fsck "hfsplus"