2003-10-03 05:34:29 +02:00
|
|
|
#!/bin/sh
|
1999-03-14 15:00:22 +01:00
|
|
|
|
2002-06-01 04:55:48 +02:00
|
|
|
# This script is the receipe to generate the key that have to be created like
|
2003-10-03 05:34:29 +02:00
|
|
|
# if an application was installed by its installer. It processes using a
|
2002-06-01 04:55:48 +02:00
|
|
|
# registry based on the picture of the registry before the application is
|
1999-03-14 15:00:22 +01:00
|
|
|
# installed and the picture of the registry after the application is installed.
|
|
|
|
#
|
|
|
|
# Copyright 1999 Sylvain St-Germain
|
|
|
|
#
|
2002-03-10 00:29:33 +01:00
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
1999-03-14 15:00:22 +01:00
|
|
|
|
|
|
|
if [ $# -ne 2 ]; then
|
|
|
|
echo "$0 Usage: "
|
|
|
|
echo " You must provide 2 arguments."
|
|
|
|
echo " 1 - Registry output before the application's installation."
|
|
|
|
echo " 2 - Registry output after the application's installation."
|
2002-06-01 04:55:48 +02:00
|
|
|
echo
|
1999-03-14 15:00:22 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2003-10-03 05:34:29 +02:00
|
|
|
if [ ! -f $1 ]; then echo "$1 does not exist."; exit 1; fi
|
|
|
|
if [ ! -f $2 ]; then echo "$2 does not exist."; exit 1; fi
|
|
|
|
|
1999-03-14 15:00:22 +01:00
|
|
|
echo "Assuming that $1 is the \"before\" file..."
|
|
|
|
echo "Assuming that $2 is the \"after\" file..."
|
|
|
|
|
|
|
|
#
|
|
|
|
# do not attempt to regFix.pl /dev/null ...
|
|
|
|
#
|
|
|
|
echo "Fixing exported registry files..."
|
2002-05-08 02:17:11 +02:00
|
|
|
|
|
|
|
FIX1_FILE=`mktemp -q /tmp/file1_fix.XXXXXXXXX`
|
|
|
|
FIX2_FILE=`mktemp -q /tmp/file2_fix.XXXXXXXXX`
|
|
|
|
DIFF_FILE=`mktemp -q /tmp/file2_diff.XXXXXXXXX`
|
|
|
|
FILE_TOADD_CLEAN=`mktemp -q /tmp/file_toAdd_clean.XXXXXXXXX`
|
|
|
|
FILE_TOADD=`mktemp -q /tmp/file_toAdd.XXXXXXXXX`
|
|
|
|
|
2002-06-01 04:55:48 +02:00
|
|
|
if [ $1 != "/dev/null" ]; then
|
2002-05-08 02:17:11 +02:00
|
|
|
cat $1 | ./regFixer.pl > $FIX1_FILE
|
1999-03-14 15:00:22 +01:00
|
|
|
fi
|
|
|
|
|
2002-05-08 02:17:11 +02:00
|
|
|
cat $2 | ./regFixer.pl > $FIX2_FILE
|
|
|
|
|
1999-03-14 15:00:22 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# diff accordingly depending on /dev/null
|
|
|
|
#
|
|
|
|
echo "Diffing..."
|
2002-06-01 04:55:48 +02:00
|
|
|
if [ $1 != "/dev/null" ]; then
|
2002-05-08 02:17:11 +02:00
|
|
|
diff $FIX1_FILE $FIX2_FILE > $DIFF_FILE
|
1999-03-14 15:00:22 +01:00
|
|
|
else
|
2002-05-08 02:17:11 +02:00
|
|
|
diff /dev/null $FIX2_FILE > $DIFF_FILE
|
1999-03-14 15:00:22 +01:00
|
|
|
fi
|
2002-02-28 22:46:43 +01:00
|
|
|
|
1999-03-14 15:00:22 +01:00
|
|
|
#
|
|
|
|
# Keep only added lines
|
2002-06-01 04:55:48 +02:00
|
|
|
#
|
1999-03-14 15:00:22 +01:00
|
|
|
echo "Grepping keys to add and generating cleaned fixed registry file."
|
2002-05-08 02:17:11 +02:00
|
|
|
cat $DIFF_FILE | grep '^> ' | sed -e 's/^> //' > $FILE_TOADD_CLEAN
|
1999-03-14 15:00:22 +01:00
|
|
|
|
2002-06-01 04:55:48 +02:00
|
|
|
#
|
1999-03-14 15:00:22 +01:00
|
|
|
# Restore the file format to the regedit export 'like' format
|
|
|
|
#
|
|
|
|
echo "Restoring key's in the regedit export format..."
|
2002-05-08 02:17:11 +02:00
|
|
|
cat $FILE_TOADD_CLEAN | ./regRestorer.pl > $FILE_TOADD
|
1999-03-14 15:00:22 +01:00
|
|
|
|
|
|
|
echo "Cleaning..."
|
2002-05-08 02:17:11 +02:00
|
|
|
rm $FIX1_FILE $FIX2_FILE >/dev/null 2>&1
|
|
|
|
rm $DIFF_FILE >/dev/null 2>&1
|
|
|
|
rm $FILE_TOADD_CLEAN >/dev/null 2>&1
|
|
|
|
|
|
|
|
if mv $FILE_TOADD $2.toAdd
|
|
|
|
then
|
|
|
|
FILE_TOADD=$2.toAdd
|
|
|
|
fi
|
1999-03-14 15:00:22 +01:00
|
|
|
|
2002-05-08 02:17:11 +02:00
|
|
|
echo "Operation completed, result file is '$FILE_TOADD'"
|
1999-03-14 15:00:22 +01:00
|
|
|
|
|
|
|
exit 0
|