From: Peter W. <pet...@st...> - 2002-10-26 15:55:26
|
Lots of ways to do it but what you are probably looking for is patch. diff reports the differences between 2 files. patch takes an original file and applies the changes reported by diff to it in order to create the new file. For example: 1. Edit rc.updatered and save the new version as rc.updatered.new 2. diff -c rc.updatered rc.updatered.new > rc.updatered.diff 3. Copy the rc.updatered.diff file into your patch. 4. Edit your setup script to call patch < rc.updatered.diff man diff/man patch for details. Pete. Gavin Spurgeon said: > Hi All..... > > I need a bit of help, I have managed to make a 3rd Patch > for my accustomed Cop Boxes.... > I have come to a point that needs me to add a command > to a script that is already on the CopBox... So what I need > to do is Insert a line into the correct place in a existing script... as I understand it the > 'Diff' command will be able 2 do this (I think) > > I am going to be calling the diff command from the file called 'setup' witch is inside the > patch.tar.gz along with the file 'information' & I need to add a line to the 'rc.updatered' file > in '/etc/rc.d/' dir > > <Snip of rc.updatered> > > /usr/local/bin/setportfw > /usr/local/bin/restartsnort > /usr/local/bin/setddns.pl > ###################### add a command here ################### > else > if [ "$DOMAIN_NAME" == "" ]; then > /usr/local/bin/dnsmasq -l /var/lib/dhcp/dhcpd.leases > else > /usr/local/bin/dnsmasq -l /var/lib/dhcp/dhcpd.leases -s "$DOMAIN_NAME" > fi > </Snip of rc.updatered> > > so as you can see, I need to add a command @ line 52, but the > command must be above the 'else' witch by default is on line 53. > > can any one shed some light on what I am trying to do ? > any comments welcome, > & thx for your time. > > > -------------------------------------------------------------------------------- > > > "The happiest of people don't necessarily have the best of everything, they just make the most > of everything that comes along their way.." Gavin Spurgeon. > AKA Da Geek |