Kaynağa Gözat

Remove a manual step from the microSD preparation

Bob Mottram 10 yıl önce
ebeveyn
işleme
51230502bf
1 değiştirilmiş dosya ile 46 ekleme ve 26 silme
  1. 46
    26
      src/freedombone-prep

+ 46
- 26
src/freedombone-prep Dosyayı Görüntüle

@@ -180,7 +180,15 @@ $SUDO ./setup_sdcard.sh --mmc $MICROSD_DRIVE --dtb beaglebone
180 180
 
181 181
 echo ''
182 182
 echo ''
183
-read -p "Eject the microSD card, re-insert it and wait a minute for it to mount, then press any key to continue... " -n1 -s
183
+$SUDO umount $MICROSD_MOUNT_POINT/$ROOTFS
184
+$SUDO umount $MICROSD_MOUNT_POINT/$BOOT
185
+sync
186
+sleep 5
187
+$SUDO mkdir -p $MICROSD_MOUNT_POINT/$BOOT
188
+$SUDO mkdir -p $MICROSD_MOUNT_POINT/$ROOTFS
189
+$SUDO mount ${MICROSD_DRIVE}1 $MICROSD_MOUNT_POINT/$BOOT
190
+$SUDO mount ${MICROSD_DRIVE}2 $MICROSD_MOUNT_POINT/$ROOTFS
191
+sync
184 192
 
185 193
 if [ ! -b ${MICROSD_DRIVE}1 ]; then
186 194
     echo ''
@@ -233,30 +241,32 @@ if [ ! -f $MICROSD_MOUNT_POINT/$ROOTFS/usr/local/bin/freedombone ]; then
233 241
 fi
234 242
 
235 243
 # change the motd to show further install instructions
236
-echo 'Become the root user by typing:' > $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
237
-echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
238
-echo '    su' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
239
-echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
240
-echo 'Using the password "root". Change the root user password by typing:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
241
-echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
242
-echo '    passwd' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
243
-echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
244
-echo 'Then create a user for the system with:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
245
-echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
246
-echo '    adduser [username]' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
247
-echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
248
-echo 'Enter the command "exit" a couple of times to get back to your main system' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
249
-echo 'then log back in as the user you just created with:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
250
-echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
251
-echo '    ssh [username]@$BBB_FIXED_IP_ADDRESS' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
252
-echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
253
-echo 'and use the "su" command to become the root user again.' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
254
-echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
255
-echo 'Finally you can use the freedombone command to install a server configuration:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
256
-echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
257
-echo '    apt-get update' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
258
-echo '    apt-get -y install git dialog build-essential' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
259
-echo '    freedombone menuconfig' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
244
+echo 'Become the root user by typing:' > /tmp/freedombone_motd
245
+echo '' >> /tmp/freedombone_motd
246
+echo '    su' >> /tmp/freedombone_motd
247
+echo '' >> /tmp/freedombone_motd
248
+echo 'Using the password "root". Change the root user password by typing:' >> /tmp/freedombone_motd
249
+echo '' >> /tmp/freedombone_motd
250
+echo '    passwd' >> /tmp/freedombone_motd
251
+echo '' >> /tmp/freedombone_motd
252
+echo 'Then create a user for the system with:' >> /tmp/freedombone_motd
253
+echo '' >> /tmp/freedombone_motd
254
+echo '    adduser [username]' >> /tmp/freedombone_motd
255
+echo '' >> /tmp/freedombone_motd
256
+echo 'Enter the command "exit" a couple of times to get back to your main system' >> /tmp/freedombone_motd
257
+echo 'then log back in as the user you just created with:' >> /tmp/freedombone_motd
258
+echo '' >> /tmp/freedombone_motd
259
+echo '    ssh [username]@$BBB_FIXED_IP_ADDRESS' >> /tmp/freedombone_motd
260
+echo '' >> /tmp/freedombone_motd
261
+echo 'and use the "su" command to become the root user again.' >> /tmp/freedombone_motd
262
+echo '' >> /tmp/freedombone_motd
263
+echo 'Finally you can use the freedombone command to install a server configuration:' >> /tmp/freedombone_motd
264
+echo '' >> /tmp/freedombone_motd
265
+echo '    apt-get update' >> /tmp/freedombone_motd
266
+echo '    apt-get -y install git dialog build-essential' >> /tmp/freedombone_motd
267
+echo '    freedombone menuconfig' >> /tmp/freedombone_motd
268
+
269
+$SUDO cp -f /tmp/freedombone_motd $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
260 270
 
261 271
 clear
262 272
 echo '*** Initial microSD card setup is complete ***'
@@ -267,5 +277,15 @@ echo ''
267 277
 echo "    ssh debian@$BBB_FIXED_IP_ADDRESS"
268 278
 echo ''
269 279
 echo 'The password is "temppwd".'
270
-cat $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
280
+cat /tmp/freedombone_motd
281
+rm /tmp/freedombone_motd
282
+$SUDO umount $MICROSD_MOUNT_POINT/$ROOTFS
283
+$SUDO umount $MICROSD_MOUNT_POINT/$BOOT
284
+sync
285
+if [ -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
286
+    $SUDO rm -rf $MICROSD_MOUNT_POINT/$ROOTFS
287
+fi
288
+if [ -d $MICROSD_MOUNT_POINT/$BOOT ]; then
289
+    $SUDO rm -rf $MICROSD_MOUNT_POINT/$BOOT
290
+fi
271 291
 exit 0