Update notes.
[libguestfs-talks.git] / 2019-lightning-talk / assemble.sh
1 #!/bin/bash -
2
3 f=$tmpdir/source.asm
4 s=$tmpdir/final.asm
5 b=$tmpdir/binary
6
7 case "$1" in
8     config)
9         if [ "$2" = "file" ]; then
10             ln -sf "$(realpath "$3")" $f
11         else
12             echo "unknown parameter $2=$2" >&2
13             exit 1
14         fi ;;
15     config_complete)
16         echo 'org 07c00h' > $s
17         cat $f >> $s
18         echo 'times 510-($-$$) db 0' >> $s
19         echo 'db 055h,0aah' >> $s
20         nasm -f bin $s -o $b ;;
21     get_size) echo 512 ;;
22     pread) dd if=$b skip=$4 count=$3 iflag=count_bytes,skip_bytes ;;
23     can_write) ;;
24     pwrite) exit 1 ;;
25     *) exit 2 ;;
26 esac