Create file system if it doesn't exist
#!/bin/sh
DEVICE=/dev/mmcblk0
+FSTABDATA=`cat /etc/fstab | grep /data`
+if [ "$FSTABDATA" == "" ]; then
+ echo "No filesystem defined in /etc/fstab, creating file system"
+ mkfs -t f2fs ${DEVICE}p4
+fi
+
DATA=`mount | grep data`
if [ "$DATA" == "" ]; then
echo "/data not mounted, trying to mount it"
@@ -12,7 +18,7 @@ if [ "$DATA" == "" ]; then
mount ${DEVICE}p4 /data
if [ "$?" != "0" ]; then
- echo "Could not mount /data, aborting"
+ echo "Could not mount /data, trying to create a new file system"
exit 1
fi
