Start virt-tools-get-key.
[virt-tools.git] / tools / virt-ifconfig.pl
index 74346a6..3455ed5 100755 (executable)
@@ -19,9 +19,7 @@
 use strict;
 
 use Sys::Guestfs;
-use Sys::Guestfs::Lib qw(open_guest get_partitions resolve_windows_path
-  inspect_all_partitions inspect_partition
-  inspect_operating_systems mount_operating_system inspect_in_detail);
+use Sys::Guestfs::Lib qw(open_guest get_partitions);
 use Pod::Usage;
 use Getopt::Long;
 use Locale::TextDomain 'virt-tools';
@@ -83,8 +81,9 @@ my $csv;
 
 =item B<--csv>
 
-Write out the results in CSV format (comma-separated values).
-This format can be imported easily into databases and spreadsheets.
+Write out the results in CSV format (comma-separated values).  This
+format can be imported easily into databases and spreadsheets, but
+read L</NOTE ABOUT CSV FORMAT> below.
 
 =back
 
@@ -170,7 +169,7 @@ sub do_ifconfig
         eval {
             $g->mount_ro ($partition, "/");
            my $dir;
-           my @dirs = ("/var/run/virt-tools", "/run/virt-tools");
+           my @dirs = ("/var/lib/virt-tools", "/lib/virt-tools");
            foreach $dir (@dirs) {
                if ($g->is_dir ($dir)) {
                    my @names = $g->ls ($dir);
@@ -214,15 +213,40 @@ sub do_ifconfig
        }
     } else {
        print STDERR
-           __x("{n}: no IP address found (is guest running virt-tools?)\n",
+           __x("{n}: no IP address found (is it running virt-tools-guest?)\n",
                n => $args[0]);
     }
 }
 
 exit 0;
 
+=head1 NOTE ABOUT CSV FORMAT
+
+Comma-separated values (CSV) is a deceptive format.  It I<seems> like
+it should be easy to parse, but it is definitely not easy to parse.
+
+Myth: Just split fields at commas.  Reality: This does I<not> work
+reliably.  This example has two columns:
+
+ "foo,bar",baz
+
+Myth: Read the file one line at a time.  Reality: This does I<not>
+work reliably.  This example has one row:
+
+ "foo
+ bar",baz
+
+For shell scripts, use C<csvtool> (L<http://merjis.com/developers/csv>
+also packaged in major Linux distributions).
+
+For other languages, use a CSV processing library (eg. C<Text::CSV>
+for Perl or Python's built-in csv library).
+
+Most spreadsheets and databases can import CSV directly.
+
 =head1 SEE ALSO
 
+L<virt-tools(8)>,
 L<guestfs(3)>,
 L<guestfish(1)>,
 L<Sys::Guestfs(3)>,