Bläddra i källkod

Check that the mount directory exists

Bob Mottram 10 år sedan
förälder
incheckning
fbe83becc4
1 ändrade filer med 17 tillägg och 1 borttagningar
  1. 17
    1
      src/freedombone-prep

+ 17
- 1
src/freedombone-prep Visa fil

46
 
46
 
47
 function show_help {
47
 function show_help {
48
     echo ''
48
     echo ''
49
-    echo 'freedombone-prep -d [microSD device] --ip [BBB LAN IP address] --iprouter [Router LAN IP address]'
49
+    echo 'freedombone-prep -d [microSD device] --ip [BBB LAN IP address] --iprouter [Router LAN IP address] --mount [mount directory]'
50
     echo ''
50
     echo ''
51
     echo 'See the manpage for more details'
51
     echo 'See the manpage for more details'
52
     echo ''
52
     echo ''
58
   exit 0
58
   exit 0
59
 fi
59
 fi
60
 
60
 
61
+if [ ! -d $MICROSD_MOUNT_POINT ]; then
62
+    echo "The mount directory $MICROSD_MOUNT_POINT does not exist."
63
+    echo 'Use the --mount option to specify where the microSD gets mounted to.'
64
+    exit 67563
65
+fi
66
+
61
 while [[ $# > 1 ]]
67
 while [[ $# > 1 ]]
62
 do
68
 do
63
 key="$1"
69
 key="$1"
154
     fi
160
     fi
155
 fi
161
 fi
156
 
162
 
163
+if [ ! -d $MICROSD_MOUNT_POINT/BOOT ]; then
164
+    echo "The boot partition $MICROSD_MOUNT_POINT/BOOT was not found."
165
+    exit 67857
166
+fi
167
+
168
+if [ ! -d $MICROSD_MOUNT_POINT/rootfs ]; then
169
+    echo "The rootfs partition $MICROSD_MOUNT_POINT/rootfs was not found."
170
+    exit 65688
171
+fi
172
+
157
 $SUDO cp $MICROSD_MOUNT_POINT/BOOT/bbb-uEnv.txt $MICROSD_MOUNT_POINT/BOOT/uEnv.txt
173
 $SUDO cp $MICROSD_MOUNT_POINT/BOOT/bbb-uEnv.txt $MICROSD_MOUNT_POINT/BOOT/uEnv.txt
158
 
174
 
159
 $SUDO sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' $MICROSD_MOUNT_POINT/rootfs/etc/network/interfaces
175
 $SUDO sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' $MICROSD_MOUNT_POINT/rootfs/etc/network/interfaces