mkups 0.1.0

Toolkit for creating, applying, and inspecting .ups patches
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
# Takes a binary file and an ups patch
# Outputs a hexdump diff of the input file and the patched output file
set -e
input="$1"
patch="$2"

if [ -z "$input" ] || [ -z "$patch" ]; then
	echo "Usage: $0 <INPUT> <UPSPATCH>"
	exit 1
fi

t="$(mktemp -d)"
trap 'rm -rf "$t"' EXIT
xxd "$input" > "$t/input"
mkups apply "$input" "$patch" | xxd > "$t/patched"
diff -u "$t/input" "$t/patched"