|
@@ -44,6 +44,9 @@ DEBIAN_FILE_NAME="debian-jessie-console-armhf-2014-08-13"
|
44
|
44
|
DOWNLOAD_LINK1="https://rcn-ee.net/deb/rootfs/jessie/$DEBIAN_FILE_NAME.tar.xz"
|
45
|
45
|
DOWNLOAD_LINK2="http://ynezz.ibawizard.net/beagleboard/jessie/$DEBIAN_FILE_NAME.tar.xz"
|
46
|
46
|
|
|
47
|
+ROOTFS='rootfs'
|
|
48
|
+BOOT='BOOT'
|
|
49
|
+
|
47
|
50
|
function show_help {
|
48
|
51
|
echo ''
|
49
|
52
|
echo 'freedombone-prep -d [microSD device] --ip [BBB LAN IP address] --iprouter [Router LAN IP address] --mount [mount directory]'
|
|
@@ -59,9 +62,24 @@ if [[ $NO_OF_ARGS == 0 ]]; then
|
59
|
62
|
fi
|
60
|
63
|
|
61
|
64
|
if [ ! -d $MICROSD_MOUNT_POINT ]; then
|
62
|
|
- echo "The mount directory $MICROSD_MOUNT_POINT does not exist."
|
63
|
|
- echo 'Use the --mount option to specify where the microSD gets mounted to.'
|
64
|
|
- exit 67563
|
|
65
|
+ if [ -d /media ]; then
|
|
66
|
+ if [ ! -d /media/$ROOTFS ]; then
|
|
67
|
+ # different directories for Debian
|
|
68
|
+ if [ -d /media/usb1/home ]; then
|
|
69
|
+ MICROSD_MOUNT_POINT=/media
|
|
70
|
+ ROOTFS=usb1
|
|
71
|
+ fi
|
|
72
|
+ if [ -f /media/usb0/bbb-uEnv.txt ]; then
|
|
73
|
+ MICROSD_MOUNT_POINT=/media
|
|
74
|
+ BOOT=usb0
|
|
75
|
+ fi
|
|
76
|
+ fi
|
|
77
|
+ fi
|
|
78
|
+ if [ ! -d $MICROSD_MOUNT_POINT ]; then
|
|
79
|
+ echo "The mount directory $MICROSD_MOUNT_POINT does not exist."
|
|
80
|
+ echo 'Use the --mount option to specify where the microSD gets mounted to.'
|
|
81
|
+ exit 67563
|
|
82
|
+ fi
|
65
|
83
|
fi
|
66
|
84
|
|
67
|
85
|
while [[ $# > 1 ]]
|
|
@@ -160,60 +178,60 @@ if [ ! -b ${MICROSD_DRIVE}1 ]; then
|
160
|
178
|
fi
|
161
|
179
|
fi
|
162
|
180
|
|
163
|
|
-if [ ! -d $MICROSD_MOUNT_POINT/BOOT ]; then
|
164
|
|
- echo "The boot partition $MICROSD_MOUNT_POINT/BOOT was not found."
|
|
181
|
+if [ ! -d $MICROSD_MOUNT_POINT/$BOOT ]; then
|
|
182
|
+ echo "The boot partition $MICROSD_MOUNT_POINT/$BOOT was not found."
|
165
|
183
|
ls $MICROSD_MOUNT_POINT
|
166
|
184
|
exit 67857
|
167
|
185
|
fi
|
168
|
186
|
|
169
|
|
-if [ ! -d $MICROSD_MOUNT_POINT/rootfs ]; then
|
170
|
|
- echo "The rootfs partition $MICROSD_MOUNT_POINT/rootfs was not found."
|
|
187
|
+if [ ! -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
|
|
188
|
+ echo "The rootfs partition $MICROSD_MOUNT_POINT/$ROOTFS was not found."
|
171
|
189
|
ls $MICROSD_MOUNT_POINT
|
172
|
190
|
exit 65688
|
173
|
191
|
fi
|
174
|
192
|
|
175
|
|
-$SUDO cp $MICROSD_MOUNT_POINT/BOOT/bbb-uEnv.txt $MICROSD_MOUNT_POINT/BOOT/uEnv.txt
|
|
193
|
+$SUDO cp $MICROSD_MOUNT_POINT/$BOOT/bbb-uEnv.txt $MICROSD_MOUNT_POINT/$BOOT/uEnv.txt
|
176
|
194
|
|
177
|
|
-$SUDO sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' $MICROSD_MOUNT_POINT/rootfs/etc/network/interfaces
|
178
|
|
-$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
|
179
|
|
-$SUDO sed -i "/iface eth0 inet static/a\ gateway $ROUTER_IP_ADDRESS" $MICROSD_MOUNT_POINT/rootfs/etc/network/interfaces
|
180
|
|
-$SUDO sed -i '/iface eth0 inet static/a\ netmask 255.255.255.0' $MICROSD_MOUNT_POINT/rootfs/etc/network/interfaces
|
181
|
|
-$SUDO sed -i "/iface eth0 inet static/a\ address $BBB_FIXED_IP_ADDRESS" $MICROSD_MOUNT_POINT/rootfs/etc/network/interfaces
|
182
|
|
-$SUDO sed -i '/iface usb0 inet static/,/ gateway 192.168.7.1/ s/^/#/' $MICROSD_MOUNT_POINT/rootfs/etc/network/interfaces
|
|
195
|
+$SUDO sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
|
196
|
+$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
|
|
197
|
+$SUDO sed -i "/iface eth0 inet static/a\ gateway $ROUTER_IP_ADDRESS" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
|
198
|
+$SUDO sed -i '/iface eth0 inet static/a\ netmask 255.255.255.0' $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
|
199
|
+$SUDO sed -i "/iface eth0 inet static/a\ address $BBB_FIXED_IP_ADDRESS" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
|
200
|
+$SUDO sed -i '/iface usb0 inet static/,/ gateway 192.168.7.1/ s/^/#/' $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
183
|
201
|
|
184
|
|
-$SUDO sed -i 's/nameserver.*/nameserver 213.73.91.35/g' $MICROSD_MOUNT_POINT/rootfs/etc/resolv.conf
|
185
|
|
-$SUDO sed -i '/nameserver 213.73.91.35/a\nameserver 85.214.20.141' $MICROSD_MOUNT_POINT/rootfs/etc/resolv.conf
|
|
202
|
+$SUDO sed -i 's/nameserver.*/nameserver 213.73.91.35/g' $MICROSD_MOUNT_POINT/$ROOTFS/etc/resolv.conf
|
|
203
|
+$SUDO sed -i '/nameserver 213.73.91.35/a\nameserver 85.214.20.141' $MICROSD_MOUNT_POINT/$ROOTFS/etc/resolv.conf
|
186
|
204
|
|
187
|
205
|
# change the motd to show further install instructions
|
188
|
|
-echo 'Become the root user by typing:' > $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
189
|
|
-echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
190
|
|
-echo ' su' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
191
|
|
-echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
192
|
|
-echo 'Using the password "root". Change the root user password by typing:' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
193
|
|
-echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
194
|
|
-echo ' passwd' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
195
|
|
-echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
196
|
|
-echo 'Then create a user for the system with:' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
197
|
|
-echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
198
|
|
-echo ' adduser [username]' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
199
|
|
-echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
200
|
|
-echo 'Enter the command "exit" a couple of times to get back to your main system' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
201
|
|
-echo 'then log back in as the user you just created with:' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
202
|
|
-echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
203
|
|
-echo ' ssh [username]@$BBB_FIXED_IP_ADDRESS' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
204
|
|
-echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
205
|
|
-echo 'and use the "su" command to become the root user again. You can then load' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
206
|
|
-echo 'the freedombone main installation script with:' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
207
|
|
-echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
208
|
|
-echo ' apt-get update' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
209
|
|
-echo ' apt-get -y install git dialog build-essential' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
210
|
|
-echo ' git clone https://github.com/bashrc/freedombone.git' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
211
|
|
-echo ' cd freedombone' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
212
|
|
-echo ' make install' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
213
|
|
-echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
214
|
|
-echo 'Finally you can use the freedombone command to install a server configuration:' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
215
|
|
-echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
216
|
|
-echo ' freedombone menuconfig' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
|
206
|
+echo 'Become the root user by typing:' > $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
207
|
+echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
208
|
+echo ' su' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
209
|
+echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
210
|
+echo 'Using the password "root". Change the root user password by typing:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
211
|
+echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
212
|
+echo ' passwd' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
213
|
+echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
214
|
+echo 'Then create a user for the system with:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
215
|
+echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
216
|
+echo ' adduser [username]' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
217
|
+echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
218
|
+echo 'Enter the command "exit" a couple of times to get back to your main system' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
219
|
+echo 'then log back in as the user you just created with:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
220
|
+echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
221
|
+echo ' ssh [username]@$BBB_FIXED_IP_ADDRESS' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
222
|
+echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
223
|
+echo 'and use the "su" command to become the root user again. You can then load' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
224
|
+echo 'the freedombone main installation script with:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
225
|
+echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
226
|
+echo ' apt-get update' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
227
|
+echo ' apt-get -y install git dialog build-essential' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
228
|
+echo ' git clone https://github.com/bashrc/freedombone.git' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
229
|
+echo ' cd freedombone' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
230
|
+echo ' make install' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
231
|
+echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
232
|
+echo 'Finally you can use the freedombone command to install a server configuration:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
233
|
+echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
|
234
|
+echo ' freedombone menuconfig' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
217
|
235
|
|
218
|
236
|
clear
|
219
|
237
|
echo '*** Initial microSD card setup is complete ***'
|
|
@@ -224,5 +242,5 @@ echo ''
|
224
|
242
|
echo " ssh debian@$BBB_FIXED_IP_ADDRESS"
|
225
|
243
|
echo ''
|
226
|
244
|
echo 'The password is "temppwd".'
|
227
|
|
-cat $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
|
245
|
+cat $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
228
|
246
|
exit 0
|