]> git.donarmstrong.com Git - bin.git/blob - deepdebdiff
add reset usb bus command
[bin.git] / deepdebdiff
1 #!/bin/sh
2
3 # Copyright © 2011, 2012 Jakub Wilk <jwilk@debian.org>
4
5 # Redistribution and use in source and compiled forms, with or without
6 # modification, are permitted under any circumstances. No warranty.
7
8 if [ $# -ne 2 ]
9 then
10     printf 'Usage: %s <deb1> <deb2>\n' "$0"
11     exit 1
12 fi
13
14 set -e
15
16 deb1="$1"
17 deb2="$2"
18 base1=$(basename "$deb1" .deb)
19 base2=$(basename "$deb2" .deb)
20 tmpdir=$(mktemp -t -d)
21 if which git >/dev/null 2>&1; then
22     git init "$tmpdir/repo" >/dev/null 2>&1
23     (cd "$tmpdir/repo";
24         touch emptyfile;
25         git add emptyfile;
26         git commit -m'initial commit' >/dev/null 2>&1;
27         git checkout -b "$base1"  >/dev/null 2>&1;
28     );
29     dpkg-deb --raw-extract "$deb1" "$tmpdir/repo"
30     (cd "$tmpdir/repo";
31         git add * >/dev/null 2>&1;
32         git rm emptyfile >/dev/null 2>&1;
33         git commit -m"add $base1" >/dev/null 2>&1;
34         git checkout master >/dev/null 2>&1;
35         git checkout -b "$base2" >/dev/null 2>&1;
36     );
37     dpkg-deb --raw-extract "$deb2" "$tmpdir/repo"
38     (cd "$tmpdir/repo";
39         git add * >/dev/null 2>&1;
40         git rm emptyfile >/dev/null 2>&1;
41         git commit -m"add $base2" >/dev/null 2>&1;
42         git diff "$base1" "$base2" --;
43     );
44     rm -rf "$tmpdir";    
45 else
46     mkdir -p "$tmpdir/a/$base1/"
47     dpkg-deb --raw-extract "$deb1" "$tmpdir/a/$base1/"
48     mkdir -p "$tmpdir/b/$base2/"
49     dpkg-deb --raw-extract "$deb2" "$tmpdir/b/$base2/"
50     cd "$tmpdir"
51     diff -urN "a/$base1/" "b/$base2/"
52     cd /
53     rm -rf "$tmpdir"
54 fi;
55
56 # vim:ts=4 sw=4 et