18 # Nothing to do if ROOTFSTYPE is set to something other than bcachefs
19 if [ -n "$ROOTFSTYPE" -a "$ROOTFSTYPE" != bcachefs ]; then
23 # source for resolve_device() and panic() functions
31 if [ -x /bin/plymouth ] && plymouth --ping; then
32 plymouth message --text="$*"
40 # Send the panic message to plymouth
41 if [ -x /bin/plymouth ] && plymouth --ping; then
42 plymouth message --text="$*"
53 if [ -x /bin/plymouth ] && plymouth --ping; then
54 msg=$(plymouth ask-for-password --prompt="$msg" | \
55 bcachefs unlock "$@" 2>&1)
56 # If the unlock failed, send any printed messages to plymouth
58 plymouth message --text="Bcachefs: $msg"
62 # If unlock() is called multiple times, don't re-print the prompt message
63 # unless it has changed
64 if [ "$LAST_UNLOCK_MSG" != "$msg" ]; then
72 # Resolve the root device (e.g. if root is specified by UUID)
73 DEV=$(resolve_device "$ROOT")
75 # Check if the root device needs unlocking:
76 if bcachefs unlock -c $DEV >/dev/null 2>&1; then
77 if [ "$DEV" == "$ROOT" ]; then
78 msg="Please unlock $DEV:"
80 msg="Please unlock $DEV ($ROOT):"
85 while [ $tries -le 0 -o $count -lt $tries ]; do
86 if unlock "$msg" "$DEV"; then
87 message "Bcachefs: $DEV successfully unlocked"
94 if [ $tries -gt 0 -a $count -ge $tries ]; then
95 panic2 "Bcachefs: maximum number of tries exceeded for $DEV"