Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vesta
swupdate
Commits
3a7535b7
Commit
3a7535b7
authored
Dec 18, 2017
by
David Mondou
Browse files
Maitain attributes of files while extracting them.
parent
a2dc102b
Changes
4
Hide whitespace changes
Inline
Side-by-side
doc/source/sw-description.rst
View file @
3a7535b7
...
...
@@ -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. |
...
...
handlers/archive_handler.c
View file @
3a7535b7
...
...
@@ -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
"
,
...
...
include/swupdate.h
View file @
3a7535b7
...
...
@@ -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
;
...
...
parser/parser.c
View file @
3a7535b7
...
...
@@ -465,6 +465,7 @@ 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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment