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
 username=$MY_USERNAME
200
 username=$MY_USERNAME
201
 echo "warning: creating initial user $username with well known password!"
201
 echo "warning: creating initial user $username with well known password!"
202
 password=$MY_PASSWORD
202
 password=$MY_PASSWORD
203
-chroot $rootdir adduser --gecos $username --disabled-password $username
203
+chroot "$rootdir" adduser --gecos $username --disabled-password $username
204
 echo $username:$password | chroot $rootdir /usr/sbin/chpasswd
204
 echo $username:$password | chroot $rootdir /usr/sbin/chpasswd
205
-chroot $rootdir adduser $username sudo
205
+chroot "$rootdir" adduser $username sudo
206
 
206
 
207
 case "$MACHINE" in
207
 case "$MACHINE" in
208
     virtualbox)
208
     virtualbox)
213
 esac
213
 esac
214
 
214
 
215
 set_apt_sources $BUILD_MIRROR
215
 set_apt_sources $BUILD_MIRROR
216
-chroot $rootdir apt-get update
216
+chroot "$rootdir" apt-get update
217
 
217
 
218
 cat > $rootdir/usr/sbin/policy-rc.d <<EOF
218
 cat > $rootdir/usr/sbin/policy-rc.d <<EOF
219
 #!/bin/sh
219
 #!/bin/sh
232
 fi
232
 fi
233
 
233
 
234
 chroot "$rootdir" apt-get install -y git dialog build-essential openssh-server
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
     tee $rootdir/var/log/freedombone-image-hardware-setup.log
242
     tee $rootdir/var/log/freedombone-image-hardware-setup.log
240
 
243
 
241
 rm $rootdir/usr/sbin/policy-rc.d
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
     tee $rootdir/var/log/freedombone-setup.log
247
     tee $rootdir/var/log/freedombone-setup.log
245
 
248
 
246
 # Remove SSH keys from the image
249
 # Remove SSH keys from the image
247
 rm $rootdir/etc/ssh/ssh_host_* || true
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
 # copy u-boot to beginning of image
259
 # copy u-boot to beginning of image
250
 case "$MACHINE" in
260
 case "$MACHINE" in
251
     beaglebone)
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
         dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/MLO of="$image" \
262
         dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/MLO of="$image" \
256
            count=1 seek=1 conv=notrunc bs=128k
263
            count=1 seek=1 conv=notrunc bs=128k
257
         dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/u-boot.img of="$image" \
264
         dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/u-boot.img of="$image" \
258
            count=2 seek=1 conv=notrunc bs=384k
265
            count=2 seek=1 conv=notrunc bs=384k
259
         ;;
266
         ;;
260
     cubieboard2)
267
     cubieboard2)
261
-        chroot $rootdir apt-get -y install haveged
262
         dd if=$rootdir/usr/lib/u-boot/Cubieboard2/u-boot-sunxi-with-spl.bin of="$image" \
268
         dd if=$rootdir/usr/lib/u-boot/Cubieboard2/u-boot-sunxi-with-spl.bin of="$image" \
263
            seek=8 conv=notrunc bs=1k
269
            seek=8 conv=notrunc bs=1k
264
         ;;
270
         ;;
269
 fi
275
 fi
270
 
276
 
271
 set_apt_sources $MIRROR
277
 set_apt_sources $MIRROR
272
-chroot $rootdir apt-get update
278
+chroot "$rootdir" apt-get update
273
 
279
 
274
 configure_ssh
280
 configure_ssh
275
 configure_networking
281
 configure_networking