- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-sys-diff
More file actions
Latest commit
executable file
·43 lines (32 loc) · 822 Bytes
/
Copy pathgit-sys-diff
File metadata and controls
executable file
·43 lines (32 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
file="$1"
iftest"x${file}" = "x"||test! -f "${file}"
then
echo"Usage: git sys-diff config-file"
exit 2
fi
package="$(dpkg -S "${file}"| awk -F ': ''{print $1}')"
iftest"x${package}" = "x"
then
package="$(ucfq -w "${file}"| awk -F: '{print $2}')"
fi
iftest"x${package}" = "x"
then
echo"No package found."
exit 1
fi
cache="/var/lib/ucf/cache/${file//\//:}"
if [ -f"$cache" ];then
vimdiff "${cache}""${file}"
exit 0
fi
echo"Package: $package"
archive="$(ls /var/cache/apt/archives/${package}_*.deb | tail -n 1)"
iftest"x${archive}" = "x"
then
echo"no archive found."
exit 1
fi
#dpkg-deb --fsys-tarfile "${archive}" | tar -tvf -
content="$(dpkg-deb --fsys-tarfile /var/cache/apt/archives/${package}_*.deb | tar -xvf - ".${file}" -O)"
vimdiff <(echo "${content}")"${file}"