Hi,<br><br>This change adds a new command-line parameter &quot;--outfile&quot; in ovs-bugtool.<br>So users can specify their own final output filename.<br><br>thanks<br>Shih-Hao<br><br><br>diff --git a/debian/ovs-bugtool b/debian/ovs-bugtool<br>
index 09c879b..6556964 100755<br>--- a/debian/ovs-bugtool<br>+++ b/debian/ovs-bugtool<br>@@ -361,6 +361,7 @@ def main(argv = None):<br>         print &gt;&gt;sys.stderr, &quot;Error: ovs-bugtool must be run as root&quot;<br>
         return 1<br> <br>+    output_file = None<br>     output_type = &#39;tar.bz2&#39;<br>     output_fd = -1<br> <br>@@ -370,7 +371,8 @@ def main(argv = None):<br>     try:<br>         (options, params) = getopt.gnu_getopt(<br>
             argv, &#39;sy&#39;, [&#39;capabilities&#39;, &#39;silent&#39;, &#39;yestoall&#39;, &#39;entries=&#39;,<br>-                         &#39;output=&#39;, &#39;outfd=&#39;, &#39;all&#39;, &#39;unlimited&#39;, &#39;debug&#39;])<br>
+                         &#39;output=&#39;, &#39;outfd=&#39;, &#39;outfile=&#39;, &#39;all&#39;, &#39;unlimited&#39;,<br>+                         &#39;debug&#39;])<br>     except getopt.GetoptError, opterr:<br>         print &gt;&gt;sys.stderr, opterr<br>
         return 2<br>@@ -417,6 +419,9 @@ def main(argv = None):<br>                 print &gt;&gt;sys.stderr, &quot;Invalid output file descriptor&quot;, output_fd<br>                 return 2<br> <br>+        if k == &#39;--outfile&#39;:<br>
+            output_file = v<br>+<br>         elif k == &#39;--all&#39;:<br>             entries = caps.keys()<br>         elif k == &#39;--unlimited&#39;:<br>@@ -433,6 +438,10 @@ def main(argv = None):<br>         print &gt;&gt;sys.stderr, &quot;Option &#39;--outfd&#39; only valid with &#39;--output=tar&#39;&quot;<br>
         return 2<br> <br>+    if output_fd != -1 and output_file is not None:<br>+        print &gt;&gt;sys.stderr, &quot;Cannot set both &#39;--outfd&#39; and &#39;--outfile&#39;&quot;<br>+        return 2<br>+<br>     if ANSWER_YES_TO_ALL:<br>
         output(&quot;Warning: &#39;--yestoall&#39; argument provided, will not prompt for individual files.&quot;)<br> <br>@@ -574,19 +583,24 @@ exclude those logs from the archive.<br>     data[&#39;inventory.xml&#39;] = {&#39;cap&#39;: None, &#39;output&#39;: StringIOmtime(make_inventory(data, subdir))}<br>
 <br>     # create archive<br>-    if output_fd == -1 and not os.path.exists(BUG_DIR):<br>-        try:<br>-            os.makedirs(BUG_DIR)<br>-        except:<br>-            pass<br>+    if output_fd == -1:<br>+        if output_file is None:<br>
+            dirname = BUG_DIR<br>+        else:<br>+            dirname = os.path.dirname(output_file)<br>+        if dirname and not os.path.exists(dirname):<br>+            try:<br>+                os.makedirs(dirname)<br>
+            except:<br>+                pass<br> <br>     if output_fd == -1:<br>         output_ts(&#39;Creating output file&#39;)<br> <br>     if output_type.startswith(&#39;tar&#39;):<br>-        make_tar(subdir, output_type, output_fd)<br>
+        make_tar(subdir, output_type, output_fd, output_file)<br>     else:<br>-        make_zip(subdir)<br>+        make_zip(subdir, output_file)<br> <br>     clean_tapdisk_logs()<br> <br>@@ -774,7 +788,7 @@ def load_plugins(just_capabilities = False):<br>
                     if label == &#39;&#39;: label = None<br>                     cmd_output(dir, getText(el.childNodes), label)<br> <br>-def make_tar(subdir, suffix, output_fd):<br>+def make_tar(subdir, suffix, output_fd, output_file):<br>
     global SILENT_MODE, data<br> <br>     mode = &#39;w&#39;<br>@@ -782,9 +796,12 @@ def make_tar(subdir, suffix, output_fd):<br>         mode = &#39;w:bz2&#39;<br>     elif suffix == &#39;tar.gz&#39;:<br>         mode = &#39;w:gz&#39;<br>
-    filename = &quot;%s/%s.%s&quot; % (BUG_DIR, subdir, suffix)<br> <br>     if output_fd == -1:<br>+        if output_file is None:<br>+            filename = &quot;%s/%s.%s&quot; % (BUG_DIR, subdir, suffix)<br>+        else:<br>
+            filename = output_file<br>         tf = tarfile.open(filename, mode)<br>     else:<br>         tf = tarfile.open(None, &#39;w&#39;, os.fdopen(output_fd, &#39;a&#39;))<br>@@ -819,10 +836,13 @@ def make_tar(subdir, suffix, output_fd):<br>
             print filename<br><br> <br>-def make_zip(subdir):<br>+def make_zip(subdir, output_file):<br>     global SILENT_MODE, data<br> <br>-    filename = &quot;%s/%s.zip&quot; % (BUG_DIR, subdir)<br>+    if output_file is None:<br>
+        filename = &quot;%s/%s.zip&quot; % (BUG_DIR, subdir)<br>+    else:<br>+        filename = output_file<br>     zf = zipfile.ZipFile(filename, &#39;w&#39;, zipfile.ZIP_DEFLATED)<br> <br>     try:<br><br><br>