refactor: portable sed -i

This commit is contained in:
Chi-En Wu
2020-05-04 10:28:05 +08:00
parent 1cec2e174e
commit a53a416ef6
2 changed files with 30 additions and 10 deletions
+11 -1
View File
@@ -10,11 +10,21 @@ fi
CHART_NAME=$1
case $(sed --help 2>&1) in
*GNU*)
SED=(sed -i)
;;
*)
SED=(sed -i "")
;;
esac
echo "Creating chart..."
mkdir "$CHART_NAME"
curl --proto '=https' --tlsv1.2 -sSf https://codeload.github.com/hahow/common-chart/tar.gz/master | \
tar -xz -C "$CHART_NAME" --strip=2 common-chart-master/starter
find "$CHART_NAME" -type f | xargs sed -i "" "s/<CHARTNAME>/$CHART_NAME/g"
find "$CHART_NAME" -type f | xargs "${SED[@]}" "s/<CHARTNAME>/$CHART_NAME/g"
echo "Building dependencies..."
helm dep build "$CHART_NAME"