Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I create wrapper scripts. I try to keep them simple... they're convenience scripts, not a replacement for a build system.

Here's one for a QEMU dev env where I add and remove bits of command line in a freeform way. I just break out the command line into components, and uncomment the ones I want for a particular use:

  #!/bin/bash
  
  set -ex
  
  # Drive created with:
  # /usr/bin/qemu-img create -f qcow2  ngx.qcow2 40G
  
  #vga='-vga cirrus'
  vga='-vga std'
  #vga='-vga qxl'
  
  drive='-drive file=ngx.qcow2,cache=writeback'
  
  tablet='-usbdevice tablet'
  
  #vnc='-vnc :3'
  
  #cdrom="-cdrom base_install.iso"
  #cdrom='-cdrom documentation.iso'
  #cdrom="-cdrom /dev/sr0"
  cdrom=''
  
  #net='-net user -net nic'
  net='-net user,restrict=off,hostfwd=tcp::6666-:6666 -net nic,model=rtl8139,macaddr=00:11:82:C3:54:55'
  #net='-net user,restrict=on,hostfwd=tcp::6666-:6666,hostfwd=tcp::3389-:3389,hostfwd=udp::3389-:3389 -net nic,model=rtl8139,macaddr=00:11:82:C3:54:55'
  
  monitor='-monitor stdio'
  
  qemu-system-x86_64 -enable-kvm -nodefaults -m 768 $vga $drive $tablet $vnc $cdrom $net $monitor
If you have multiple stages to your build/run process, you can chain together a few scripts. build-and-run.sh builds it, and then calls run.sh which runs it. If you want to skip the build step, you use run.sh.


Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: