OSvにマージされたmrubyを試す
$ sudo apt-get install openjdk-7-jdk autotools-dev libltdl-dev libtool autoconf autopoint libboost-all-dev \ genromfs zfs-fuse autoconf ant libffi-dev ruby bison gyp git build-essential qemu-utils qemu-system-x86 \ bridge-utils libvirt0 libvirt-bin $ git clone git@github.com/cloudius-systems/osv $ cd osv $ git submodule update --init $ cd apps/mruby $ make module $ cd - $ sudo make external all image=mruby $ sudo ./scripts/run.py OSv v0.05-72-g4eb7d9c mruby-eshell $ ls [".", "..", "libuutil.so", "libzfs.so", "dev", "tools", "proc", "zfs.so", "tmp", "etc", "zpool.so", "usr"] $ exit
ただ、これだけだとスクリプトが何も無いので何も実行できない。
スクリプトを足して再ビルドしてみる。
$ cd apps/mruby $ cat << EOF > tcpsocket.rb s = TCPSocket.open("www.kame.net", 80) s.write("GET / HTTP/1.0\r\n\r\n") puts s.read s.close EOF $ echo "/tcpsocket.rb: \${MODULE_DIR}/tcpsocket.rb" >> usr.manifest $ cd - $ sudo make all image=mruby $ sudo ./scripts/run.py OSv v0.05-72-g4eb7d9c mruby-eshell $ run ./tcpsocket.rb HTTP/1.1 200 OK Date: Sat, 25 Jan 2014 00:13:58 GMT Server: Apache/2.2.26 (FreeBSD) mod_ssl/2.2.26 OpenSSL/0.9.8y DAV/2 Accept-Ranges: bytes Connection: close Content-Type: text/html (後略) $ exit
ソケット通信のテストが実行出来た。