Bob Mottram 9 years ago
parent
commit
4d3371694a
1 changed files with 18 additions and 12 deletions
  1. 18
    12
      src/freedombone-image-customise

+ 18
- 12
src/freedombone-image-customise View File

@@ -200,9 +200,9 @@ export TMP=/tmp/ TMPDIR=/tmp/
200 200
 username=$MY_USERNAME
201 201
 echo "warning: creating initial user $username with well known password!"
202 202
 password=$MY_PASSWORD
203
-chroot $rootdir adduser --gecos $username --disabled-password $username
203
+chroot "$rootdir" adduser --gecos $username --disabled-password $username
204 204
 echo $username:$password | chroot $rootdir /usr/sbin/chpasswd
205
-chroot $rootdir adduser $username sudo
205
+chroot "$rootdir" adduser $username sudo
206 206
 
207 207
 case "$MACHINE" in
208 208
     virtualbox)
@@ -213,7 +213,7 @@ case "$MACHINE" in
213 213
 esac
214 214
 
215 215
 set_apt_sources $BUILD_MIRROR
216
-chroot $rootdir apt-get update
216
+chroot "$rootdir" apt-get update
217 217
 
218 218
 cat > $rootdir/usr/sbin/policy-rc.d <<EOF
219 219
 #!/bin/sh
@@ -232,33 +232,39 @@ if [ -n "$CUSTOM_SETUP" ]; then
232 232
 fi
233 233
 
234 234
 chroot "$rootdir" apt-get install -y git dialog build-essential openssh-server
235
-chroot "$rootdir" git clone https://github.com/bashrc/freedombone /root/freedombone
236
-chroot "$rootdir" cd /root/freedombone && make install
235
+chroot "$rootdir" /bin/bash -x <<EOF
236
+git clone https://github.com/bashrc/freedombone /root/freedombone
237
+cd /root/freedombone
238
+make install
239
+EOF
237 240
 
238
-chroot $rootdir freedombone-image-hardware-setup 2>&1 | \
241
+chroot "$rootdir" freedombone-image-hardware-setup 2>&1 | \
239 242
     tee $rootdir/var/log/freedombone-image-hardware-setup.log
240 243
 
241 244
 rm $rootdir/usr/sbin/policy-rc.d
242 245
 
243
-chroot $rootdir /usr/lib/freedombone/setup 2>&1 | \
246
+chroot "$rootdir" /usr/lib/freedombone/setup 2>&1 | \
244 247
     tee $rootdir/var/log/freedombone-setup.log
245 248
 
246 249
 # Remove SSH keys from the image
247 250
 rm $rootdir/etc/ssh/ssh_host_* || true
248 251
 
252
+if [[ "$MACHINE" != "beaglebone" ]]; then
253
+    chroot $rootdir apt-get -y install haveged
254
+else
255
+    chroot $rootdir apt-get -y install rng-tools
256
+    sed -i 's|#HRNGDEVICE=/dev/hwrng|HRNGDEVICE=/dev/hwrng|g' $rootdir/etc/default/rng-tools
257
+fi
258
+
249 259
 # copy u-boot to beginning of image
250 260
 case "$MACHINE" in
251 261
     beaglebone)
252
-        chroot $rootdir apt-get -y install rng-tools
253
-        sed -i 's|#HRNGDEVICE=/dev/hwrng|HRNGDEVICE=/dev/hwrng|g' $rootdir/etc/default/rng-tools
254
-
255 262
         dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/MLO of="$image" \
256 263
            count=1 seek=1 conv=notrunc bs=128k
257 264
         dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/u-boot.img of="$image" \
258 265
            count=2 seek=1 conv=notrunc bs=384k
259 266
         ;;
260 267
     cubieboard2)
261
-        chroot $rootdir apt-get -y install haveged
262 268
         dd if=$rootdir/usr/lib/u-boot/Cubieboard2/u-boot-sunxi-with-spl.bin of="$image" \
263 269
            seek=8 conv=notrunc bs=1k
264 270
         ;;
@@ -269,7 +275,7 @@ if $use_eatmydata ; then
269 275
 fi
270 276
 
271 277
 set_apt_sources $MIRROR
272
-chroot $rootdir apt-get update
278
+chroot "$rootdir" apt-get update
273 279
 
274 280
 configure_ssh
275 281
 configure_networking