瀏覽代碼

Avoid repetitions

Bob Mottram 10 年之前
父節點
當前提交
021b3e915f
共有 1 個文件被更改,包括 15 次插入9 次删除
  1. 15
    9
      initial_setup.sh

+ 15
- 9
initial_setup.sh 查看文件

33
 
33
 
34
 MICROSD_MOUNT_POINT="/media/$USER"
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
 if [ ! MICROSD_DRIVE ]; then
42
 if [ ! MICROSD_DRIVE ]; then
42
 	echo 'You need to specify a drive for the connected microSD.'
43
 	echo 'You need to specify a drive for the connected microSD.'
58
 	mkdir ~/freedombone
59
 	mkdir ~/freedombone
59
 fi
60
 fi
60
 cd ~/freedombone
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
 	wget $DOWNLOAD_LINK1
63
 	wget $DOWNLOAD_LINK1
63
 fi
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
 	# try another site
66
 	# try another site
66
     wget $DOWNLOAD_LINK2
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
 		echo 'The Debian installer could not be downloaded'
69
 		echo 'The Debian installer could not be downloaded'
69
 		exit 3
70
 		exit 3
70
 	fi
71
 	fi
71
 fi
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
 sudo ./setup_sdcard.sh --mmc $MICROSD_DRIVE --dtb beaglebone
81
 sudo ./setup_sdcard.sh --mmc $MICROSD_DRIVE --dtb beaglebone
76
 
82
 
77
 echo ''
83
 echo ''
84
 	read -p "Wait for the drive to mount then press any key... " -n1 -s
90
 	read -p "Wait for the drive to mount then press any key... " -n1 -s
85
 	if [ ! -b ${MICROSD_DRIVE}1 ]; then
91
 	if [ ! -b ${MICROSD_DRIVE}1 ]; then
86
 		echo "microSD drive not found at ${MICROSD_DRIVE}1"
92
 		echo "microSD drive not found at ${MICROSD_DRIVE}1"
87
-		exit 4
93
+		exit 5
88
 	fi
94
 	fi
89
 fi
95
 fi
90
 
96