home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2005 June
/
PCWorld_2005-06_cd.bin
/
software
/
vyzkuste
/
firewally
/
firewally.exe
/
framework-2.3.exe
/
rebaseall
< prev
next >
Wrap
Text File
|
2004-02-17
|
2KB
|
90 lines
#!/bin/bash
#
# Copyright (c) 2003 Jason Tishler
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# A copy of the GNU General Public License can be found at
# http://www.gnu.org/
#
# Written by Jason Tishler <jason@tishler.net>
#
# $Id: rebaseall,v 1.3 2003/02/07 19:39:33 jt Exp $
#
# Define constants
ProgramName=$(basename $0)
ProgramOptions='b:o:v'
DefaultBaseAddress=0x70000000
DefaultOffset=0x10000
DefaultVerbose=
# Define functions
usage()
{
echo "usage: $ProgramName [-b BaseAddress] [-o Offset] [-v]"
exit 1
}
cleanup()
{
rm -f $TmpFile
exit 0
}
# Set traps
trap cleanup HUP INT TERM
# Set defaults
BaseAddress=$DefaultBaseAddress
Offset=$DefaultOffset
Verbose=$DefaultVerbose
# Parse command line arguments
while getopts $ProgramOptions Option $*
do
case $Option in
b)
BaseAddress=$OPTARG;;
o)
Offset=$OPTARG;;
v)
Verbose=-v;;
\?)
usage;;
esac
done
# Set temp directory
TmpDir=${TMP:-${TEMP:-/tmp}}
# Validate temp directory
if [ ! -d $TmpDir ]
then
echo "$ProgramName: $TmpDir is not a directory"
exit 2
fi
if [ ! -w $TmpDir ]
then
echo "$ProgramName: $TmpDir is not writable"
exit 2
fi
# Set temp file
TmpFile=$TmpDir/rebase.lst
# Create rebase list
# FIXME: Remove ugly Apache hack ASAP
zcat /etc/setup/*.lst.gz | grep 'dll$' |
sed -e '/cygwin1.dll$/d' -e 's/^/\//' -e 's/apache\/new/apache/' >$TmpFile
# Rebase files
rebase $Verbose -d -b $BaseAddress -o $Offset -T $TmpFile
# Clean up
cleanup