cvs commit: hints installwatch.txt

timothy at linuxfromscratch.org timothy at linuxfromscratch.org
Wed Jul 31 06:20:04 PDT 2002


timothy     02/07/31 06:20:04

  Modified:    .        installwatch.txt
  Log:
  Updates by author.
  
  Revision  Changes    Path
  1.6       +27 -37    hints/installwatch.txt
  
  Index: installwatch.txt
  ===================================================================
  RCS file: /home/cvsroot/hints/installwatch.txt,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- installwatch.txt	27 Jul 2002 01:08:45 -0000	1.5
  +++ installwatch.txt	31 Jul 2002 13:20:04 -0000	1.6
  @@ -12,6 +12,9 @@
   Changelog
   ---------
   
  +Revision 1.11  2002/07/31 07:14:50  feztaa
  +Updated nuke script to version 1.12
  +
   Revision 1.10  2002/07/27 01:06:27  feztaa
   Updated nuke script to version 1.11
   
  @@ -28,26 +31,6 @@
   Also changed location of nuke script from /usr/bin to /usr/sbin,
   so that it generally won't be in regular user's $PATH.
   
  -Revision 1.6  2002/05/05 06:18:47  feztaa
  -Updated nuke script to version 1.7
  -
  -Revision 1.5  2002/05/05 01:53:41  feztaa
  -Updated nuke script to version 1.5
  -
  -Revision 1.4  2002/05/03 03:53:15  feztaa
  -Fixed problem with "iw" alias.
  -
  -Revision 1.3  2002/05/03 03:44:41  feztaa
  -Updated nuke script to version 1.4
  -
  -Revision 1.2  2002/04/30 03:38:41  feztaa
  -Added link to ftrace tutorial,
  -removed 'make install' from alias so it's more flexible, and
  -shortened alias name to make it easier to remember.
  -
  -Revision 1.1  2002/04/29 06:13:02  feztaa
  -Initial revision
  -
   Intro
   -----
   
  @@ -148,6 +131,12 @@
   # Author: Robert Park <feztaa at shaw.ca>
   # License: GNU General Public License
   
  +# Revision 1.11  2002/07/31 07:14:50  feztaa
  +# Updated nuke script to version 1.12
  +#
  +# Revision 1.12  2002/07/31 07:11:43  feztaa
  +# Fixed major problem with symlinks that point to directories.
  +#
   # Revision 1.11  2002/07/27 00:45:39  feztaa
   # Major overhaul; reduced LOC and increased efficiency all around.
   #
  @@ -159,13 +148,6 @@
   
   die "You must be root!\n" unless ($< == 0);
   
  -# Used for sorting the list of files; symlinks first,
  -# everything else is by length, longest first.
  -sub symlength
  -{
  -  (-l $a) ? -1 : (-l $b) ? 1 : length $b <=> length $a
  -}
  -
   # Underline a string by appending with with a newline and hyphens
   sub underline
   {
  @@ -187,12 +169,12 @@
                 join(", ", @_[0 .. ($#_-1)], "and $_[-1]");
   }
   
  -my $report;
  +my %opts;
   my @args;
   
   foreach my $arg (@ARGV)
   {
  -  ($arg eq "-r") ? $report = 1 : push @args, $arg;
  +  ($arg =~ m/^(-r|--report)$/) ? $opts{report} = 1 : push @args, $arg;
   }
   
   # Process all the logfiles
  @@ -210,12 +192,11 @@
       next;
     }
   
  -  print "Uninstalling $arg ... " unless ($report);
  -
     open "INSTALL", "<$install" or die "$!\n";
   
  +  print "Processing $arg ... ";
  +
     my %files;
  -  my %directories;
     my $error = 0;
   
     while (<INSTALL>)
  @@ -234,33 +215,42 @@
       }
     }
   
  -  if ($report)
  +  print "done.\n";
  +
  +  if ($opts{report})
     {
       # Reporting mode, don't delete anything.
       print underline("Files/Directories installed by $arg\n");
   
  -    foreach my $file (sort symlength keys %files)
  +    foreach my $file (sort { length $b <=> length $a } keys %files)
       {
         print "$file:  ", commify (@{ $files{$file} }), "\n";
       }
     }
     else
     {
  -    # Not reporting mode, delete stuff.
  +    # Nuke mode, delete stuff...
  +    print "Uninstalling $arg ... ";
  +    
       open "UNINSTALL", ">$uninstall" or die "$!\n";
   
       select UNINSTALL;
   
       print underline("Removed Files/Directories");
   
  -    foreach my $file (sort symlength keys %files)
  +    foreach my $file (sort { length $b <=> length $a } keys %files)
       {
         if (grep /open|symlink|mkdir/, @{ $files{$file} })
         {
           $! = "";
   
           print "\n$file";
  -        (-d $file) ? rmdir "$file" : unlink "$file";
  +
  +        # -d returns true for symlinks that point to directories,
  +        # so this is actually necessary.
  +        (-l "$file") ? unlink "$file" :
  +        (-d "$file") ? rmdir "$file"  :
  +                       unlink "$file";
   
           if ($!)
           {
  
  
  
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe hints' in the subject header of the message



More information about the hints mailing list