]> wimlib.net Git - wimlib/commitdiff
Add support for not extracting file attributes
authorEric Biggers <ebiggers3@gmail.com>
Thu, 16 Jan 2014 02:02:07 +0000 (20:02 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Thu, 16 Jan 2014 02:02:07 +0000 (20:02 -0600)
doc/imagex-apply.1.in
doc/imagex-extract.1.in
include/wimlib.h
programs/imagex.c
src/extract.c

index 1b76adb01ba9f73994e52682adf08907104afe2d..6043d025842bed27d7bab9a32ef665b459d848e8 100644 (file)
@@ -352,6 +352,9 @@ combined with \fB--unix-data\fR to cause \fB@IMAGEX_PROGNAME@\fR to fail
 immediately if the UNIX owner, group, or mode on an extracted file cannot be set
 for any reason.
 .TP
 immediately if the UNIX owner, group, or mode on an extracted file cannot be set
 for any reason.
 .TP
+\fB--no-attributes\fR
+Do not restore Windows file attributes such as readonly, hidden, etc.
+.TP
 \fB--include-invalid-names\fR
 Extract files and directories with invalid names by replacing characters and
 appending a suffix rather than ignoring them.  Exactly what is considered an
 \fB--include-invalid-names\fR
 Extract files and directories with invalid names by replacing characters and
 appending a suffix rather than ignoring them.  Exactly what is considered an
index 3888691502999a534414a6092c73d85661117e26..9a9e1592032593a150be23fb4cf997fbe182494b 100644 (file)
@@ -91,6 +91,9 @@ See the documentation for this option in \fB@IMAGEX_PROGNAME@-apply\fR (1).
 \fB--strict-acls\fR
 See the documentation for this option in \fB@IMAGEX_PROGNAME@-apply\fR (1).
 .TP
 \fB--strict-acls\fR
 See the documentation for this option in \fB@IMAGEX_PROGNAME@-apply\fR (1).
 .TP
+\fB--no-attributes\fR
+See the documentation for this option in \fB@IMAGEX_PROGNAME@-apply\fR (1).
+.TP
 \fB--include-invalid-names\fR
 See the documentation for this option in \fB@IMAGEX_PROGNAME@-apply\fR (1).
 .TP
 \fB--include-invalid-names\fR
 See the documentation for this option in \fB@IMAGEX_PROGNAME@-apply\fR (1).
 .TP
index 28f5e9efd5cda888e300ff324a021182bc346a44..c2c32a8c164712ed6001e788d280676726e48c41 100644 (file)
@@ -1514,6 +1514,9 @@ typedef int (*wimlib_iterate_lookup_table_callback_t)(const struct wimlib_resour
  * one of the provided globs did not match a file.  */
 #define WIMLIB_EXTRACT_FLAG_STRICT_GLOB                        0x00080000
 
  * one of the provided globs did not match a file.  */
 #define WIMLIB_EXTRACT_FLAG_STRICT_GLOB                        0x00080000
 
+/** Do not extract Windows file attributes such as readonly, hidden, etc.  */
+#define WIMLIB_EXTRACT_FLAG_NO_ATTRIBUTES              0x00100000
+
 /** @} */
 /** @ingroup G_mounting_wim_images
  * @{ */
 /** @} */
 /** @ingroup G_mounting_wim_images
  * @{ */
index 990a41e54781abcce94abc9cd652f42170defb5d..6044a93c0c23d9e01a013d89ae88607fb05a4a21 100644 (file)
@@ -145,6 +145,7 @@ enum {
        IMAGEX_NORPFIX_OPTION,
        IMAGEX_NOCHECK_OPTION,
        IMAGEX_NO_ACLS_OPTION,
        IMAGEX_NORPFIX_OPTION,
        IMAGEX_NOCHECK_OPTION,
        IMAGEX_NO_ACLS_OPTION,
+       IMAGEX_NO_ATTRIBUTES_OPTION,
        IMAGEX_NO_WILDCARDS_OPTION,
        IMAGEX_ONE_FILE_ONLY_OPTION,
        IMAGEX_NOT_PIPABLE_OPTION,
        IMAGEX_NO_WILDCARDS_OPTION,
        IMAGEX_ONE_FILE_ONLY_OPTION,
        IMAGEX_NOT_PIPABLE_OPTION,
@@ -183,6 +184,7 @@ static const struct option apply_options[] = {
        {T("noacls"),      no_argument,       NULL, IMAGEX_NO_ACLS_OPTION},
        {T("no-acls"),     no_argument,       NULL, IMAGEX_NO_ACLS_OPTION},
        {T("strict-acls"), no_argument,       NULL, IMAGEX_STRICT_ACLS_OPTION},
        {T("noacls"),      no_argument,       NULL, IMAGEX_NO_ACLS_OPTION},
        {T("no-acls"),     no_argument,       NULL, IMAGEX_NO_ACLS_OPTION},
        {T("strict-acls"), no_argument,       NULL, IMAGEX_STRICT_ACLS_OPTION},
+       {T("no-attributes"), no_argument,     NULL, IMAGEX_NO_ATTRIBUTES_OPTION},
        {T("rpfix"),       no_argument,       NULL, IMAGEX_RPFIX_OPTION},
        {T("norpfix"),     no_argument,       NULL, IMAGEX_NORPFIX_OPTION},
        {T("include-invalid-names"), no_argument,       NULL, IMAGEX_INCLUDE_INVALID_NAMES_OPTION},
        {T("rpfix"),       no_argument,       NULL, IMAGEX_RPFIX_OPTION},
        {T("norpfix"),     no_argument,       NULL, IMAGEX_NORPFIX_OPTION},
        {T("include-invalid-names"), no_argument,       NULL, IMAGEX_INCLUDE_INVALID_NAMES_OPTION},
@@ -264,6 +266,7 @@ static const struct option extract_options[] = {
        {T("noacls"),      no_argument,       NULL, IMAGEX_NO_ACLS_OPTION},
        {T("no-acls"),     no_argument,       NULL, IMAGEX_NO_ACLS_OPTION},
        {T("strict-acls"), no_argument,       NULL, IMAGEX_STRICT_ACLS_OPTION},
        {T("noacls"),      no_argument,       NULL, IMAGEX_NO_ACLS_OPTION},
        {T("no-acls"),     no_argument,       NULL, IMAGEX_NO_ACLS_OPTION},
        {T("strict-acls"), no_argument,       NULL, IMAGEX_STRICT_ACLS_OPTION},
+       {T("no-attributes"), no_argument,     NULL, IMAGEX_NO_ATTRIBUTES_OPTION},
        {T("dest-dir"),    required_argument, NULL, IMAGEX_DEST_DIR_OPTION},
        {T("to-stdout"),   no_argument,       NULL, IMAGEX_TO_STDOUT_OPTION},
        {T("include-invalid-names"), no_argument, NULL, IMAGEX_INCLUDE_INVALID_NAMES_OPTION},
        {T("dest-dir"),    required_argument, NULL, IMAGEX_DEST_DIR_OPTION},
        {T("to-stdout"),   no_argument,       NULL, IMAGEX_TO_STDOUT_OPTION},
        {T("include-invalid-names"), no_argument, NULL, IMAGEX_INCLUDE_INVALID_NAMES_OPTION},
@@ -1618,6 +1621,9 @@ imagex_apply(int argc, tchar **argv, int cmd)
                case IMAGEX_STRICT_ACLS_OPTION:
                        extract_flags |= WIMLIB_EXTRACT_FLAG_STRICT_ACLS;
                        break;
                case IMAGEX_STRICT_ACLS_OPTION:
                        extract_flags |= WIMLIB_EXTRACT_FLAG_STRICT_ACLS;
                        break;
+               case IMAGEX_NO_ATTRIBUTES_OPTION:
+                       extract_flags |= WIMLIB_EXTRACT_FLAG_NO_ATTRIBUTES;
+                       break;
                case IMAGEX_NORPFIX_OPTION:
                        extract_flags |= WIMLIB_EXTRACT_FLAG_NORPFIX;
                        break;
                case IMAGEX_NORPFIX_OPTION:
                        extract_flags |= WIMLIB_EXTRACT_FLAG_NORPFIX;
                        break;
@@ -3008,6 +3014,9 @@ imagex_extract(int argc, tchar **argv, int cmd)
                case IMAGEX_STRICT_ACLS_OPTION:
                        extract_flags |= WIMLIB_EXTRACT_FLAG_STRICT_ACLS;
                        break;
                case IMAGEX_STRICT_ACLS_OPTION:
                        extract_flags |= WIMLIB_EXTRACT_FLAG_STRICT_ACLS;
                        break;
+               case IMAGEX_NO_ATTRIBUTES_OPTION:
+                       extract_flags |= WIMLIB_EXTRACT_FLAG_NO_ATTRIBUTES;
+                       break;
                case IMAGEX_DEST_DIR_OPTION:
                        dest_dir = optarg;
                        break;
                case IMAGEX_DEST_DIR_OPTION:
                        dest_dir = optarg;
                        break;
@@ -4042,8 +4051,9 @@ T(
 T(
 "    %"TS" WIMFILE [(IMAGE_NUM | IMAGE_NAME | all)]\n"
 "                    (DIRECTORY | NTFS_VOLUME) [--check] [--ref=\"GLOB\"]\n"
 T(
 "    %"TS" WIMFILE [(IMAGE_NUM | IMAGE_NAME | all)]\n"
 "                    (DIRECTORY | NTFS_VOLUME) [--check] [--ref=\"GLOB\"]\n"
-"                    [--no-acls] [--strict-acls] [--rpfix] [--norpfix]\n"
-"                    [--hardlink] [--symlink] [--include-invalid-names]\n"
+"                    [--no-acls] [--strict-acls] [--no-attributes]\n"
+"                    [--rpfix] [--norpfix] [--hardlink] [--symlink]\n"
+"                    [--include-invalid-names]\n"
 ),
 [CMD_CAPTURE] =
 T(
 ),
 [CMD_CAPTURE] =
 T(
@@ -4075,7 +4085,7 @@ T(
 T(
 "    %"TS" WIMFILE (IMAGE_NUM | IMAGE_NAME) ([PATH...] | @LISTFILE)\n"
 "                    [--check] [--ref=\"GLOB\"] [--no-acls] [--strict-acls]\n"
 T(
 "    %"TS" WIMFILE (IMAGE_NUM | IMAGE_NAME) ([PATH...] | @LISTFILE)\n"
 "                    [--check] [--ref=\"GLOB\"] [--no-acls] [--strict-acls]\n"
-"                    [--to-stdout] [--dest-dir=CMD_DIR]\n"
+"                    [--no-attributes] [--to-stdout] [--dest-dir=CMD_DIR]\n"
 "                    [--include-invalid-names]\n"
 ),
 [CMD_INFO] =
 "                    [--include-invalid-names]\n"
 ),
 [CMD_INFO] =
index 3e4fbcc88fca43e94d489aea8de3b11591548d3c..23c9305436a4ac744f635226677d955a35968b53 100644 (file)
@@ -669,6 +669,7 @@ extract_file_attributes(const tchar *path, struct apply_ctx *ctx,
        int ret;
 
        if (ctx->ops->set_file_attributes &&
        int ret;
 
        if (ctx->ops->set_file_attributes &&
+           !(ctx->extract_flags & WIMLIB_EXTRACT_FLAG_NO_ATTRIBUTES) &&
            !(dentry == ctx->extract_root && ctx->root_dentry_is_special)) {
                u32 attributes = dentry->d_inode->i_attributes;
 
            !(dentry == ctx->extract_root && ctx->root_dentry_is_special)) {
                u32 attributes = dentry->d_inode->i_attributes;