Skip to content

Commit 6cec640

Browse files
author
Thomas G.
committed
fix: revert to /bin/sh
1 parent 58f684e commit 6cec640

6 files changed

Lines changed: 45 additions & 42 deletions

File tree

src/common-utils/_configure-feature.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
# Source colors script
44
. zz_colors
@@ -12,7 +12,7 @@ help
1212
)
1313

1414
if [ -z "$feature" ]; then
15-
echo -e "Usage: configure-feature <feature>\r"
15+
echo "Usage: configure-feature <feature>${End}"
1616
exit 1
1717
fi
1818

@@ -22,16 +22,16 @@ export source=${source:-/usr/local/share/$feature}
2222
# Get the indent size from devcontainer.json with jq, default to 2 if not found
2323
export tabSize=4
2424

25-
echo -e "Configuring feature <${Purple}$feature${None}>\r"
26-
echo -e "from <$source>\r"
25+
echo "Configuring feature <${Purple}$feature${None}>${End}"
26+
echo "from <$source>${End}"
2727

2828
# Go to the module root
2929
cd "$(git rev-parse --show-toplevel)" >/dev/null
3030

3131
# Deploy stubs if existing
3232
if [ -d $source/stubs ]; then
3333

34-
echo -e "${Blue}Deploy stubs${End}"
34+
echo "${Blue}Deploy stubs${End}"
3535

3636
find $source/stubs -type f -name ".*" -o -type f | while read file; do
3737

@@ -50,7 +50,7 @@ if [ -d $source/stubs ]; then
5050
# Remove # occurrences in the file path
5151
dest=$(echo $dest | sed 's/\/\#/\//g')
5252

53-
echo -e "Add '$dest' to .gitignore\r"
53+
echo "Add '$dest' to .gitignore${End}"
5454

5555
# Add to .gitignore if not already there
5656
grep -qxF $dest .gitignore || echo -e "$dest" >>.gitignore
@@ -67,7 +67,7 @@ if [ -d $source/stubs ]; then
6767
fi
6868

6969
# Log the merging process
70-
echo -e "${Blue}Merge all package folder json files into top level xxx.json${End}"
70+
echo "${Blue}Merge all package folder json files into top level xxx.json${End}"
7171

7272
for package in package composer; do
7373

@@ -77,19 +77,20 @@ for package in package composer; do
7777
echo "{}" >$package.json
7878
else
7979
# Pre-sort the existing package.json
80-
echo -e "${Yellow}Pre-merge normalize $package.json${End}"
80+
echo "${Yellow}Pre-merge normalize $package.json${End}"
8181
normalize-json -s -a -i -t ${tabSize:-4} $package.json
8282
fi
8383

8484
# Merge all package folder json files into the top-level package.json
8585
find $source -maxdepth 1 -name _*.$package.json | sort | while read file; do
86-
echo -e "${Yellow}Merge $file in $package.json${End}"
86+
echo "${Yellow}Merge $file in $package.json${End}"
8787
jq --indent ${tabSize:-4} -s '.[0] * .[1]' $file $package.json >/tmp/$package.json && mv -f /tmp/$package.json $package.json
8888
done
8989

9090
done
9191

9292
# Call all configure-xxx.sh scripts
9393
find $source -maxdepth 1 -name configure-*.sh | sort | while read file; do
94-
echo -e "${Yellow}Run $file${End}"
94+
echo "${Yellow}Run $file${End}"
95+
$file
9596
done

src/common-utils/_install-bin.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
# Source colors script
44
. zz_colors
@@ -9,16 +9,16 @@ eval $(
99
)
1010

1111
if [ -z "$feature" ]; then
12-
echo -e "Usage: install-bin <feature>\r"
12+
echo "Usage: install-bin <feature>${End}"
1313
exit 1
1414
fi
1515

16-
echo -e "Installing bin scripts for <${Purple}$feature${None}>...\r"
16+
echo "Installing bin scripts for <${Purple}$feature${None}>...${End}"
1717

1818
# Find all shell scripts in the target directory, make them executable, and create symbolic links in /usr/local/bin
1919
find $target -type f -name "_*.sh" -exec echo {} \; -exec chmod +x {} \; | while read file; do
2020
# Create a symbolic link in /usr/local/bin with the script name (without the leading underscore and .sh extension)
2121
link=/usr/local/bin/$(basename $file | sed 's/^_//;s/.sh$//')
2222
ln -sf $file $link
23-
echo -e "${Green}Linked '$file' to '$link'${End}"
23+
echo "${Green}Linked '$file' to '$link'${End}"
2424
done
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
# Source colors script
44
. zz_colors
@@ -9,28 +9,28 @@ eval $(
99
)
1010

1111
if [ -z "$feature" ]; then
12-
echo -e "Usage: install-feature <feature>\r"
12+
echo "Usage: install-feature <feature>${End}"
1313
exit 1
1414
fi
1515

16-
echo -e "Installing feature <${Purple}$feature${None}>...\r"
16+
echo "Installing feature <${Purple}$feature${None}>...${End}"
1717

1818
# Copy stubs to the target directory
1919
if [ -d $source/stubs ]; then
20-
echo -e "${Blue}Copying stubs to '$target'...${End}"
20+
echo "${Blue}Copying stubs to '$target'...${End}"
2121
mkdir -p $target/stubs && cp -r $source/stubs/* $target/stubs
2222
else
23-
echo -e "${Yellow}No stubs found in '$source'${End}"
23+
echo "${Yellow}No stubs found in '$source'${End}"
2424
fi
2525

2626
# Install specific utils by copying them to the target directory and making them executable
2727
find $source \( -name "_*" -o -name "configure-*.sh" -o -path "stubs" \) -type f -exec cp {} $target \;
2828
find $target -type f -name "*.sh" -exec chmod +x {} \;
2929

3030
# Call all the install-xxx scripts in the feature directory
31-
echo -e "${Blue}Calling all install scripts in '$source'...${End}"
31+
echo "${Blue}Calling all install scripts in '$source'...${End}"
3232
find $source -type f -name "install-*.sh" | while read script; do
33-
echo -e "${Yellow}Calling $script...${End}"
33+
echo "${Yellow}Calling $script...${End}"
3434
sh $script "$@"
35-
echo -e "${Green}Done!${End}"
35+
echo "${Green}Done!${End}"
3636
done

src/common-utils/_zz_args.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
# Source colors script
44
. zz_colors
@@ -72,43 +72,43 @@ while getopts :$argnames value "$@"; do
7272
naming=$(echo -e "$varnames" | grep -E "^$value" | cut -f2)
7373

7474
if [ -n "$OPTARG" ]; then
75-
echo -e "$naming=$OPTARG"
75+
echo "$naming=$OPTARG"
7676
else
77-
echo -e "$naming=-$value"
77+
echo "$naming=-$value"
7878
fi
7979
done
8080

8181
# Display help information if requested
8282
if [ "$OPTARG" = "h" ] || [ "$OPTARG" = "help" ]; then
8383

8484
(
85-
echo ""
86-
echo -e "$title"
87-
echo ""
88-
echo "Usage: ${Yellow}$(basename $caller)$lineinfo${None}; use ${Yellow}-h${None} for more information."
89-
echo -e "$helpinfo"
90-
echo ""
85+
echo "${End}"
86+
echo "$title${End}"
87+
echo "${End}"
88+
echo "Usage: ${Yellow}$(basename $caller)$lineinfo${None}; use ${Yellow}-h${None} for more information.${End}"
89+
echo "$helpinfo${End}"
90+
echo "${End}"
9191
) >&2
9292

9393
exit 1
9494

9595
elif [ "$OPTARG" = "@" ]; then
96-
echo "Stop processing arguments !" >&2
96+
echo "Stop processing arguments !${End}" >&2
9797
else
9898
# Shift the processed arguments
9999
shift $(expr "$OPTIND" - 1)
100100

101101
# Process remaining '-' parameters
102102
for arg in $(echo $varnames | grep -E "^-" | cut -f2); do
103103
if [ "$#" -gt "0" ]; then
104-
echo -e "$arg=$1" && shift 1
104+
echo "$arg=$1" && shift 1
105105
fi
106106
done
107107

108108
# Process remaining '+' parameters
109109
for arg in $(echo $varnames | grep -E "^\+" | cut -f2); do
110110
if [ "$#" -gt "0" ]; then
111-
echo -e "$arg=$(echo $@ | sed "s/ /\\\\ /g")" && shift $#
111+
echo "$arg=$(echo $@ | sed "s/ /\\\\ /g")" && shift $#
112112
fi
113113
done
114114

src/common-utils/_zz_context.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
# Source colors script
44
. zz_colors
@@ -23,11 +23,11 @@ else
2323

2424
# Determine the caller script, remove /bin/xxx from the beginning of the command line and empty lines
2525
caller=$(readlink -f $PWD/$(tr '\0' '\n' </proc/$PPID/cmdline | sed 's/^\/bin\/.*$//' | grep -v '^$' | head -n 1))
26-
echo "Caller script is <$caller>" >&2
26+
echo "Caller script is <$caller>${End}" >&2
2727

2828
# If the caller script cannot be determined, exit with an error
2929
if [ -z "$caller" ]; then
30-
echo -e "${Red}Not in script context${End}" >&2
30+
echo "${Red}Not in script context${End}" >&2
3131
exit 1
3232
fi
3333

@@ -48,7 +48,7 @@ if [ -z "$target" ]; then
4848
elif [ -w /tmp ]; then
4949
target=/tmp/$feature
5050
else
51-
echo -e "${Red}No writeable directory found${End}" >&2
51+
echo "${Red}No writeable directory found${End}" >&2
5252
exit 1
5353
fi
5454
fi
@@ -57,7 +57,7 @@ fi
5757
mkdir -p $target
5858

5959
# Log the results
60-
echo "Selected context for <${Purple}$feature${None}> is '$source' => '$target'" >&2
60+
echo "Selected context for <${Purple}$feature${None}> is '$source' => '$target'${End}" >&2
6161

6262
# Results
6363
echo source=$source

src/common-utils/devcontainer-feature.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
22
"name": "Common Utils",
3-
"version": "3.3.9",
3+
"version": "3.3.12",
44
"description": "Common utils for tomgrv/devcontainer-features",
55
"dependsOn": {
66
"ghcr.io/devcontainers/features/common-utils": {}
77
},
88
"id": "common-utils",
9-
"installsAfter": ["ghcr.io/devcontainers/features/common-utils"],
9+
"installsAfter": [
10+
"ghcr.io/devcontainers/features/common-utils"
11+
],
1012
"options": {
1113
"utils": {
1214
"type": "string",
@@ -49,4 +51,4 @@
4951
]
5052
}
5153
}
52-
}
54+
}

0 commit comments

Comments
 (0)