1#!/bin/sh 2 3if [ ! -e /dev/mtd/rwfs ]; then 4 exit 1 5fi 6 7if [ ! -e /run/format-persist ]; then 8 if ! ubiattach -p /dev/mtd/rwfs > /dev/null ; then 9 echo "unformatted-ubi" >> /run/format-persist 10 fi 11 12 if ! ubinfo /dev/ubi0 -N rwfs > /dev/null ; then 13 # ubi device attached, but volume not exist 14 ubidetach -p /dev/mtd/rwfs 15 echo "missing-ubi-volume" >> /run/format-persist 16 fi 17fi 18 19if [ -e /run/format-persist ]; then 20 echo "Formatting persistent volume: " 21 cat /run/format-persist 22 23 if ! ubiformat --yes /dev/mtd/rwfs ; then 24 exit 1 25 fi 26 27 if ! ubiattach -p /dev/mtd/rwfs ; then 28 exit 1 29 fi 30 31 if ! ubimkvol /dev/ubi0 -N rwfs -m ; then 32 exit 1 33 fi 34fi 35 36mkdir -p /run/mnt-persist 37mount -t ubifs ubi0:rwfs /run/mnt-persist -o sync,compr=zstd 38