Update the prep command with a new Beaglebone Black image
This commit is contained in:
parent
7a55cf62f4
commit
3217d9def6
|
@ -51,14 +51,12 @@ NAMESERVER2='85.214.20.141'
|
||||||
|
|
||||||
MICROSD_MOUNT_POINT="/media/$USER"
|
MICROSD_MOUNT_POINT="/media/$USER"
|
||||||
|
|
||||||
DEBIAN_FILE_NAME="debian-jessie-console-armhf-2014-08-13"
|
DEBIAN_FILE_NAME="bone-debian-8.1-console-armhf-2015-07-12-2gb"
|
||||||
|
|
||||||
# Downloads for the Debian installer
|
# Downloads for the Debian installer
|
||||||
DOWNLOAD_LINK1="https://rcn-ee.net/deb/rootfs/jessie/$DEBIAN_FILE_NAME.tar.xz"
|
DOWNLOAD_LINK1="https://rcn-ee.com/rootfs/bb.org/testing/2015-07-12/console/$DEBIAN_FILE_NAME.img.xz"
|
||||||
DOWNLOAD_LINK2="http://ynezz.ibawizard.net/beagleboard/jessie/$DEBIAN_FILE_NAME.tar.xz"
|
|
||||||
|
|
||||||
ROOTFS='rootfs'
|
ROOTFS='bbb'
|
||||||
BOOT='BOOT'
|
|
||||||
|
|
||||||
function show_help {
|
function show_help {
|
||||||
echo ''
|
echo ''
|
||||||
|
@ -82,7 +80,6 @@ if [ -d /media ]; then
|
||||||
fi
|
fi
|
||||||
if [ -d /media/usb0 ]; then
|
if [ -d /media/usb0 ]; then
|
||||||
MICROSD_MOUNT_POINT=/media
|
MICROSD_MOUNT_POINT=/media
|
||||||
BOOT=usb0
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ ! -d $MICROSD_MOUNT_POINT ]; then
|
if [ ! -d $MICROSD_MOUNT_POINT ]; then
|
||||||
|
@ -92,7 +89,6 @@ if [ ! -d $MICROSD_MOUNT_POINT ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "MICROSD_MOUNT_POINT=$MICROSD_MOUNT_POINT"
|
echo "MICROSD_MOUNT_POINT=$MICROSD_MOUNT_POINT"
|
||||||
echo "BOOT=$BOOT"
|
|
||||||
|
|
||||||
while [[ $# > 1 ]]
|
while [[ $# > 1 ]]
|
||||||
do
|
do
|
||||||
|
@ -156,47 +152,39 @@ if [ ! -b ${MICROSD_DRIVE}1 ]; then
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d ~/freedombone ]; then
|
|
||||||
mkdir ~/freedombone
|
|
||||||
fi
|
|
||||||
cd ~/freedombone
|
|
||||||
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
|
|
||||||
wget $DOWNLOAD_LINK1
|
|
||||||
fi
|
|
||||||
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
|
|
||||||
# try another site
|
|
||||||
wget $DOWNLOAD_LINK2
|
|
||||||
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
|
|
||||||
echo 'The Debian installer could not be downloaded'
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo 'Extracting files...'
|
|
||||||
tar xJf $DEBIAN_FILE_NAME.tar.xz
|
|
||||||
if [ ! -d ~/freedombone/$DEBIAN_FILE_NAME ]; then
|
|
||||||
echo "Couldn't extract files"
|
|
||||||
exit 4
|
|
||||||
fi
|
|
||||||
cd $DEBIAN_FILE_NAME
|
|
||||||
|
|
||||||
SUDO=
|
SUDO=
|
||||||
if [ -f /usr/bin/sudo ]; then
|
if [ -f /usr/bin/sudo ]; then
|
||||||
SUDO='sudo'
|
SUDO='sudo'
|
||||||
fi
|
fi
|
||||||
$SUDO apt-get install u-boot-tools dosfstools git-core kpartx wget parted
|
$SUDO apt-get install p7zip dd wget
|
||||||
$SUDO ./setup_sdcard.sh --mmc $MICROSD_DRIVE --dtb beaglebone
|
|
||||||
|
|
||||||
echo ''
|
if [ ! -d ~/freedombone ]; then
|
||||||
echo ''
|
mkdir ~/freedombone
|
||||||
$SUDO umount $MICROSD_MOUNT_POINT/$ROOTFS
|
fi
|
||||||
$SUDO umount $MICROSD_MOUNT_POINT/$BOOT
|
cd ~/freedombone
|
||||||
|
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.img.xz ]; then
|
||||||
|
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.img ]; then
|
||||||
|
wget $DOWNLOAD_LINK1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 'Extracting image...'
|
||||||
|
xz -d $DEBIAN_FILE_NAME.img.xz
|
||||||
|
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.img ]; then
|
||||||
|
echo "Couldn't extract image"
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd ~/freedombone
|
||||||
|
echo 'Flashing image. This may take a while.'
|
||||||
|
$SUDO dd if=$DEBIAN_FILE_NAME.img of=$MICROSD_DRIVE
|
||||||
sync
|
sync
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
$SUDO mkdir -p $MICROSD_MOUNT_POINT/$BOOT
|
if [ ! -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
|
||||||
$SUDO mkdir -p $MICROSD_MOUNT_POINT/$ROOTFS
|
$SUDO mkdir -p $MICROSD_MOUNT_POINT/$ROOTFS
|
||||||
$SUDO mount ${MICROSD_DRIVE}1 $MICROSD_MOUNT_POINT/$BOOT
|
fi
|
||||||
$SUDO mount ${MICROSD_DRIVE}2 $MICROSD_MOUNT_POINT/$ROOTFS
|
$SUDO mount ${MICROSD_DRIVE}1 $MICROSD_MOUNT_POINT/$ROOTFS
|
||||||
sync
|
sync
|
||||||
|
|
||||||
if [ ! -b ${MICROSD_DRIVE}1 ]; then
|
if [ ! -b ${MICROSD_DRIVE}1 ]; then
|
||||||
|
@ -209,13 +197,6 @@ if [ ! -b ${MICROSD_DRIVE}1 ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d $MICROSD_MOUNT_POINT/$BOOT ]; then
|
|
||||||
echo ''
|
|
||||||
echo "The boot partition $MICROSD_MOUNT_POINT/$BOOT was not found."
|
|
||||||
ls $MICROSD_MOUNT_POINT
|
|
||||||
exit 67857
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
|
if [ ! -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
|
||||||
echo ''
|
echo ''
|
||||||
echo "The rootfs partition $MICROSD_MOUNT_POINT/$ROOTFS was not found."
|
echo "The rootfs partition $MICROSD_MOUNT_POINT/$ROOTFS was not found."
|
||||||
|
@ -230,8 +211,6 @@ if [ ! -d $MICROSD_MOUNT_POINT/$ROOTFS/home ]; then
|
||||||
exit 65688
|
exit 65688
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$SUDO cp $MICROSD_MOUNT_POINT/$BOOT/bbb-uEnv.txt $MICROSD_MOUNT_POINT/$BOOT/uEnv.txt
|
|
||||||
|
|
||||||
$SUDO sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
$SUDO sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
||||||
$SUDO sed -i "/iface eth0 inet static/a\ dns-nameservers $NAMESERVER1 $NAMESERVER2" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
$SUDO sed -i "/iface eth0 inet static/a\ dns-nameservers $NAMESERVER1 $NAMESERVER2" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
||||||
$SUDO sed -i "/iface eth0 inet static/a\ gateway $ROUTER_IP_ADDRESS" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
$SUDO sed -i "/iface eth0 inet static/a\ gateway $ROUTER_IP_ADDRESS" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
||||||
|
@ -250,15 +229,8 @@ if [ ! -f $MICROSD_MOUNT_POINT/$ROOTFS/usr/local/bin/freedombone ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# change the motd to show further install instructions
|
# change the motd to show further install instructions
|
||||||
echo 'Become the root user by typing:' > /tmp/freedombone_motd
|
|
||||||
echo '' >> /tmp/freedombone_motd
|
echo '' >> /tmp/freedombone_motd
|
||||||
echo ' su' >> /tmp/freedombone_motd
|
echo 'Create a user for the system with:' >> /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 '' >> /tmp/freedombone_motd
|
||||||
echo ' adduser [username]' >> /tmp/freedombone_motd
|
echo ' adduser [username]' >> /tmp/freedombone_motd
|
||||||
echo '' >> /tmp/freedombone_motd
|
echo '' >> /tmp/freedombone_motd
|
||||||
|
@ -283,18 +255,14 @@ echo ''
|
||||||
echo 'The microSD card can now be removed and inserted into the Beaglebone Black.'
|
echo 'The microSD card can now be removed and inserted into the Beaglebone Black.'
|
||||||
echo 'Once the Beaglebone has booted then you can log in with:'
|
echo 'Once the Beaglebone has booted then you can log in with:'
|
||||||
echo ''
|
echo ''
|
||||||
echo " ssh debian@$BBB_FIXED_IP_ADDRESS"
|
echo " ssh root@$BBB_FIXED_IP_ADDRESS"
|
||||||
echo ''
|
echo ''
|
||||||
echo 'The password is "temppwd".'
|
echo 'The root password should be changed with the command "passwd".'
|
||||||
cat /tmp/freedombone_motd
|
cat /tmp/freedombone_motd
|
||||||
rm /tmp/freedombone_motd
|
rm /tmp/freedombone_motd
|
||||||
$SUDO umount $MICROSD_MOUNT_POINT/$ROOTFS
|
$SUDO umount $MICROSD_MOUNT_POINT/$ROOTFS
|
||||||
$SUDO umount $MICROSD_MOUNT_POINT/$BOOT
|
|
||||||
sync
|
sync
|
||||||
if [ -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
|
if [ -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
|
||||||
$SUDO rm -rf $MICROSD_MOUNT_POINT/$ROOTFS
|
$SUDO rm -rf $MICROSD_MOUNT_POINT/$ROOTFS
|
||||||
fi
|
fi
|
||||||
if [ -d $MICROSD_MOUNT_POINT/$BOOT ]; then
|
|
||||||
$SUDO rm -rf $MICROSD_MOUNT_POINT/$BOOT
|
|
||||||
fi
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue