Commit acf50e36 authored by Pete Tucker's avatar Pete Tucker

Merge branch 'fix/perserve-attributes' into 'master'

Fix/perserve attributes

See merge request vesta/swupdate!1
parents a2dc102b 3c7e8680
......@@ -579,6 +579,14 @@ There are 4 main sections inside sw-description:
| | | | "filesystem" type. (path is always |
| | | | relative to the mount point.) |
+-------------+----------+------------+---------------------------------------+
| preserve- | bool | files | flag to control whether the following |
| attributes | | | attributes will be preserved when |
| | | | files are unpacked from an archive |
| | | | (assuming destination filesystem |
| | | | supports them, of course): |
| | | | timestamp, uid/gid (numeric), perms, |
| | | | file attributes, extended attributes |
+-------------+----------+------------+---------------------------------------+
| type | string | images | string identifier for the handler, |
| | | files | as it is set by the handler when it |
| | | scripts | regitsters itself. |
......
......@@ -197,8 +197,20 @@ static int install_archive_image(struct img_type *img,
TRACE("Installing file %s on %s\n",
img->fname, path);
TRACE("Installing file %s on %s, %s attributes\n",
img->fname, path,
img->preserve_attributes ? "preserving" : "ignoring");
tf.flags = 0;
if (img->preserve_attributes) {
tf.flags |= ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_PERM |
ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_ACL |
ARCHIVE_EXTRACT_FFLAGS | ARCHIVE_EXTRACT_XATTR;
}
ret = pthread_create(&extract_thread, &attr, extract, &tf);
if (ret) {
ERROR("Code from pthread_create() is %d\n",
......
......@@ -72,6 +72,7 @@ struct img_type {
int required;
int provided;
int compressed;
int preserve_attributes; /* whether to preserve attributes in archives */
int is_encrypted;
int install_directly;
int is_script;
......
......@@ -465,11 +465,13 @@ static void parse_files(parsertype p, void *cfg, struct swupdate_cfg *swcfg)
strcpy(file->type, "rawfile");
}
get_field(p, elem, "compressed", &file->compressed);
get_field(p, elem, "preserve-attributes", &file->preserve_attributes);
get_field(p, elem, "installed-directly", &file->install_directly);
get_field(p, elem, "install-if-different", &file->id.install_if_different);
get_field(p, elem, "encrypted", &file->is_encrypted);
TRACE("Found %sFile %s %s: %s --> %s (%s) %s\n",
TRACE("Found %s %s File %s %s: %s --> %s (%s) %s\n",
file->compressed ? "compressed " : "",
file->preserve_attributes ? "perserve" : "no-perserve",
file->id.name,
file->id.version,
file->fname,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment