Browse Source

Avoid repetitions

Bob Mottram 10 years ago
parent
commit
021b3e915f
1 changed files with 15 additions and 9 deletions
  1. 15
    9
      initial_setup.sh

+ 15
- 9
initial_setup.sh View File

@@ -33,10 +33,11 @@ BBB_FIXED_IP_ADDRESS="192.168.2.200"
33 33
 
34 34
 MICROSD_MOUNT_POINT="/media/$USER"
35 35
 
36
-# Downloads for the Debian installer
37
-DOWNLOAD_LINK1="https://rcn-ee.net/deb/rootfs/jessie/debian-jessie-console-armhf-2014-08-13.tar.xz"
38
-DOWNLOAD_LINK2="http://ynezz.ibawizard.net/beagleboard/jessie/debian-jessie-console-armhf-2014-08-13.tar.xz"
36
+DEBIAN_FILE_NAME="debian-jessie-console-armhf-2014-08-13"
39 37
 
38
+# Downloads for the Debian installer
39
+DOWNLOAD_LINK1="https://rcn-ee.net/deb/rootfs/jessie/$DEBIAN_FILE_NAME.tar.xz"
40
+DOWNLOAD_LINK2="http://ynezz.ibawizard.net/beagleboard/jessie/$DEBIAN_FILE_NAME.tar.xz"
40 41
 
41 42
 if [ ! MICROSD_DRIVE ]; then
42 43
 	echo 'You need to specify a drive for the connected microSD.'
@@ -58,20 +59,25 @@ if [ ! -d ~/freedombone ]; then
58 59
 	mkdir ~/freedombone
59 60
 fi
60 61
 cd ~/freedombone
61
-if [ ! -f ~/freedombone/debian-jessie-console-armhf-2014-08-13.tar.xz ]; then
62
+if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
62 63
 	wget $DOWNLOAD_LINK1
63 64
 fi
64
-if [ ! -f ~/freedombone/debian-jessie-console-armhf-2014-08-13.tar.xz ]; then
65
+if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
65 66
 	# try another site
66 67
     wget $DOWNLOAD_LINK2
67
-	if [ ! -f ~/freedombone/debian-jessie-console-armhf-2014-08-13.tar.xz ]; then
68
+	if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
68 69
 		echo 'The Debian installer could not be downloaded'
69 70
 		exit 3
70 71
 	fi
71 72
 fi
72 73
 
73
-tar xJf debian-jessie-console-armhf-2014-08-13.tar.xz
74
-cd debian-*
74
+echo 'Extracting files...'
75
+tar xJf $DEBIAN_FILE_NAME.tar.xz
76
+if [ ! -d ~/freedombone/$DEBIAN_FILE_NAME ]; then
77
+	echo "Couldn't extract files"
78
+	exit 4
79
+fi
80
+cd $DEBIAN_FILE_NAME
75 81
 sudo ./setup_sdcard.sh --mmc $MICROSD_DRIVE --dtb beaglebone
76 82
 
77 83
 echo ''
@@ -84,7 +90,7 @@ if [ ! -b ${MICROSD_DRIVE}1 ]; then
84 90
 	read -p "Wait for the drive to mount then press any key... " -n1 -s
85 91
 	if [ ! -b ${MICROSD_DRIVE}1 ]; then
86 92
 		echo "microSD drive not found at ${MICROSD_DRIVE}1"
87
-		exit 4
93
+		exit 5
88 94
 	fi
89 95
 fi
90 96