]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
* NEWS, src/vipw.c, man/vipw.8.xml: Add --root option.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 6 Nov 2011 18:39:09 +0000 (18:39 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 6 Nov 2011 18:39:09 +0000 (18:39 +0000)
ChangeLog
man/vipw.8.xml
src/vipw.c

index 7d023093a83b3beb3668b7ed1f97469fbf2a2bb7..bf0e43d6a637a9c5d1c1a866e494873d4b7e247f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-10-30  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * NEWS, src/vipw.c, man/vipw.8.xml: Add --root option.
+
 2011-10-30  Nicolas François  <nicolas.francois@centraliens.net>
 
        * NEWS, src/faillog.c, man/faillog.8.xml: Add --root option.
index 5199e84f23952442b827227b36a6b65796980a42..714bf794e49b1f89e69d50a9da56cb5e4e4cbb6c 100644 (file)
@@ -2,7 +2,7 @@
 <!--
    Copyright (c) 1997       , Marek Michałkiewicz
    Copyright (c) 2001 - 2006, Tomasz Kłoczko
-   Copyright (c) 2007 - 2009, Nicolas François
+   Copyright (c) 2007 - 2011, Nicolas François
    All rights reserved.
   
    Redistribution and use in source and binary forms, with or without
          <para>Quiet mode.</para>
        </listitem>
       </varlistentry>
+      <varlistentry>
+       <term>
+         <option>-R</option>, <option>--root</option>
+         <replaceable>CHROOT_DIR</replaceable>
+       </term>
+       <listitem>
+         <para>
+           Apply changes in the <replaceable>CHROOT_DIR</replaceable>
+           directory and use the configuration files from the
+           <replaceable>CHROOT_DIR</replaceable> directory.
+         </para>
+       </listitem>
+      </varlistentry>
       <varlistentry>
        <term><option>-s</option>, <option>--shadow</option></term>
        <listitem>
index 75e59c887fe13aadad05c8a472edae4380725949..181b24b8cdc32207e72d9db57e802b7a49e80746 100644 (file)
@@ -5,7 +5,7 @@
   Copyright (c) 1997       , Guy Maor <maor@ece.utexas.edu>
   Copyright (c) 1999 - 2000, Marek Michałkiewicz
   Copyright (c) 2002 - 2006, Tomasz Kłoczko
-  Copyright (c) 2007 - 2010, Nicolas François
+  Copyright (c) 2007 - 2011, Nicolas François
   All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
@@ -93,6 +93,7 @@ static void usage (int status)
        (void) fputs (_("  -h, --help                    display this help message and exit\n"), usageout);
        (void) fputs (_("  -p, --passwd                  edit passwd database\n"), usageout);
        (void) fputs (_("  -q, --quiet                   quiet mode\n"), usageout);
+       (void) fputs (_("  -R, --root CHROOT_DIR         directory to chroot into\n"), usageout);
        (void) fputs (_("  -s, --shadow                  edit shadow or gshadow database\n"), usageout);
 #ifdef WITH_TCB
        (void) fputs (_("  -u, --user                    which user's tcb shadow file to edit\n"), usageout);
@@ -415,11 +416,14 @@ int main (int argc, char **argv)
        char *a;
        bool do_vipw;
 
+       Prog = Basename (argv[0]);
+
        (void) setlocale (LC_ALL, "");
        (void) bindtextdomain (PACKAGE, LOCALEDIR);
        (void) textdomain (PACKAGE);
 
-       Prog = ((a = strrchr (*argv, '/')) ? a + 1 : *argv);
+       process_root_flag ("-R", argc, argv);
+
        do_vipw = (strcmp (Prog, "vigr") != 0);
 
        OPENLOG (do_vipw ? "vipw" : "vigr");
@@ -434,6 +438,7 @@ int main (int argc, char **argv)
                        {"help", no_argument, NULL, 'h'},
                        {"passwd", no_argument, NULL, 'p'},
                        {"quiet", no_argument, NULL, 'q'},
+                       {"root", required_argument, NULL, 'R'},
                        {"shadow", no_argument, NULL, 's'},
 #ifdef WITH_TCB
                        {"user", required_argument, NULL, 'u'},
@@ -442,9 +447,9 @@ int main (int argc, char **argv)
                };
                while ((c = getopt_long (argc, argv,
 #ifdef WITH_TCB
-                                        "ghpqsu:",
+                                        "ghpqR:su:",
 #else                          /* !WITH_TCB */
-                                        "ghpqs",
+                                        "ghpqR:s",
 #endif                         /* !WITH_TCB */
                                         long_options, NULL)) != -1) {
                        switch (c) {
@@ -460,6 +465,8 @@ int main (int argc, char **argv)
                        case 'q':
                                quiet = true;
                                break;
+                       case 'R': /* no-op, handled in process_root_flag () */
+                               break;
                        case 's':
                                editshadow = true;
                                break;