3 # This script is the receipe to generate the key that have to be created like
4 # if an applicaiton was installed by its installer. It processes using a
5 # registry based on the picture of the registry before the application is
6 # installed and the picture of the registry after the application is installed.
8 # Copyright 1999 Sylvain St-Germain
13 echo " You must provide 2 arguments."
14 echo " 1 - Registry output before the application's installation."
15 echo " 2 - Registry output after the application's installation."
20 echo "Assuming that $1 is the \"before\" file..."
21 echo "Assuming that $2 is the \"after\" file..."
24 # do not attempt to regFix.pl /dev/null ...
26 echo "Fixing exported registry files..."
27 if [ $1 != "/dev/null" ]; then
28 cat $1 | ./regFixer.pl > $1.fix
31 cat $2 | ./regFixer.pl > $2.fix
34 # diff accordingly depending on /dev/null
37 if [ $1 != "/dev/null" ]; then
38 diff $1.fix $2.fix > $2.diff
40 diff /dev/null $2.fix > $2.diff
43 # Keep only added lines
45 echo "Grepping keys to add and generating cleaned fixed registry file."
46 cat $2.diff | grep '^> ' | sed -e 's/^> //' > $2.toAdd
49 # Restore the file format to the regedit export 'like' format
51 echo "Restoring key's in the regedit export format..."
52 cat $2.toAdd | ./regRestorer.pl > $2.toAdd.final
55 rm $1.fix $2.fix >/dev/null 2>&1
56 rm $2.diff >/dev/null 2>&1
57 rm $2.toAdd >/dev/null 2>&1
58 mv $2.toAdd.final $2.toAdd
60 echo "Operation completed, result file is $2.toAdd"