guestfish: Add --selinux option.
authorRichard Jones <rjones@trick.home.annexia.org>
Thu, 13 Aug 2009 19:45:06 +0000 (20:45 +0100)
committerRichard Jones <rjones@trick.home.annexia.org>
Thu, 13 Aug 2009 19:45:06 +0000 (20:45 +0100)
fish/fish.c
guestfish.pod

index f245de1..f31f4ad 100644 (file)
@@ -117,6 +117,7 @@ usage (void)
              "  -n|--no-sync         Don't autosync\n"
              "  --remote[=pid]       Send commands to remote guestfish\n"
              "  -r|--ro              Mount read-only\n"
              "  -n|--no-sync         Don't autosync\n"
              "  --remote[=pid]       Send commands to remote guestfish\n"
              "  -r|--ro              Mount read-only\n"
+             "  --selinux            Enable SELinux support\n"
              "  -v|--verbose         Verbose messages\n"
              "  -x                   Echo each command before executing it\n"
              "  -V|--version         Display version and exit\n"
              "  -v|--verbose         Verbose messages\n"
              "  -x                   Echo each command before executing it\n"
              "  -V|--version         Display version and exit\n"
@@ -139,6 +140,7 @@ main (int argc, char *argv[])
     { "no-sync", 0, 0, 'n' },
     { "remote", 2, 0, 0 },
     { "ro", 0, 0, 'r' },
     { "no-sync", 0, 0, 'n' },
     { "remote", 2, 0, 0 },
     { "ro", 0, 0, 'r' },
+    { "selinux", 0, 0, 0 },
     { "verbose", 0, 0, 'v' },
     { "version", 0, 0, 'V' },
     { 0, 0, 0, 0 }
     { "verbose", 0, 0, 'v' },
     { "version", 0, 0, 'V' },
     { 0, 0, 0, 0 }
@@ -205,6 +207,8 @@ main (int argc, char *argv[])
             exit (1);
           }
         }
             exit (1);
           }
         }
+      } else if (strcmp (long_options[option_index].name, "selinux") == 0) {
+        guestfs_set_selinux (g, 1);
       } else {
         fprintf (stderr, _("guestfish: unknown long option: %s (%d)\n"),
                  long_options[option_index].name, option_index);
       } else {
         fprintf (stderr, _("guestfish: unknown long option: %s (%d)\n"),
                  long_options[option_index].name, option_index);
@@ -306,8 +310,9 @@ main (int argc, char *argv[])
     char cmd[1024];
     int r;
 
     char cmd[1024];
     int r;
 
-    if (drvs || mps || remote_control_listen || remote_control) {
-      fprintf (stderr, _("guestfish: cannot use -i option with -a, -m, --listen or --remote\n"));
+    if (drvs || mps || remote_control_listen || remote_control ||
+        guestfs_get_selinux (g)) {
+      fprintf (stderr, _("guestfish: cannot use -i option with -a, -m, --listen, --remote or --selinux\n"));
       exit (1);
     }
     if (optind >= argc) {
       exit (1);
     }
     if (optind >= argc) {
index f2255f1..5427b23 100644 (file)
@@ -130,9 +130,9 @@ Typical usage is either:
 
  guestfish -i /dev/Guests/MyGuest
 
 
  guestfish -i /dev/Guests/MyGuest
 
-You cannot use I<-a>, I<-m>, I<--listen> or I<--remote> in conjunction
-with this option, and options other than I<--ro> might not behave
-correctly.
+You cannot use I<-a>, I<-m>, I<--listen>, I<--remote> or I<--selinux>
+in conjunction with this option, and options other than I<--ro> might
+not behave correctly.
 
 See also: L<virt-inspector(1)>.
 
 
 See also: L<virt-inspector(1)>.
 
@@ -167,6 +167,10 @@ I<REMOTE CONTROL GUESTFISH OVER A SOCKET> below.
 This changes the C<-m> option so that mounts are done read-only
 (see C<guestfs_mount_ro> in the L<guestfs(3)> manpage).
 
 This changes the C<-m> option so that mounts are done read-only
 (see C<guestfs_mount_ro> in the L<guestfs(3)> manpage).
 
+=item B<--selinux>
+
+Enable SELinux support for the guest.  See L<guestfs(3)/SELINUX>.
+
 =item B<-v> | B<--verbose>
 
 Enable very verbose messages.  This is particularly useful if you find
 =item B<-v> | B<--verbose>
 
 Enable very verbose messages.  This is particularly useful if you find