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
10 # This library is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU Lesser General Public
12 # License as published by the Free Software Foundation; either
13 # version 2.1 of the License, or (at your option) any later version.
15 # This library is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # Lesser General Public License for more details.
20 # You should have received a copy of the GNU Lesser General Public
21 # License along with this library; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 echo " You must provide 2 arguments."
28 echo " 1 - Registry output before the application's installation."
29 echo " 2 - Registry output after the application's installation."
34 echo "Assuming that $1 is the \"before\" file..."
35 echo "Assuming that $2 is the \"after\" file..."
38 # do not attempt to regFix.pl /dev/null ...
40 echo "Fixing exported registry files..."
41 if [ $1 != "/dev/null" ]; then
42 cat $1 | .
/regFixer.pl
> $1.fix
45 cat $2 | .
/regFixer.pl
> $2.fix
48 # diff accordingly depending on /dev/null
51 if [ $1 != "/dev/null" ]; then
52 diff $1.fix
$2.fix
> $2.
diff
54 diff /dev
/null
$2.fix
> $2.
diff
58 # Keep only added lines
60 echo "Grepping keys to add and generating cleaned fixed registry file."
61 cat $2.
diff |
grep '^> ' |
sed -e 's/^> //' > $2.toAdd.clean
64 # Restore the file format to the regedit export 'like' format
66 echo "Restoring key's in the regedit export format..."
67 cat $2.toAdd.clean | .
/regRestorer.pl
> $2.toAdd
70 rm $1.fix
$2.fix
>/dev
/null
2>&1
71 rm $2.
diff >/dev
/null
2>&1
72 rm $2.toAdd.clean
>/dev
/null
2>&1
74 echo "Operation completed, result file is $2.toAdd"