10 args=$(getopt -u -o 'sfnvo:t:N:' -n 'mount.bcachefs' -- "$@")
12 echo 'Terminating...' >&2
16 read -r -a argv <<< "$args"
18 for i in ${!argv[@]}; do
19 [[ ${argv[$i]} == '--' ]] && break
24 if [[ $((i + 2)) < ${#argv[@]} ]]; then
25 echo "Insufficient arguments"
31 if [[ ${UUID//-/} =~ ^[[:xdigit:]]{32}$ ]]; then
34 for part in $(tail -n +3 /proc/partitions|awk '{print $4}'); do
35 uuid_line=$(bcachefs show-super /dev/$part|& head -n1)
37 if [[ $uuid_line =~ $UUID ]]; then
42 if [[ ${#PARTS[@]} == 0 ]]; then
43 echo "uuid $UUID not found"
47 argv[$i]=$(join_by : "${PARTS[@]}")
50 exec mount -i -t bcachefs ${argv[@]}