updates srcdir/setup paths

pull/4/head
Hari Sekhon 1 year ago
parent 539bd784f1
commit 0fc0c010c3

@ -28,7 +28,7 @@ fi
export PATH="$PATH:/opt/appveyor/host-agent" export PATH="$PATH:/opt/appveyor/host-agent"
if ! type -P appveyor-host-agent &>/dev/null; then if ! type -P appveyor-host-agent &>/dev/null; then
"$srcdir/setup/install_appveyor_byoc.sh" "$srcdir/../setup/install_appveyor_byoc.sh"
clear clear
fi fi

@ -44,7 +44,7 @@ help_usage "$@"
#min_args 1 "$@" #min_args 1 "$@"
if ! command -v eksctl &>/dev/null; then if ! command -v eksctl &>/dev/null; then
"$srcdir/setup/install_eksctl.sh" "$srcdir/../setup/install_eksctl.sh"
echo echo
fi fi

@ -55,7 +55,7 @@ export COMPOSE_PROJECT_NAME="bash-tools"
export COMPOSE_FILE="$srcdir/../docker-compose/keycloak.yml" export COMPOSE_FILE="$srcdir/../docker-compose/keycloak.yml"
if ! type docker-compose &>/dev/null; then if ! type docker-compose &>/dev/null; then
"$srcdir/setup/install_docker_compose.sh" "$srcdir/../setup/install_docker_compose.sh"
fi fi
action="${1:-up}" action="${1:-up}"

@ -61,7 +61,7 @@ else
#gem install --user-install travis --no-rdoc --no-ri #gem install --user-install travis --no-rdoc --no-ri
#"$srcdir/ruby_gem_install_if_absent.sh" travis #"$srcdir/ruby_gem_install_if_absent.sh" travis
# handles SSL linking issues on Mac # handles SSL linking issues on Mac
NONINTERACTIVE=1 "$srcdir/setup/install_travis.sh" NONINTERACTIVE=1 "$srcdir/../setup/install_travis.sh"
for path in ~/.gem/ruby/*/bin; do for path in ~/.gem/ruby/*/bin; do
[ -d "$path" ] || continue [ -d "$path" ] || continue
echo "adding $path to \$PATH" echo "adding $path to \$PATH"

@ -74,7 +74,7 @@ pipeline="${PWD##*/}"
job="$pipeline/build" job="$pipeline/build"
if ! type docker-compose &>/dev/null; then if ! type docker-compose &>/dev/null; then
"$srcdir/setup/install_docker_compose.sh" "$srcdir/../setup/install_docker_compose.sh"
fi fi
action="${1:-up}" action="${1:-up}"

@ -55,7 +55,7 @@ export COMPOSE_PROJECT_NAME="bash-tools"
export COMPOSE_FILE="$srcdir/../docker-compose/gocd.yml" export COMPOSE_FILE="$srcdir/../docker-compose/gocd.yml"
if ! type docker-compose &>/dev/null; then if ! type docker-compose &>/dev/null; then
"$srcdir/setup/install_docker_compose.sh" "$srcdir/../setup/install_docker_compose.sh"
fi fi
action="${1:-up}" action="${1:-up}"

@ -28,7 +28,7 @@ setup/ci_git_set_dir_safe.sh
if [ -n "$*" ]; then if [ -n "$*" ]; then
echo "$@" echo "$@"
else else
sed 's/#.*//; s/:/ /' "$srcdir/setup/repos.txt" sed 's/#.*//; s/:/ /' "$srcdir/../setup/repos.txt"
fi | fi |
grep -v -e bash-tools -e '^[[:space:]]*$' | grep -v -e bash-tools -e '^[[:space:]]*$' |
while read -r repo dir; do while read -r repo dir; do

@ -19,7 +19,7 @@ srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$srcdir" cd "$srcdir"
sed 's/#.*//; s/:/ /' "$srcdir/setup/repos.txt" | sed 's/#.*//; s/:/ /' "$srcdir/../setup/repos.txt" |
grep -vi -e bash-tools \ grep -vi -e bash-tools \
-e template \ -e template \
-e jenkins \ -e jenkins \
@ -47,7 +47,7 @@ while read -r repo dir; do
echo "$filename" echo "$filename"
done done
else else
sed 's/#.*//; /^[[:space:]]*$/d' "$srcdir/setup/ci.txt" sed 's/#.*//; /^[[:space:]]*$/d' "$srcdir/../setup/ci.txt"
fi | fi |
while read -r filename; do while read -r filename; do
target="../$dir/$filename" target="../$dir/$filename"

@ -22,7 +22,7 @@ cd "$srcdir"
if [ -n "$*" ]; then if [ -n "$*" ]; then
echo "$@" echo "$@"
else else
sed 's/#.*//; s/:/ /' "$srcdir/setup/repos.txt" sed 's/#.*//; s/:/ /' "$srcdir/../setup/repos.txt"
fi | fi |
grep -vi -e bash-tools \ grep -vi -e bash-tools \
-e playlist \ -e playlist \
@ -36,7 +36,7 @@ while read -r repo dir; do
echo "WARNING: repo dir $dir not found, skipping..." echo "WARNING: repo dir $dir not found, skipping..."
continue continue
fi fi
sed 's/#.*//; /^[[:space:]]*$/d' "$srcdir/setup/repo-configs.txt" | sed 's/#.*//; /^[[:space:]]*$/d' "$srcdir/../setup/repo-configs.txt" |
while read -r filename; do while read -r filename; do
target="../$dir/$filename" target="../$dir/$filename"
if [ -f "$target" ] || [ -n "${NEW:-}" ]; then if [ -f "$target" ] || [ -n "${NEW:-}" ]; then

@ -32,7 +32,7 @@ usage(){
} }
if ! type -P circleci &>/dev/null; then if ! type -P circleci &>/dev/null; then
"$srcdir/setup/install_circleci.sh" "$srcdir/../setup/install_circleci.sh"
fi fi
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

@ -67,7 +67,7 @@ not_blank "$projects" || die "ERROR: no project specified and GCloud SDK core.pr
export PATH="$PATH:"~/bin export PATH="$PATH:"~/bin
if ! type -P cloud_sql_proxy &>/dev/null; then if ! type -P cloud_sql_proxy &>/dev/null; then
"$srcdir/setup/install_cloud_sql_proxy.sh" "$srcdir/../setup/install_cloud_sql_proxy.sh"
fi fi
mkdir -p -v "$SOCKDIR" mkdir -p -v "$SOCKDIR"

@ -41,5 +41,5 @@ if [ $# -gt 0 ]; then
run "$x" run "$x"
done done
else else
run "$srcdir/setup/repos.txt" run "$srcdir/../setup/repos.txt"
fi fi

@ -71,7 +71,7 @@ if [ -z "${NO_TEST:-}" ]; then
opts="$opts test" opts="$opts test"
fi fi
repofile="$srcdir/setup/repos.txt" repofile="$srcdir/../setup/repos.txt"
repolist="${REPOS:-}" repolist="${REPOS:-}"
if [ -n "$repolist" ]; then if [ -n "$repolist" ]; then

@ -67,7 +67,7 @@ fi
if [ -n "${REPOS:-}" ]; then if [ -n "${REPOS:-}" ]; then
tr '[:space:]' '\n' <<< "$REPOS" tr '[:space:]' '\n' <<< "$REPOS"
elif [ -n "${srcdir:-}" ]; then elif [ -n "${srcdir:-}" ]; then
sed 's/#.*//; s/:/ /; /^[[:space:]]*$/d' < "$srcdir/setup/repos.txt" sed 's/#.*//; s/:/ /; /^[[:space:]]*$/d' < "$srcdir/../setup/repos.txt"
else else
echo "\$REPOS not set and \$srcdir not set/available, possibly due to 'curl ... | bash' usage, cannot determine list of repos to pull and build" >&2 echo "\$REPOS not set and \$srcdir not set/available, possibly due to 'curl ... | bash' usage, cannot determine list of repos to pull and build" >&2
exit 1 exit 1

@ -18,7 +18,7 @@ set -euo pipefail
[ -n "${DEBUG:-}" ] && set -x [ -n "${DEBUG:-}" ] && set -x
srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
repofile="$srcdir/setup/repos.txt" repofile="$srcdir/../setup/repos.txt"
if [ -f "$repofile" ]; then if [ -f "$repofile" ]; then
echo "processing repos from local file: $repofile" >&2 echo "processing repos from local file: $repofile" >&2

@ -34,7 +34,7 @@ mkdir -pv "$git_base_dir"
cd "$git_base_dir" cd "$git_base_dir"
sed 's/#.*//; s/:/ /; /^[[:space:]]*$/d' "$srcdir/setup/repos.txt" | sed 's/#.*//; s/:/ /; /^[[:space:]]*$/d' "$srcdir/../setup/repos.txt" |
while read -r repo dir; do while read -r repo dir; do
if [ -z "$dir" ]; then if [ -z "$dir" ]; then
dir="$repo" dir="$repo"

@ -27,7 +27,7 @@ mkdir -pv "$git_base_dir"
cd "$git_base_dir" cd "$git_base_dir"
sed 's/#.*//; s/:/ /; /^[[:digit:]]*$/d' "$srcdir/setup/repos.txt" | sed 's/#.*//; s/:/ /; /^[[:digit:]]*$/d' "$srcdir/../setup/repos.txt" |
while read -r repo dir; do while read -r repo dir; do
if [ -z "$dir" ]; then if [ -z "$dir" ]; then
dir="$repo" dir="$repo"

@ -38,4 +38,4 @@ help_usage "$@"
#min_args 1 "$@" #min_args 1 "$@"
# this script is standalone without lib dependency so can be called directly from bootstrapped CI before submodules, since that is the exact problem that needs to be solved to allow CI/CD systems with incorrect ownership of the checkout directory to be able to checkout the necessary git submodules # this script is standalone without lib dependency so can be called directly from bootstrapped CI before submodules, since that is the exact problem that needs to be solved to allow CI/CD systems with incorrect ownership of the checkout directory to be able to checkout the necessary git submodules
"$srcdir/setup/ci_git_set_dir_safe.sh" "${1:-.}" "$srcdir/../setup/ci_git_set_dir_safe.sh" "${1:-.}"

@ -25,7 +25,7 @@ mkdir -pv "$git_base_dir"
cd "$git_base_dir" cd "$git_base_dir"
repofile="$srcdir/setup/repos.txt" repofile="$srcdir/../setup/repos.txt"
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
repolist="$*" repolist="$*"

@ -60,7 +60,7 @@ else
usage usage
fi fi
#sed 's/#.*//; s/:/ /; /^[[:space:]]*$/d' "$srcdir/setup/repos.txt" | #sed 's/#.*//; s/:/ /; /^[[:space:]]*$/d' "$srcdir/../setup/repos.txt" |
echo "DevOps-Golang-tools go-tools" | echo "DevOps-Golang-tools go-tools" |
while read -r repo dir; do while read -r repo dir; do
if [ -z "$dir" ]; then if [ -z "$dir" ]; then

@ -72,10 +72,10 @@ Jenkinsfile=Jenkinsfile
export COMPOSE_PROJECT_NAME="bash-tools" export COMPOSE_PROJECT_NAME="bash-tools"
export COMPOSE_FILE="$srcdir/../docker-compose/jenkins.yml" export COMPOSE_FILE="$srcdir/../docker-compose/jenkins.yml"
plugins_txt="$srcdir/setup/jenkins-plugins.txt" plugins_txt="$srcdir/../setup/jenkins-plugins.txt"
if ! type docker-compose &>/dev/null; then if ! type docker-compose &>/dev/null; then
"$srcdir/setup/install_docker_compose.sh" "$srcdir/../setup/install_docker_compose.sh"
fi fi
action="${1:-up}" action="${1:-up}"

@ -46,8 +46,8 @@ help_usage "$@"
min_args 1 "$@" min_args 1 "$@"
type -P helm &>/dev/null || "$srcdir/setup/install_helm.sh" type -P helm &>/dev/null || "$srcdir/../setup/install_helm.sh"
type -P yq &>/dev/null || "$srcdir/setup/install_yq.sh" type -P yq &>/dev/null || "$srcdir/../setup/install_yq.sh"
# if there are no repositories to show will return exit code 1 so || : # if there are no repositories to show will return exit code 1 so || :
helm_repos="$(helm repo list -o yaml | yq -r '.[] | [.name, .url] | @tsv' || :)" helm_repos="$(helm repo list -o yaml | yq -r '.[] | [.name, .url] | @tsv' || :)"

@ -53,7 +53,7 @@ help_usage "$@"
min_args 1 "$@" min_args 1 "$@"
type -P yq &>/dev/null || "$srcdir/setup/install_yq.sh" type -P yq &>/dev/null || "$srcdir/../setup/install_yq.sh"
yq '.helmCharts[] | [.repo, .name, .version, .valuesFile] | @tsv' "$@" --no-doc --no-colors | yq '.helmCharts[] | [.repo, .name, .version, .valuesFile] | @tsv' "$@" --no-doc --no-colors |
sed '/^[[:space:]]*$/d' | sed '/^[[:space:]]*$/d' |

@ -36,10 +36,10 @@ help_usage "$@"
export COMPOSE_PROJECT_NAME="bash-tools" export COMPOSE_PROJECT_NAME="bash-tools"
export COMPOSE_FILE="$srcdir/../docker-compose/prometheus.yml" export COMPOSE_FILE="$srcdir/../docker-compose/prometheus.yml"
export PROMETHEUS_URL="http://localhost:9090" export PROMETHEUS_URL="http://localhost:9090"
export PROMETHEUS_CONFIG="${2:-$srcdir/setup/prometheus.yml}" export PROMETHEUS_CONFIG="${2:-$srcdir/../setup/prometheus.yml}"
if ! type docker-compose &>/dev/null; then if ! type docker-compose &>/dev/null; then
"$srcdir/setup/install_docker_compose.sh" "$srcdir/../setup/install_docker_compose.sh"
fi fi
action="${1:-up}" action="${1:-up}"

@ -160,7 +160,7 @@ if ! docker_container_exists "$container_name"; then
-e MYSQL_ROOT_PASSWORD="$password" \ -e MYSQL_ROOT_PASSWORD="$password" \
$docker_sql_mount_switches \ $docker_sql_mount_switches \
"$docker_image":"$version" "$docker_image":"$version"
#-v "$srcdir/setup/mysql/conf.d/my.cnf:/etc/mysql/conf.d/" \ #-v "$srcdir/../setup/mysql/conf.d/my.cnf:/etc/mysql/conf.d/" \
fi fi
wait_for_mysql_ready "$container_name" wait_for_mysql_ready "$container_name"

@ -160,7 +160,7 @@ if ! docker_container_exists "$container_name"; then
-e MYSQL_ROOT_PASSWORD="$password" \ -e MYSQL_ROOT_PASSWORD="$password" \
$docker_sql_mount_switches \ $docker_sql_mount_switches \
"$docker_image":"$version" "$docker_image":"$version"
#-v "$srcdir/setup/mysql/conf.d/my.cnf:/etc/mysql/conf.d/" \ #-v "$srcdir/../setup/mysql/conf.d/my.cnf:/etc/mysql/conf.d/" \
fi fi

@ -47,7 +47,7 @@ HOMEBREW_PACKAGES_TAP="${TAP:-}"
process_package_args "$@" | process_package_args "$@" |
if [ -n "${HOMEBREW_PACKAGES_TAP:-}" ]; then if [ -n "${HOMEBREW_PACKAGES_TAP:-}" ]; then
while read -r tap package; do while read -r tap package; do
grep -Eq "^${tap}[[:space:]]+$package$" <(sed 's/#.*//; /^[[:digit:]]*$/d' "$srcdir/setup/"brew-packages*taps.txt) && grep -Eq "^${tap}[[:space:]]+$package$" <(sed 's/#.*//; /^[[:digit:]]*$/d' "$srcdir/../setup/"brew-packages*taps.txt) &&
echo "$tap $package" echo "$tap $package"
done done
else else
@ -55,6 +55,6 @@ else
# shellcheck disable=SC2046 # shellcheck disable=SC2046
tr ' ' '\n' | tr ' ' '\n' |
# Mac's grep is buggy, doesn't matches utimer unless sort -r to try it before '^r$' - but then gives false positives on other packages # Mac's grep is buggy, doesn't matches utimer unless sort -r to try it before '^r$' - but then gives false positives on other packages
#grep -Fx -f <(sed 's/#.*//; s/^[[:space:]]*//; s/[[:space:]]*$//; /^[[:space:]]*$/d' "$srcdir/setup/"brew-packages*.txt | sort -ur) #grep -Fx -f <(sed 's/#.*//; s/^[[:space:]]*//; s/[[:space:]]*$//; /^[[:space:]]*$/d' "$srcdir/../setup/"brew-packages*.txt | sort -ur)
command ggrep -Fx -f <(sed 's/#.*//; s/^[[:space:]]*//; s/[[:space:]]*$//; /^[[:space:]]*$/d' "$srcdir/setup/"brew-packages*.txt) command ggrep -Fx -f <(sed 's/#.*//; s/^[[:space:]]*//; s/[[:space:]]*$//; /^[[:space:]]*$/d' "$srcdir/../setup/"brew-packages*.txt)
fi fi

@ -47,7 +47,7 @@ HOMEBREW_PACKAGES_TAP="${TAP:-}"
process_package_args "$@" | process_package_args "$@" |
if [ -n "${HOMEBREW_PACKAGES_TAP:-}" ]; then if [ -n "${HOMEBREW_PACKAGES_TAP:-}" ]; then
while read -r tap package; do while read -r tap package; do
grep -Eq "^#?${tap}[[:space:]]+$package$" <(sed 's/#.*//; /^[[:digit:]]*$/d' "$srcdir/setup/"brew-packages*taps.txt) || grep -Eq "^#?${tap}[[:space:]]+$package$" <(sed 's/#.*//; /^[[:digit:]]*$/d' "$srcdir/../setup/"brew-packages*taps.txt) ||
echo "$tap $package" echo "$tap $package"
done done
else else
@ -55,10 +55,10 @@ else
# shellcheck disable=SC2046 # shellcheck disable=SC2046
tr ' ' '\n' | tr ' ' '\n' |
# Mac's grep is buggy, doesn't matches utimer unless sort -r to try it before '^r$' - but then gives false positives on other packages # Mac's grep is buggy, doesn't matches utimer unless sort -r to try it before '^r$' - but then gives false positives on other packages
#grep -vFx -f <(sed 's/#.*//; s/^[[:space:]]*//; s/[[:space:]]*$//; /^[[:space:]]*$/d' "$srcdir/setup/"brew-packages*.txt | sort) #grep -vFx -f <(sed 's/#.*//; s/^[[:space:]]*//; s/[[:space:]]*$//; /^[[:space:]]*$/d' "$srcdir/../setup/"brew-packages*.txt | sort)
command ggrep -vFx -f <(sed 's/#.*//; s/^[[:space:]]*//; s/[[:space:]]*$//; /^[[:space:]]*$/d' "$srcdir/setup/"brew-packages*.txt) | command ggrep -vFx -f <(sed 's/#.*//; s/^[[:space:]]*//; s/[[:space:]]*$//; /^[[:space:]]*$/d' "$srcdir/../setup/"brew-packages*.txt) |
while read -r package; do while read -r package; do
grep -Eqi "^#${package}([[:space:]]|$)" "$srcdir/setup/"brew-packages*.txt || echo "$package" grep -Eqi "^#${package}([[:space:]]|$)" "$srcdir/../setup/"brew-packages*.txt || echo "$package"
done | done |
sort -u sort -u
fi fi

@ -156,13 +156,13 @@ if ! docker_container_exists "$container_name"; then
--name "$container_name" \ --name "$container_name" \
$docker_opts \ $docker_opts \
-e POSTGRES_PASSWORD="$password" \ -e POSTGRES_PASSWORD="$password" \
-v "$srcdir/setup/postgresql.conf:/etc/postgresql/postgresql.conf" \ -v "$srcdir/../setup/postgresql.conf:/etc/postgresql/postgresql.conf" \
$docker_sql_mount_switches \ $docker_sql_mount_switches \
"$docker_image":"$version" \ "$docker_image":"$version" \
$(if [ "${version:0:1}" = 8 ] || [ "${version:0:3}" = '9.0' ]; then echo postgres; fi) \ $(if [ "${version:0:1}" = 8 ] || [ "${version:0:3}" = '9.0' ]; then echo postgres; fi) \
-c 'config_file=/etc/postgresql/postgresql.conf' -c 'config_file=/etc/postgresql/postgresql.conf'
# can't mount postgresql.conf here because it prevents /var/lib/postgresql/data from being initialized # can't mount postgresql.conf here because it prevents /var/lib/postgresql/data from being initialized
#-v "$srcdir/setup/postgresql.conf:/var/lib/postgresql/data/postgresql.conf" #-v "$srcdir/../setup/postgresql.conf:/var/lib/postgresql/data/postgresql.conf"
fi fi
wait_for_postgres_ready "$container_name" wait_for_postgres_ready "$container_name"

@ -19,7 +19,7 @@ set -euo pipefail
[ -n "${DEBUG:-}" ] && set -x [ -n "${DEBUG:-}" ] && set -x
srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
conf_files="$(sed 's/#.*//; /^[[:space:]]*$/d' "$srcdir/setup/files.txt")" conf_files="$(sed 's/#.*//; /^[[:space:]]*$/d' "$srcdir/../setup/files.txt")"
setup_file(){ setup_file(){
local filename="$1" local filename="$1"
@ -68,7 +68,7 @@ for filename in $conf_files; do
ln -sv $opts -- "$PWD/$filename" ~ || continue ln -sv $opts -- "$PWD/$filename" ~ || continue
# if we link .vimrc then run the vundle install and get plugins to prevent vim errors every startup # if we link .vimrc then run the vundle install and get plugins to prevent vim errors every startup
if [ "$filename" = .vimrc ]; then if [ "$filename" = .vimrc ]; then
"$srcdir/setup/install_vundle.sh" || : "$srcdir/../setup/install_vundle.sh" || :
fi fi
fi fi
done done

@ -19,7 +19,7 @@ set -euo pipefail
[ -n "${DEBUG:-}" ] && set -x [ -n "${DEBUG:-}" ] && set -x
srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
conf_files="$(sed 's/#.*//; /^[[:space:]]*$/d' "$srcdir/setup/files.txt")" conf_files="$(sed 's/#.*//; /^[[:space:]]*$/d' "$srcdir/../setup/files.txt")"
# unreliable that HOME is set, ensure shell evaluates to the right thing before we use it # unreliable that HOME is set, ensure shell evaluates to the right thing before we use it
[ -n "${HOME:-}" ] || HOME=~ [ -n "${HOME:-}" ] || HOME=~

@ -114,7 +114,7 @@ project="GitHub"
export TEAMCITY_URL="http://${DOCKER_HOST:-localhost}:8111" export TEAMCITY_URL="http://${DOCKER_HOST:-localhost}:8111"
if ! type docker-compose &>/dev/null; then if ! type docker-compose &>/dev/null; then
"$srcdir/setup/install_docker_compose.sh" "$srcdir/../setup/install_docker_compose.sh"
fi fi
action="${1:-up}" action="${1:-up}"

Loading…
Cancel
Save