prep gets command line

This commit is contained in:
Bob Mottram 2015-01-16 22:55:18 +00:00
parent 5ee0efa542
commit 740ec2a7dc
2 changed files with 66 additions and 28 deletions

View File

@ -9,6 +9,7 @@ DIR=${APP}-${VERSION}
#update version numbers automatically - so you don't have to #update version numbers automatically - so you don't have to
sed -i 's/VERSION='${PREV_VERSION}'/VERSION='${VERSION}'/g' Makefile sed -i 's/VERSION='${PREV_VERSION}'/VERSION='${VERSION}'/g' Makefile
sed -i 's/VERSION="'${PREV_VERSION}'"/VERSION="'${VERSION}'"/g' src/freedombone sed -i 's/VERSION="'${PREV_VERSION}'"/VERSION="'${VERSION}'"/g' src/freedombone
sed -i 's/VERSION="'${PREV_VERSION}'"/VERSION="'${VERSION}'"/g' src/freedombone-prep
# change the parent directory name to debian format # change the parent directory name to debian format
mv ../${APP} ../${DIR} mv ../${APP} ../${DIR}

View File

@ -25,7 +25,7 @@ VERSION="1.00"
# typically /dev/sdb or /dev/sdc, depending upon how # typically /dev/sdb or /dev/sdc, depending upon how
# many drives there are on your system # many drives there are on your system
MICROSD_DRIVE=$1 MICROSD_DRIVE=
# IP address of the router (gateway) # IP address of the router (gateway)
ROUTER_IP_ADDRESS="192.168.1.254" ROUTER_IP_ADDRESS="192.168.1.254"
@ -41,43 +41,80 @@ DEBIAN_FILE_NAME="debian-jessie-console-armhf-2014-08-13"
DOWNLOAD_LINK1="https://rcn-ee.net/deb/rootfs/jessie/$DEBIAN_FILE_NAME.tar.xz" DOWNLOAD_LINK1="https://rcn-ee.net/deb/rootfs/jessie/$DEBIAN_FILE_NAME.tar.xz"
DOWNLOAD_LINK2="http://ynezz.ibawizard.net/beagleboard/jessie/$DEBIAN_FILE_NAME.tar.xz" DOWNLOAD_LINK2="http://ynezz.ibawizard.net/beagleboard/jessie/$DEBIAN_FILE_NAME.tar.xz"
if [ ! MICROSD_DRIVE ]; then function show_help {
echo 'You need to specify a drive for the connected microSD.' echo ''
echo 'This can most easily be found by removing the microSD, then' echo 'freedombone-prep -d [microSD device] --ip [BBB static IP address] --iprouter [Router IP address]'
echo 'running:' echo ''
echo '' }
echo ' ls /dev/sd*'
echo '' while [[ $# > 1 ]]
echo 'Then plugging the microSD back in and entering the same command again' do
exit 1 key="$1"
case $key in
-h|--help)
show_help
;;
# Drive path for the microSD
-d|--drive)
shift
MICROSD_DRIVE="$1"
;;
# BBB static IP address on the LAN
--ip)
shift
BBB_FIXED_IP_ADDRESS="$1"
;;
# Router IP address on the LAN
--iprouter)
shift
ROUTER_IP_ADDRESS="$1"
;;
*)
# unknown option
;;
esac
shift
done
if [ ! $MICROSD_DRIVE ]; then
echo 'You need to specify a drive for the connected microSD.'
echo 'This can most easily be found by removing the microSD, then'
echo 'running:'
echo ''
echo ' ls /dev/sd*'
echo ''
echo 'Then plugging the microSD back in and entering the same command again'
exit 1
fi fi
if [ ! -b ${MICROSD_DRIVE}1 ]; then if [ ! -b ${MICROSD_DRIVE}1 ]; then
echo "The microSD drive could not be found at ${MICROSD_DRIVE}1" echo "The microSD drive could not be found at ${MICROSD_DRIVE}1"
exit 2 exit 2
fi fi
if [ ! -d ~/freedombone ]; then if [ ! -d ~/freedombone ]; then
mkdir ~/freedombone mkdir ~/freedombone
fi fi
cd ~/freedombone cd ~/freedombone
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
wget $DOWNLOAD_LINK1 wget $DOWNLOAD_LINK1
fi fi
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
# try another site # try another site
wget $DOWNLOAD_LINK2 wget $DOWNLOAD_LINK2
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
echo 'The Debian installer could not be downloaded' echo 'The Debian installer could not be downloaded'
exit 3 exit 3
fi fi
fi fi
echo 'Extracting files...' echo 'Extracting files...'
tar xJf $DEBIAN_FILE_NAME.tar.xz tar xJf $DEBIAN_FILE_NAME.tar.xz
if [ ! -d ~/freedombone/$DEBIAN_FILE_NAME ]; then if [ ! -d ~/freedombone/$DEBIAN_FILE_NAME ]; then
echo "Couldn't extract files" echo "Couldn't extract files"
exit 4 exit 4
fi fi
cd $DEBIAN_FILE_NAME cd $DEBIAN_FILE_NAME
sudo ./setup_sdcard.sh --mmc $MICROSD_DRIVE --dtb beaglebone sudo ./setup_sdcard.sh --mmc $MICROSD_DRIVE --dtb beaglebone
@ -87,13 +124,13 @@ 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 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
if [ ! -b ${MICROSD_DRIVE}1 ]; then if [ ! -b ${MICROSD_DRIVE}1 ]; then
echo '' echo ''
echo "The microSD drive could not be found at ${MICROSD_DRIVE}1" echo "The microSD drive could not be found at ${MICROSD_DRIVE}1"
read -p "Wait for the drive to mount then press any key... " -n1 -s read -p "Wait for the drive to mount then press any key... " -n1 -s
if [ ! -b ${MICROSD_DRIVE}1 ]; then if [ ! -b ${MICROSD_DRIVE}1 ]; then
echo "microSD drive not found at ${MICROSD_DRIVE}1" echo "microSD drive not found at ${MICROSD_DRIVE}1"
exit 5 exit 5
fi fi
fi fi
sudo cp $MICROSD_MOUNT_POINT/BOOT/bbb-uEnv.txt $MICROSD_MOUNT_POINT/BOOT/uEnv.txt sudo cp $MICROSD_MOUNT_POINT/BOOT/bbb-uEnv.txt $MICROSD_MOUNT_POINT/BOOT/uEnv.txt