Files
spark/docker/sparkd/dev/init_devcontainer.sh
T
John Colvin 2a9f03741e chore: Move docker files into main repo
Changes to Docker-related files/configuration don't occur in a vacuum.
They are made in coordination with changes to the main repository, so it
doesn't make sense to track them separately.

Note: Removing the 'windows' Docker files completely. No one has has
used them in a long, long time. The client build would be broken in
there anyways, the image is based on .NET Framework 3.5!
2023-04-03 13:48:16 +00:00

24 lines
753 B
Bash
Executable File

#!/usr/bin/env bash
# Appends text to a file (unless the text is already there). This avoids
# duplicating lines when the container is rebuilt, since the container's file
# system is persisted on the host beyond the life of the container
function append_line_once() {
if [[ "$#" -ne 2 ]];
echo "`append_line_once` expects 2 args (text, file)"
exit 1
fi
text="$1"
file="$2"
declare -i num_matches="$(wc -l "$(grep "$text" "$file")")"
if [[ "$num_matches" -eq 0 ]]; then
echo "$text" >> "$HOME/.bashrc"
fi
}
append_path_cmd="export PATH=\$PATH:$HOME/.local/bin"
declare -i num_append_path_cmds="$(wc -l "$(grep "$append_path_cmd")")"
if [[ "$num_append_path_cmds" -eq 0 ]]; then
echo "$append_path_cmd" >> "$HOME/.bashrc"
fi