|
@@ -1,150 +0,0 @@
|
1
|
|
-#!/bin/bash
|
2
|
|
-# This script installs the Debian image to the microSD card, and should
|
3
|
|
-# be run on your laptop/desktop with the microSD card plugged in.
|
4
|
|
-
|
5
|
|
-# License
|
6
|
|
-# =======
|
7
|
|
-#
|
8
|
|
-# Copyright (C) 2014-2015 Bob Mottram <bob@robotics.uk.to>
|
9
|
|
-#
|
10
|
|
-# This program is free software: you can redistribute it and/or modify
|
11
|
|
-# it under the terms of the GNU General Public License as published by
|
12
|
|
-# the Free Software Foundation, either version 3 of the License, or
|
13
|
|
-# (at your option) any later version.
|
14
|
|
-#
|
15
|
|
-# This program is distributed in the hope that it will be useful,
|
16
|
|
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
|
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
|
-# GNU General Public License for more details.
|
19
|
|
-#
|
20
|
|
-# You should have received a copy of the GNU General Public License
|
21
|
|
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
22
|
|
-
|
23
|
|
-# Version number of this script
|
24
|
|
-VERSION="1.00"
|
25
|
|
-
|
26
|
|
-# typically /dev/sdb or /dev/sdc, depending upon how
|
27
|
|
-# many drives there are on your system
|
28
|
|
-MICROSD_DRIVE=$1
|
29
|
|
-
|
30
|
|
-# IP address of the router (gateway)
|
31
|
|
-ROUTER_IP_ADDRESS="192.168.1.254"
|
32
|
|
-
|
33
|
|
-# The fixed IP address of the Beaglebone Black on your local network
|
34
|
|
-BBB_FIXED_IP_ADDRESS="192.168.1.55"
|
35
|
|
-
|
36
|
|
-MICROSD_MOUNT_POINT="/media/$USER"
|
37
|
|
-
|
38
|
|
-DEBIAN_FILE_NAME="debian-jessie-console-armhf-2014-08-13"
|
39
|
|
-
|
40
|
|
-# Downloads for the Debian installer
|
41
|
|
-DOWNLOAD_LINK1="https://rcn-ee.net/deb/rootfs/jessie/$DEBIAN_FILE_NAME.tar.xz"
|
42
|
|
-DOWNLOAD_LINK2="http://ynezz.ibawizard.net/beagleboard/jessie/$DEBIAN_FILE_NAME.tar.xz"
|
43
|
|
-
|
44
|
|
-if [ ! MICROSD_DRIVE ]; then
|
45
|
|
- echo 'You need to specify a drive for the connected microSD.'
|
46
|
|
- echo 'This can most easily be found by removing the microSD, then'
|
47
|
|
- echo 'running:'
|
48
|
|
- echo ''
|
49
|
|
- echo ' ls /dev/sd*'
|
50
|
|
- echo ''
|
51
|
|
- echo 'Then plugging the microSD back in and entering the same command again'
|
52
|
|
- exit 1
|
53
|
|
-fi
|
54
|
|
-
|
55
|
|
-if [ ! -b ${MICROSD_DRIVE}1 ]; then
|
56
|
|
- echo "The microSD drive could not be found at ${MICROSD_DRIVE}1"
|
57
|
|
- exit 2
|
58
|
|
-fi
|
59
|
|
-
|
60
|
|
-if [ ! -d ~/freedombone ]; then
|
61
|
|
- mkdir ~/freedombone
|
62
|
|
-fi
|
63
|
|
-cd ~/freedombone
|
64
|
|
-if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
|
65
|
|
- wget $DOWNLOAD_LINK1
|
66
|
|
-fi
|
67
|
|
-if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
|
68
|
|
- # try another site
|
69
|
|
- wget $DOWNLOAD_LINK2
|
70
|
|
- if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
|
71
|
|
- echo 'The Debian installer could not be downloaded'
|
72
|
|
- exit 3
|
73
|
|
- fi
|
74
|
|
-fi
|
75
|
|
-
|
76
|
|
-echo 'Extracting files...'
|
77
|
|
-tar xJf $DEBIAN_FILE_NAME.tar.xz
|
78
|
|
-if [ ! -d ~/freedombone/$DEBIAN_FILE_NAME ]; then
|
79
|
|
- echo "Couldn't extract files"
|
80
|
|
- exit 4
|
81
|
|
-fi
|
82
|
|
-cd $DEBIAN_FILE_NAME
|
83
|
|
-sudo ./setup_sdcard.sh --mmc $MICROSD_DRIVE --dtb beaglebone
|
84
|
|
-
|
85
|
|
-echo ''
|
86
|
|
-echo ''
|
87
|
|
-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
|
88
|
|
-
|
89
|
|
-if [ ! -b ${MICROSD_DRIVE}1 ]; then
|
90
|
|
- echo ''
|
91
|
|
- echo "The microSD drive could not be found at ${MICROSD_DRIVE}1"
|
92
|
|
- read -p "Wait for the drive to mount then press any key... " -n1 -s
|
93
|
|
- if [ ! -b ${MICROSD_DRIVE}1 ]; then
|
94
|
|
- echo "microSD drive not found at ${MICROSD_DRIVE}1"
|
95
|
|
- exit 5
|
96
|
|
- fi
|
97
|
|
-fi
|
98
|
|
-
|
99
|
|
-sudo cp $MICROSD_MOUNT_POINT/BOOT/bbb-uEnv.txt $MICROSD_MOUNT_POINT/BOOT/uEnv.txt
|
100
|
|
-
|
101
|
|
-sudo sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' $MICROSD_MOUNT_POINT/rootfs/etc/network/interfaces
|
102
|
|
-sudo sed -i '/iface eth0 inet static/a\ dns-nameservers 213.73.91.35 85.214.20.141' $MICROSD_MOUNT_POINT/rootfs/etc/network/interfaces
|
103
|
|
-sudo sed -i "/iface eth0 inet static/a\ gateway $ROUTER_IP_ADDRESS" $MICROSD_MOUNT_POINT/rootfs/etc/network/interfaces
|
104
|
|
-sudo sed -i '/iface eth0 inet static/a\ netmask 255.255.255.0' $MICROSD_MOUNT_POINT/rootfs/etc/network/interfaces
|
105
|
|
-sudo sed -i "/iface eth0 inet static/a\ address $BBB_FIXED_IP_ADDRESS" $MICROSD_MOUNT_POINT/rootfs/etc/network/interfaces
|
106
|
|
-sudo sed -i '/iface usb0 inet static/,/ gateway 192.168.7.1/ s/^/#/' $MICROSD_MOUNT_POINT/rootfs/etc/network/interfaces
|
107
|
|
-
|
108
|
|
-sudo sed -i 's/nameserver.*/nameserver 213.73.91.35/g' $MICROSD_MOUNT_POINT/rootfs/etc/resolv.conf
|
109
|
|
-sudo sed -i '/nameserver 213.73.91.35/a\nameserver 85.214.20.141' $MICROSD_MOUNT_POINT/rootfs/etc/resolv.conf
|
110
|
|
-
|
111
|
|
-clear
|
112
|
|
-echo '*** Initial microSD card setup is complete ***'
|
113
|
|
-echo ''
|
114
|
|
-echo 'The microSD card can now be removed and inserted into the Beaglebone Black.'
|
115
|
|
-echo 'Once the Beaglebone has booted then you can log in with:'
|
116
|
|
-echo ''
|
117
|
|
-echo " ssh debian@$BBB_FIXED_IP_ADDRESS"
|
118
|
|
-echo ''
|
119
|
|
-echo 'The password is "temppwd". You can then become the root user by typing:'
|
120
|
|
-echo ''
|
121
|
|
-echo ' su'
|
122
|
|
-echo ''
|
123
|
|
-echo 'Using the password "root". Change the root user password by typing:'
|
124
|
|
-echo ''
|
125
|
|
-echo ' passwd'
|
126
|
|
-echo ''
|
127
|
|
-echo "If you can't log in as root then try typing 'exit' and then:"
|
128
|
|
-echo ''
|
129
|
|
-echo " ssh root@$BBB_FIXED_IP_ADDRESS"
|
130
|
|
-echo ''
|
131
|
|
-echo 'Then create a user for the system with:'
|
132
|
|
-echo ''
|
133
|
|
-echo ' adduser [username]'
|
134
|
|
-echo ''
|
135
|
|
-echo 'Enter the command "exit" a couple of times to get back to your main system'
|
136
|
|
-echo 'then log back in as the user you just created with:'
|
137
|
|
-echo ''
|
138
|
|
-echo ' ssh [username]@$BBB_FIXED_IP_ADDRESS'
|
139
|
|
-echo ''
|
140
|
|
-echo 'and use the "su" command to become the root user again. You can then load'
|
141
|
|
-echo 'the freedombone main installation script with:'
|
142
|
|
-echo ''
|
143
|
|
-echo ' apt-get -y install git'
|
144
|
|
-echo ' git clone https://github.com/bashrc/freedombone.git'
|
145
|
|
-echo ' cd freedombone'
|
146
|
|
-echo ''
|
147
|
|
-echo 'Finally you can run the freedombone installer with:'
|
148
|
|
-echo ''
|
149
|
|
-echo ' ./install-freedombone.sh [domain] [username] [subdomain code] [variant]'
|
150
|
|
-exit 0
|