Revision c03b6c45 snf-image-helper/tasks/50EnforcePersonality.in
b/snf-image-helper/tasks/50EnforcePersonality.in | ||
---|---|---|
16 | 16 |
log_error "Target dir: \`$SNF_IMAGE_TARGET' is missing" |
17 | 17 |
fi |
18 | 18 |
|
19 |
if [ -n "$SNF_IMAGE_PERSONALITY" ]; then |
|
19 |
if [ -z "$SNF_IMAGE_PERSONALITY" ]; then |
|
20 |
warn "This image has no personality (0 files to inject)" |
|
21 |
fi |
|
22 |
|
|
23 |
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = "windows" ]; then |
|
20 | 24 |
echo "$SNF_IMAGE_PERSONALITY" | |
21 | 25 |
@scriptsdir@/inject-files.py "$SNF_IMAGE_TARGET" |
22 |
else |
|
23 |
warn "This image has no personality (0 files to inject)\n" |
|
26 |
exit 0 |
|
27 |
elif [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = "linux" ]; then |
|
28 |
tmpdir=$(chroot "$SNF_IMAGE_TARGET" mktemp -d) |
|
29 |
add_cleanup rm -rf "$SNF_IMAGE_TARGET/$tmpdir" |
|
30 |
echo "$SNF_IMAGE_PERSONALITY" | |
|
31 |
@scriptsdir@/inject-files.py -d "$SNF_IMAGE_TARGET/$tmpdir" |
|
32 |
{ |
|
33 |
while read -d $'\0' src; do |
|
34 |
read -d $'\0' owner; |
|
35 |
read -d $'\0' group; |
|
36 |
read -d $'\0' mode; |
|
37 |
read -d $'\0' dest; |
|
38 |
chroot "$SNF_IMAGE_TARGET" chown "$owner:$group" "$tmpdir/$src" |
|
39 |
chroot "$SNF_IMAGE_TARGET" su -l "$owner" -c \ |
|
40 |
"umask 0007; install -D -m $mode $(printf "%q" "$tmpdir")/$src \ |
|
41 |
$(printf "%q" "$dest")" |
|
42 |
done |
|
43 |
} < "$SNF_IMAGE_TARGET/$tmpdir/manifest" |
|
24 | 44 |
fi |
25 | 45 |
|
26 | 46 |
exit 0 |
Also available in: Unified diff