Skip to content

Commit a28109c

Browse files
committed
Make shell script POSIX-complaint
Make various updates to shell script toensure POSIX-compliant by removing bash specific syntax
1 parent ebf16ca commit a28109c

File tree

1 file changed

+11
-14
lines changed
  • codeserver/ubi9-python-3.12/nginx/root/usr/share/container-scripts/nginx

1 file changed

+11
-14
lines changed
Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/bin/sh
22

33
# get_matched_files finds file for image extending
4-
function get_matched_files() {
5-
local custom_dir default_dir
4+
get_matched_files() {
65
custom_dir="$1"
76
default_dir="$2"
87
files_matched="$3"
@@ -13,19 +12,17 @@ function get_matched_files() {
1312
# process_extending_files process extending files in $1 and $2 directories
1413
# - source all *.sh files
1514
# (if there are files with same name source only file from $1)
16-
function process_extending_files() {
17-
local custom_dir default_dir
15+
process_extending_files() {
1816
custom_dir=$1
1917
default_dir=$2
20-
while read filename ; do
21-
if [ $filename ]; then
22-
echo "=> sourcing $filename ..."
23-
# Custom file is prefered
24-
if [ -f $custom_dir/$filename ]; then
25-
source $custom_dir/$filename
26-
elif [ -f $default_dir/$filename ]; then
27-
source $default_dir/$filename
28-
fi
18+
get_matched_files "$custom_dir" "$default_dir" '*.sh' | sort -u | while read -r filename; do
19+
if [ "$filename" ]; then
20+
echo "=> sourcing $filename ..."
21+
if [ -f "$custom_dir/$filename" ]; then
22+
. "$custom_dir/$filename"
23+
elif [ -f "$default_dir/$filename" ]; then
24+
. "$default_dir/$filename"
2925
fi
30-
done <<<"$(get_matched_files "$custom_dir" "$default_dir" '*.sh' | sort -u)"
26+
fi
27+
done
3128
}

0 commit comments

Comments
 (0)