# # \brief Example for hosting the genode.org website on Genode # \author Norman Feske # \date 2012-08-16 # # This run script uses the lighttpd web server to host the genode.org website. # When executed the first time, the genode.org website is downloaded to # 'bin/genode_org/website'. When the web server is up, you may point your web # browser to http://localhost:5555 # create_boot_directory import_from_depot [depot_user]/src/[base_src] \ [depot_user]/pkg/[drivers_nic_pkg] \ [depot_user]/src/init \ [depot_user]/src/libc \ [depot_user]/src/libcrypto \ [depot_user]/src/libssh \ [depot_user]/src/libssl \ [depot_user]/src/lighttpd \ [depot_user]/src/posix \ [depot_user]/src/vfs \ [depot_user]/src/vfs_lwip \ [depot_user]/src/zlib install_config { } # # Create TAR archive containting the web-server configuration and the # website content. # # lighttpd configuration exec mkdir -p bin/genode_org/etc/lighttpd set fd [open "bin/genode_org/etc/lighttpd/lighttpd.conf" w] puts $fd { server.port = 80 server.document-root = "/website" server.event-handler = "select" server.network-backend = "write" server.max-keep-alive-requests = 0 index-file.names = ( "index", "index.html", "index.htm" ) mimetype.assign = ( ".png" => "image/png", ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", ".gif" => "image/gif", ".css" => "text/css", ".html" => "text/html", ".htm" => "text/html", "" => "text/html", ) } close $fd # mirror of genode.org website if {![file exists bin/genode_org/website/index]} { puts "mirroring genode.org website to bin/genode_org/website..." exec mkdir -p bin/genode_org/website # ignore wget errors catch { exec wget -nH -Lrc -P bin/genode_org/website https://genode.org } } exec tar cfv bin/genode_org.tar -h -C bin/genode_org . build_boot_image { genode_org.tar } proc qemu_nic_model {} { if [have_spec x86] { return e1000 } if [have_spec lan9118] { return lan9118 } if [have_spec zynq] { return cadence_gem } return nic_model_missing } append qemu_args " -netdev user,id=net0,hostfwd=tcp::5555-:80 " append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 " append qemu_args " -nographic " run_genode_until forever