Skip to content

Commit df4362b

Browse files
jakub-tldrjmichalowski
andauthored
Fixed setup.sh for MacOS (#73)
Co-authored-by: jmichalowski <jmichalowski@teonite.com>
1 parent 7590eb9 commit df4362b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

docker-compose/setup.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ LOG_FILE=$(mktemp setup.log.XXXXXX)
2424
BASE_COMPOSE_FILE_URL="https://raw.githubusercontent.com/DefGuard/deployment/main/docker-compose/docker-compose.yaml"
2525
BASE_ENV_FILE_URL="https://raw.githubusercontent.com/DefGuard/deployment/main/docker-compose/.env.template"
2626

27+
if [ "$(uname)" = 'Darwin' ]; then
28+
SED=(sed -i '')
29+
else
30+
SED=(sed -i)
31+
fi
32+
2733
#####################
2834
### MAIN FUNCTION ###
2935
#####################
@@ -851,7 +857,7 @@ update_env_file() {
851857
set_env_file_value() {
852858
# make sure variable exists in file
853859
grep -qF "${1}=" "${PROD_ENV_FILE}" || echo "${1}=" >>"${PROD_ENV_FILE}"
854-
sed -i "s@\(${1}\)=.*@\1=${2}@" "${PROD_ENV_FILE}"
860+
"${SED[@]}" "s@\(${1}\)=.*@\1=${2}@" "${PROD_ENV_FILE}"
855861
}
856862

857863
set_env_file_secret() {
@@ -863,7 +869,7 @@ set_env_file_password() {
863869
}
864870

865871
uncomment_feature() {
866-
sed -i "s@# \(.*\) # \[${1}\]@\1@" "${2}"
872+
"${SED[@]}" "s@# \(.*\) # \[${1}\]@\1@" "${2}"
867873
}
868874

869875
enable_enrollment() {

0 commit comments

Comments
 (0)