Skip to content

Commit

Permalink
Add a sanity check to the make-site.sh script to ensure the new site …
Browse files Browse the repository at this point in the history
…config doesn't already exist.
  • Loading branch information
patrickcarlohickman committed Jan 23, 2023
1 parent 83c419e commit 2255908
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions setup/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,15 @@ function ensure_file_exists {
fi
}

function ensure_file_missing {
local -r FILE="${1}"

if [[ -f "${FILE}" ]]; then
log_error "File ${FILE} already exists."
exit 1
fi
}

function windows_env_value {
local -r VAR="${1}"
local value="$(/mnt/c/Windows/System32/cmd.exe /C "echo %${VAR}%")"
Expand Down
1 change: 1 addition & 0 deletions setup/resources/apache/make-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ fi
ensure_root
ensure_installed "Apache"
ensure_file_exists "${STUB_FILE}"
ensure_file_missing "${NEW_SITE_CONFIG}"

log_info "Setting up new site config file."

Expand Down

0 comments on commit 2255908

Please sign in to comment.