Last active
August 29, 2015 13:56
-
-
Save ilyaevseev/8818910 to your computer and use it in GitHub Desktop.
For given deb-package, creates list of changed files and line-by-line diff.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
Install_me_so=' | |
apt-get install debsums | |
wget -O /usr/local/bin/deb2diffs https://gist.github.com/ilyaevseev/8818910/raw/67677ef6324554f51aea390e39597ad97140d3de/deb2diffs.sh | |
chmod +x /usr/local/bin/deb2diffs | |
' | |
#set -x | |
Fail() { echo "$@" 1>&2; exit 1; } | |
test -n "$1" || Fail "Usage: $0 <pkgname> Example: deb2diffs otrs2" | |
pkgname="$1" | |
debfile="$(find /var/cache/apt/archives/ -maxdepth 1 -type f -name ${pkgname}*.deb | sort -r | head -1)" | |
test -s "$debfile" || Fail "Missing package ${pkgname}." | |
longname=$(basename $debfile .deb) | |
if test -d "$longname"; then | |
: Fail "Directory $name already exists." | |
else | |
dpkg -x "$debfile" "$longname" | |
fi | |
tstamp="$(LANG=C date +%Y-%m-%d)" | |
debsums $pkgname | | |
awk '/FAILED$/ {print $1;}' | | |
tee "$longname.$tstamp.changed" | | |
while read filepath; do | |
diff -u "${longname}/${filepath}" "${filepath}"; | |
done > "$longname.$tstamp.diff" | |
## END ## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment