+# Check if the root device needs unlocking:
+if bcachefs unlock -c $DEV >/dev/null 2>&1; then
+ if [ "$DEV" == "$ROOT" ]; then
+ echo "Please unlock $DEV:"
+ else
+ echo "Please unlock $DEV ($ROOT):"
+ fi
+
+ count=0
+ tries=3
+ while [ $tries -le 0 -o $count -lt $tries ]; do
+ if bcachefs unlock "$DEV"; then
+ echo "Bcachefs: $DEV successfully unlocked"
+ break
+ fi
+
+ let count++