Run user programs as nobody:nogroup
[gruntmaster-daemon.git] / ex / makevm
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 mkdir -p vm/proc/
7 mount /proc -o bind vm/proc
8 multistrap -f ex/vm.conf
9 ln -s vm/usr/bin/mawk vm/bin/awk
10 echo '/sbin/poweroff -f' > vm/.bash_logout
11 cat > vm/etc/fstab <<EOF
12 virtfs /mnt 9p trans=virtio,auto 0 0
13 tmpfs /tmp tmpfs defaults 0 0
14 EOF
15 cat > vm/.profile <<EOF
16 mount -a
17 stty -F /dev/ttyS1 -echo
18 cd /mnt
19 export PS1="# "
20 EOF
21 cat > vm/etc/initramfs-tools/modules <<EOF
22 squashfs
23 9p
24 9pnet
25 9pnet_virtio
26 EOF
27 install gruntmaster-exec gruntmaster-compile vm/usr/bin/
28 sed -i -e "s/USER => 65534/USER => $USER/" -e "s/GROUP => 65534/GROUP => $GROUP/" vm/usr/bin/gruntmaster-exec
29 chroot vm update-initramfs -d -k 3.2.0-4-amd64
30 chroot vm update-initramfs -c -k 3.2.0-4-amd64
31 umount vm/proc
32 mksquashfs vm vm.squashfs -comp lzo
This page took 0.0410199999999999 seconds and 4 git commands to generate.