Remove a manual step from the microSD preparation

This commit is contained in:
Bob Mottram 2015-02-14 14:42:50 +00:00
parent 4fd0c97cb0
commit 51230502bf
1 changed files with 46 additions and 26 deletions

View File

@ -180,7 +180,15 @@ $SUDO ./setup_sdcard.sh --mmc $MICROSD_DRIVE --dtb beaglebone
echo ''
echo ''
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
$SUDO umount $MICROSD_MOUNT_POINT/$ROOTFS
$SUDO umount $MICROSD_MOUNT_POINT/$BOOT
sync
sleep 5
$SUDO mkdir -p $MICROSD_MOUNT_POINT/$BOOT
$SUDO mkdir -p $MICROSD_MOUNT_POINT/$ROOTFS
$SUDO mount ${MICROSD_DRIVE}1 $MICROSD_MOUNT_POINT/$BOOT
$SUDO mount ${MICROSD_DRIVE}2 $MICROSD_MOUNT_POINT/$ROOTFS
sync
if [ ! -b ${MICROSD_DRIVE}1 ]; then
echo ''
@ -233,30 +241,32 @@ if [ ! -f $MICROSD_MOUNT_POINT/$ROOTFS/usr/local/bin/freedombone ]; then
fi
# change the motd to show further install instructions
echo 'Become the root user by typing:' > $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo ' su' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo 'Using the password "root". Change the root user password by typing:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo ' passwd' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo 'Then create a user for the system with:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo ' adduser [username]' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo 'Enter the command "exit" a couple of times to get back to your main system' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo 'then log back in as the user you just created with:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo ' ssh [username]@$BBB_FIXED_IP_ADDRESS' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo 'and use the "su" command to become the root user again.' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo 'Finally you can use the freedombone command to install a server configuration:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo ' apt-get update' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo ' apt-get -y install git dialog build-essential' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo ' freedombone menuconfig' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
echo 'Become the root user by typing:' > /tmp/freedombone_motd
echo '' >> /tmp/freedombone_motd
echo ' su' >> /tmp/freedombone_motd
echo '' >> /tmp/freedombone_motd
echo 'Using the password "root". Change the root user password by typing:' >> /tmp/freedombone_motd
echo '' >> /tmp/freedombone_motd
echo ' passwd' >> /tmp/freedombone_motd
echo '' >> /tmp/freedombone_motd
echo 'Then create a user for the system with:' >> /tmp/freedombone_motd
echo '' >> /tmp/freedombone_motd
echo ' adduser [username]' >> /tmp/freedombone_motd
echo '' >> /tmp/freedombone_motd
echo 'Enter the command "exit" a couple of times to get back to your main system' >> /tmp/freedombone_motd
echo 'then log back in as the user you just created with:' >> /tmp/freedombone_motd
echo '' >> /tmp/freedombone_motd
echo ' ssh [username]@$BBB_FIXED_IP_ADDRESS' >> /tmp/freedombone_motd
echo '' >> /tmp/freedombone_motd
echo 'and use the "su" command to become the root user again.' >> /tmp/freedombone_motd
echo '' >> /tmp/freedombone_motd
echo 'Finally you can use the freedombone command to install a server configuration:' >> /tmp/freedombone_motd
echo '' >> /tmp/freedombone_motd
echo ' apt-get update' >> /tmp/freedombone_motd
echo ' apt-get -y install git dialog build-essential' >> /tmp/freedombone_motd
echo ' freedombone menuconfig' >> /tmp/freedombone_motd
$SUDO cp -f /tmp/freedombone_motd $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
clear
echo '*** Initial microSD card setup is complete ***'
@ -267,5 +277,15 @@ echo ''
echo " ssh debian@$BBB_FIXED_IP_ADDRESS"
echo ''
echo 'The password is "temppwd".'
cat $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
cat /tmp/freedombone_motd
rm /tmp/freedombone_motd
$SUDO umount $MICROSD_MOUNT_POINT/$ROOTFS
$SUDO umount $MICROSD_MOUNT_POINT/$BOOT
sync
if [ -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
$SUDO rm -rf $MICROSD_MOUNT_POINT/$ROOTFS
fi
if [ -d $MICROSD_MOUNT_POINT/$BOOT ]; then
$SUDO rm -rf $MICROSD_MOUNT_POINT/$BOOT
fi
exit 0