INN commit: trunk/scripts (innreport.in)

INN Commit rra at isc.org
Sun Aug 9 19:56:52 UTC 2015


    Date: Sunday, August 9, 2015 @ 12:56:52
  Author: iulius
Revision: 9929

innreport:  Try to create HTML and IMG directories if they do not exist

It can be helful for new INN installations.

Modified:
  trunk/scripts/innreport.in

--------------+
 innreport.in |   26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

Modified: innreport.in
===================================================================
--- innreport.in	2015-08-08 17:20:23 UTC (rev 9928)
+++ innreport.in	2015-08-09 19:56:52 UTC (rev 9929)
@@ -311,25 +311,33 @@
 }
 
 if ($HTML) {
+  $HTML_dir = "." if defined $HTML_dir && $HTML_dir eq '';
+  # Try to create the directory if it does not exist.
+  unless (-d $HTML_dir) {
+    mkdir($HTML_dir);
+  }
+  unless (-w $HTML_dir) {
+    print "WARNING: can't write in \"$HTML_dir\" as required by -html " .
+      "switch.\n         Option -html and -a removed.  Please see the " .
+      "-d switch.\n\n";
+    undef $HTML;
+    $ARCHIVE = 0;
+  }
   if ($GRAPH) {
     $IMG_dir = "." if defined $IMG_dir && $IMG_dir eq '';
     $IMG_pth .= "/" if $IMG_pth;
     $IMG_pth =~ s|/+|/|g;
     $IMG_dir =~ s|/+|/|g;
+    # Try to create the directory if it does not exist.
+    unless (-d $IMG_dir) {
+      mkdir($IMG_dir);
+    }
     unless (-w $IMG_dir) {
       print "WARNING: can't write in \"$IMG_dir\" as required by -g " .
-	"switch.\n         Option -g removed. Please see the -p switch.\n\n";
+        "switch.\n         Option -g removed.  Please see the -p switch.\n\n";
       undef $GRAPH;
     }
   }
-  $HTML_dir = "." if defined $HTML_dir && $HTML_dir eq '';
-  unless (-w $HTML_dir) {
-    print "WARNING: can't write in \"$HTML_dir\" as required by -html " .
-      "switch.\n         Option -html and -a removed. Please see the " .
-      "-d switch.\n\n";
-    undef $HTML;
-    $ARCHIVE = 0;
-  }
 }
 
 # Now, we are sure that HTML and graphs can be made if options are active.



More information about the inn-committers mailing list