-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwisotool-gensums
65 lines (59 loc) · 2.17 KB
/
wisotool-gensums
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
# Simple wrapper script to find changes made by an installer.
# Usage:
# sh wisosha1dump preinstall # to get a baseline of the WINEPREFIX/Windows install
# install your app here, either manually or with wisotool
# sh wisosha1dump postinstall # used to compare to the preinstall to know what files changed, and get their sha1sum's"
#
# Copyright 2010 Austin English ([email protected])
# License: LGPL 2.1
#
# FIXME: Eventually dump/compare registry too? On Windows, it's easy with reg.exe, Wine's needs work..
case "$OS" in
"Windows_NT")
WINE=""
WINEPREFIX="${WINEPREFIX:-$HOME/.wine}"
DRIVE_C="C:/"
;;
*)
WINE=${WINE:-wine}
WINEPREFIX="${WINEPREFIX:-$HOME/.wine}"
DRIVE_C="$WINEPREFIX/dosdevices/c:"
;;
esac
usage()
{
echo "Usage:"
echo "sh wisosha1dump preinstall # to get a baseline of the WINEPREFIX/Windows install"
echo "# install your app here, either manually or with wisotool"
echo "sh wisosha1dump postinstall # used to compare to the preinstall to know what files changed, and get their sha1sum's"
}
olddir="`pwd`"
# Make find a builtin function so that we can filter out directories we don't want to sha1sum.
# FIXME: Expand this list
# FIXME: Should this use find instead? It would save the sha1sum computation time, but the regex would be very messy
find_exclude()
{
find . -type f -exec sha1sum {} \; 2>&1 | egrep -v "System Volume Information|\$Recycle.bin|hiberfil.sys|pagefile.sys"
}
cd $DRIVE_C
preinstall()
{
find_exclude | sort > "$olddir/preinstall.sha1"
}
postinstall()
{
find_exclude | sort > "$olddir/postinstall.sha1"
cd "$olddir"
diff -u preinstall.sha1 postinstall.sha1 | grep ^+ | grep -v +++ | cut -c2- > tmp.sha1sum
# Fixup the sha1sum's, to make it consistent for wisotooltest
windir="`$WINE cmd /c echo "%windir%" | cut -c 4- | tr -d '\015'`"
progdir="`$WINE cmd /c echo "%ProgramFiles%" | cut -c 4- | tr -d '\015'`"
sed -i -e "s|/$progdir/|/Program\ Files/|" -e "s|/$windir/|/windows/|" tmp.sha1sum
echo "Your sha1sum file is ready for hand editing. File: tmp.sha1sum"
}
case $1 in
preinstall) preinstall ;;
postinstall) postinstall ;;
*) usage ; exit 1;;
esac