Prep can use a given disk image
This commit is contained in:
parent
0f91280e28
commit
a6ed6c0a12
|
@ -51,10 +51,11 @@ NAMESERVER2='85.214.20.141'
|
|||
|
||||
MICROSD_MOUNT_POINT="/media/$USER"
|
||||
|
||||
DEBIAN_FILE_NAME="bone-debian-8.1-console-armhf-2015-07-12-2gb"
|
||||
DEBIAN_IMAGE_FILENAME=
|
||||
DEBIAN_FILE_NAME="bone-debian-8.1-console-armhf-2015-07-12-2gb.img"
|
||||
|
||||
# Downloads for the Debian installer
|
||||
DOWNLOAD_LINK1="https://rcn-ee.com/rootfs/bb.org/testing/2015-07-12/console/$DEBIAN_FILE_NAME.img.xz"
|
||||
DOWNLOAD_LINK1="https://rcn-ee.com/rootfs/bb.org/testing/2015-07-12/console/$DEBIAN_FILE_NAME.xz"
|
||||
|
||||
ROOTFS='rootfs'
|
||||
|
||||
|
@ -106,6 +107,11 @@ case $key in
|
|||
MICROSD_DRIVE="$1"
|
||||
;;
|
||||
# BBB static IP address on the LAN
|
||||
-i|--image)
|
||||
shift
|
||||
DEBIAN_IMAGE_FILENAME="$1"
|
||||
;;
|
||||
# BBB static IP address on the LAN
|
||||
--ip)
|
||||
shift
|
||||
BBB_FIXED_IP_ADDRESS="$1"
|
||||
|
@ -172,22 +178,39 @@ if [ ! -d ~/freedombone ]; then
|
|||
mkdir ~/freedombone
|
||||
fi
|
||||
cd ~/freedombone
|
||||
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.img.xz ]; then
|
||||
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.img ]; then
|
||||
wget $DOWNLOAD_LINK1
|
||||
|
||||
# extract the image
|
||||
if [ $DEBIAN_IMAGE_FILENAME ]; then
|
||||
# debian image filename specified as an option
|
||||
if [[ $DEBIAN_IMAGE_FILENAME == *".bz2" ]]; then
|
||||
tar -xjvf $DEBIAN_IMAGE_FILENAME
|
||||
pattern="*.img"
|
||||
files=( $pattern )
|
||||
DEBIAN_IMAGE_FILENAME=${files[0]}
|
||||
fi
|
||||
if [[ $DEBIAN_IMAGE_FILENAME != *".img" ]]; then
|
||||
echo 'Debian image (.img) file expected'
|
||||
exit 62394
|
||||
fi
|
||||
DEBIAN_FILE_NAME=$DEBIAN_IMAGE_FILENAME
|
||||
else
|
||||
# default debian image downloaded from elsewhere
|
||||
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.xz ]; then
|
||||
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME ]; then
|
||||
wget $DOWNLOAD_LINK1
|
||||
fi
|
||||
fi
|
||||
xz -d $DEBIAN_FILE_NAME.xz
|
||||
fi
|
||||
|
||||
echo 'Extracting image...'
|
||||
xz -d $DEBIAN_FILE_NAME.img.xz
|
||||
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.img ]; then
|
||||
echo "Couldn't extract image"
|
||||
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME ]; then
|
||||
echo "Couldn't extract image $DEBIAN_FILE_NAME"
|
||||
exit 4
|
||||
fi
|
||||
|
||||
cd ~/freedombone
|
||||
echo 'Flashing image. This may take a while.'
|
||||
$SUDO dd if=$DEBIAN_FILE_NAME.img of=$MICROSD_DRIVE
|
||||
$SUDO dd if=$DEBIAN_FILE_NAME of=$MICROSD_DRIVE
|
||||
sync
|
||||
|
||||
sleep 5
|
||||
|
|
Loading…
Reference in New Issue