Sent this yesterday not sure why it didn't get posted.  Here it is
again.

Mike,
         I agree there should be a simpler method.  After doing the same
for about the first ten systems I set up I decided to write a script to
do all the leg work for me.  Here is my twhelp.sh script that should
make life much simpler for you.  Hope this helps out.  Any comments or
ideas for improvement are welcome.

#! /bin/bash
#
# twhelp.sh
#
#############################################################
#                                                           #
# Christopher Cuevas                                        #
# [EMAIL PROTECTED]                                #
# Nov. 13th 2002                                            #
# Florida Center for Library Automation                     #
# http://www.fcla.edu                                       #
#                                                           #
# twhelp will comment out lines from a twpol.txt file when  #
# supplied with a twreport_file and the path to twpol.txt   #
# and create a twpol.txt.fixed file                         #
#                                                           #
# usage: twhelp  twreport_file  path_to_twpol.txt           #
#                                                           #
#############################################################

E_NOARGS=65
E_ARGERROR=66

if [ $# -eq 0 ]
then
  echo "Usage: `basename $0`  twreport_file  path/to/twpol.txt" >&2 
# Error message to stderr
  exit $E_ARGERROR
fi

# Test for correct file type

type=`eval file $1 | awk '{ print $2 }'`

# "file $1" echos file type...
# then awk removes all but the second field
# the result is fed into the variable "type" and compared to
"correct_type"

correct_type="ASCII"

if [ "$type" != "$correct_type" ]
then
  echo
  echo "This script only works on non executable ascii files."
  echo
fi

cat "$1" | grep Filename: | awk -F: '{ print $2 }' > tmp.fix1

# awk through the twreport file and create a tmp.fix1 file 
# with all paths to files that are not on the system

sed 's/\//\\\//g' tmp.fix1 > tmp.fix2

# add a \ in front of the path so sed will comment it out correctly
# output this to tmp.fix2 

for line in `cat tmp.fix2`
do
  sed "s/.*$line/# &/" "$2" > twpol.txt.fixed
done

# comment out lines from twpol.txt and create twpol.txt.fixed

rm -rf tmp.fix1
rm -rf tmp.fix2

# clean up the tmp.fix files

exit 0

On Tue, 2003-01-14 at 18:06, [EMAIL PROTECTED] wrote:

>   12. Tripwire (Mike Vanecek)

> --__--__--
> 
> Message: 12
> From: "Mike Vanecek" <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Tripwire
> Date: Tue, 14 Jan 2003 16:10:33 -0600
> Reply-To: [EMAIL PROTECTED]
> 
> After doing putting in emailto = root in a dozen places in twpol.txt,
running
> the twinstall.sh script, and doing a tripwire -m c, not surprisingly I
get a
> report of about 150 file exceptions. I just hate the thought of going
through
> and manually editing (commenting out) those exceptions in the
twpol.txt file
> and updating. I have tried the -I option, read the doco 4 times, and
searched
> google and tripwire.org for information.
> 
> Does a simpler method of correcting the twpol.txt file exist than just
sitting
> down with the exception report and manually editing. What a pain!
> 
> Thanks, Mike.
> 
> 
> 



-- 
          _     _                                       _     _
        o' \,=./ `o                                   o' \,=./ `o
           (o o)                                         (o o)
+-------oo0--(_)--0oo-------------------------------ooO--(_)--Ooo---+
|                                                                   |
| Christopher Cuevas                     Phone: (352) 392-9020      |
| F C L A  Open Systems Group            Fax:   (352) 392-9185      |
| 5830 NW 39th Ave.                      http://www.fcla.edu        |
| Gainesville, Fl 32606           Email: [EMAIL PROTECTED] |
|                                                                   |
+-------------------------------------------------------------------+
F l o r i d a  C e n t e r  f o r  L i b r a r y  A u t o m a t i o n
|             0ooo                                   ooo0   0ooo    |
+------ooo0---(  )-----------------------------------(  )---(  )----+
       (  )    )/        "Why waste time learning,    \(     )/     
        \(    (/           when ignorance is instantaneous?" - Calvin
         \)                          
                                                    (o_
Security is simply a speed bump, not a road block.  //\
                                                    V_/_
"You know, sometimes it is the artist's task to find out how much
music you can still make with what you have left."  - Itzhak Perlman



-- 
Psyche-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/psyche-list

Reply via email to