| #!/bin/sh |
| |
| if [ ! -e /dev/mtd/rwfs ]; then |
| exit 1 |
| fi |
| |
| # If "no-persist-fs" is set, only mount as a tmpfs and exit, so that we can |
| # still create writable file system entries. |
| if /sbin/fw_printenv -n openbmconce | grep -w -q "no-persist-fs"; then |
| echo "Mounting /run/mnt-persist as tmpfs" |
| if ! mkdir -p /run/mnt-persist ; then |
| exit 1 |
| fi |
| |
| if ! mount -t tmpfs tmpfs /run/mnt-persist ; then |
| exit 1 |
| fi |
| |
| exit |
| fi |
| |
| if [ ! -e /run/format-persist ]; then |
| if ! ubiattach -p /dev/mtd/rwfs > /dev/null ; then |
| echo "unformatted-ubi" >> /run/format-persist |
| fi |
| |
| if ! ubinfo /dev/ubi0 -N rwfs > /dev/null ; then |
| # ubi device attached, but volume not exist |
| ubidetach -p /dev/mtd/rwfs |
| echo "missing-ubi-volume" >> /run/format-persist |
| fi |
| fi |
| |
| if [ -e /run/format-persist ]; then |
| echo "Formatting persistent volume: " |
| cat /run/format-persist |
| |
| if ! ubiformat --yes /dev/mtd/rwfs ; then |
| exit 1 |
| fi |
| |
| if ! ubiattach -p /dev/mtd/rwfs ; then |
| exit 1 |
| fi |
| |
| if ! ubimkvol /dev/ubi0 -N rwfs -m ; then |
| exit 1 |
| fi |
| fi |
| |
| mkdir -p /run/mnt-persist |
| mount -t ubifs ubi0:rwfs /run/mnt-persist -o sync,compr=zstd |