View Single Post
  #4   (View Single Post)  
Old 25th March 2009
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default

You can use tar to remove files installed from a NetBSD binary install set.
First view the files
Code:
$ tar tzf games.tgz | less

./etc/mtree/set.games
./usr/games/adventure
./usr/games/arithmetic
./usr/games/atc
./usr/games/backgammon
./usr/games/teachgammon
./usr/games/banner
./usr/games/battlestar
./usr/games/bcd
./usr/games/boggle
./usr/games/caesar
[snip]
./usr/share/man/man8/dm.8
./usr/share/man/man8/strfile.8
./var/games/hackdir/data
./var/games/hackdir/help
./var/games/hackdir/hh
./var/games/hackdir/perm
./var/games/phantasia/gold
./var/games/phantasia/lastdead
./var/games/phantasia/mess
./var/games/phantasia/monsters
./var/games/phantasia/motd
./var/games/phantasia/void
If you want to remove all files
Code:
# tar tzf games.tgz | xargs rm -f
If you want to keep some files, redirect the listing to file and use sed to prepend a # rm -f command.
Code:
# tar tzf games.tgz | sed -e 's/^/# rm -f /' >rm-candidates.sh

# head -10 rm-candidates.sh
# rm -f ./etc/mtree/set.games
# rm -f ./usr/games/adventure
# rm -f ./usr/games/arithmetic
# rm -f ./usr/games/atc
# rm -f ./usr/games/backgammon
# rm -f ./usr/games/teachgammon
# rm -f ./usr/games/banner
# rm -f ./usr/games/battlestar
# rm -f ./usr/games/bcd
# rm -f ./usr/games/boggle
Remove the "#" from the files you want to delete, save it and execute it
Code:
# sh ./rm-candidates.sh
If you want to delete most of the files it may be easier not to have sed prepend the "#" and just insert it for the few files you want to delete
Code:
$ tar tzf games.tgz | sed -e 's/^/rm -f /' | head -10   
rm -f ./etc/mtree/set.games
rm -f ./usr/games/adventure
rm -f ./usr/games/arithmetic
rm -f ./usr/games/atc
rm -f ./usr/games/backgammon
rm -f ./usr/games/teachgammon
rm -f ./usr/games/banner
rm -f ./usr/games/battlestar
rm -f ./usr/games/bcd
rm -f ./usr/games/boggle
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote