| 1 | #!/bin/bash |
| 2 | GROUP=$(getent group www-data | cut -f3 -d:) |
| 3 | USER=$(getent passwd www-data | cut -f3 -d:) |
| 4 | |
| 5 | rm -rf vm/ vm.squashfs |
| 6 | multistrap -f ex/vm.conf |
| 7 | ln -s vm/usr/bin/mawk vm/bin/awk |
| 8 | echo 'virtfs /mnt 9p trans=virtio,auto 0 0' > vm/etc/fstab |
| 9 | echo '/sbin/poweroff -f' > vm/.bash_logout |
| 10 | cat > vm/.profile <<EOF |
| 11 | mount -a |
| 12 | stty -F /dev/ttyS1 -echo |
| 13 | cd /mnt |
| 14 | export PS1="# " |
| 15 | EOF |
| 16 | cat > vm/etc/initramfs-tools/modules <<EOF |
| 17 | squashfs |
| 18 | 9p |
| 19 | 9pnet |
| 20 | 9pnet_virtio |
| 21 | EOF |
| 22 | install gruntmaster-exec gruntmaster-compile vm/usr/bin/ |
| 23 | sed -i -e "s/setgid 65534/setgid $GROUP/" -e "s/setuid 65534/setuid $USER/" vm/usr/bin/gruntmaster-exec |
| 24 | chroot vm update-initramfs -d -k 3.2.0-4-amd64 |
| 25 | chroot vm update-initramfs -c -k 3.2.0-4-amd64 |
| 26 | mksquashfs vm vm.squashfs -comp lzo |