Skip to content

Commit 93a9741

Browse files
committed
Improve missing_file_test.pass.sh in template file_owner
1 parent ca6ded1 commit 93a9741

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed
Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
#!/bin/bash
22
#
33

4-
{{% if MISSING_FILE_PASS %}}
5-
rm -f {{{ FILEPATH }}}
6-
{{% else %}}
7-
true
8-
{{% endif %}}
4+
{{% for path in FILEPATH %}}
5+
{{% if MISSING_FILE_PASS %}}
6+
rm -f {{{ path }}}
7+
{{% else %}}
8+
{{% if IS_DIRECTORY and RECURSIVE %}}
9+
find -L {{{ path }}} -type d -exec chown {{{ FILEUID }}} {} \;
10+
{{% else %}}
11+
if [ ! -f {{{ path }}} ]; then
12+
mkdir -p "$(dirname '{{{ path }}}')"
13+
touch {{{ path }}}
14+
fi
15+
chown {{{ FILEUID }}} {{{ path }}}
16+
{{% endif %}}
17+
{{% endif %}}
18+
{{% endfor %}}

0 commit comments

Comments
 (0)