Skip to content

Commit

Permalink
Review changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kportertx committed Nov 3, 2023
1 parent e835d14 commit 76585fd
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 49 deletions.
7 changes: 3 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ function do_bake_group() {
echo "${output}"
}


function get_product_tags() {
local product=$1
local distro=$2
Expand Down Expand Up @@ -317,9 +316,9 @@ function build_images() {
created="$(date --rfc-3339=seconds)"

verbose_call docker buildx bake --pull --progress plain ${params} \
--set "\*.labels.org.opencontainers.image.revision=\"${revision}\"" \
--set "\*.labels.org.opencontainers.image.created=\"${created}\"" \
--file "${bake_file}" "${target}"
--set "\*.labels.org.opencontainers.image.revision=\"${revision}\"" \
--set "\*.labels.org.opencontainers.image.created=\"${created}\"" \
--file "${bake_file}" "${target}"
}

function main() {
Expand Down
88 changes: 44 additions & 44 deletions data/template/0/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,70 +14,70 @@ export NSUP_PERIOD=${NSUP_PERIOD:-120}
export STORAGE_GB=${STORAGE_GB:-4}

if [ "${DATA_IN_MEMORY}" = "true" ]; then
export READ_PAGE_CACHE="false"
export READ_PAGE_CACHE="false"
else
export READ_PAGE_CACHE="true"
export READ_PAGE_CACHE="true"
fi

if asd --version | grep -q "Community"; then
FEATURE_KEY_FILE="" # invalid for community edition
FEATURE_KEY_FILE="" # invalid for community edition
fi

function bash_eval_template() {
local template_file=$1
local target_file=$2

echo "" >"${target_file}"

while IFS= read -r line; do
if grep -qE "[$][(]|[{]" <<<"${line}"; then
local update
update=$(eval echo "\"${line}\"") || exit 1
grep -qE "[^[:space:]]*" <<<"${update}" && echo "${update}" >>"${target_file}"
else
echo "${line}" >>"${target_file}"
fi
done <"${template_file}"

# Ignore failure when template is mounted in a read-only filesystem.
rm "${template_file}" || true
local template_file=$1
local target_file=$2

echo "" >"${target_file}"

while IFS= read -r line; do
if grep -qE "[$][(]|[{]" <<<"${line}"; then
local update
update=$(eval echo "\"${line}\"") || exit 1
grep -qE "[^[:space:]]*" <<<"${update}" && echo "${update}" >>"${target_file}"
else
echo "${line}" >>"${target_file}"
fi
done <"${template_file}"

# Ignore failure when template is mounted in a read-only filesystem.
rm "${template_file}" || true
}

# Fill out conffile with above values
if [ -f /etc/aerospike/aerospike.template.conf ]; then
conf=/etc/aerospike/aerospike.conf
template=/etc/aerospike/aerospike.template.conf
conf=/etc/aerospike/aerospike.conf
template=/etc/aerospike/aerospike.template.conf

bash_eval_template "${template}" "${conf}"
bash_eval_template "${template}" "${conf}"
fi

# if command starts with an option, prepend asd
if [ "${1:0:1}" = '-' ]; then
set -- asd "$@"
set -- asd "$@"
fi

# if asd is specified for the command, start it with any given options
if [ "$1" = 'asd' ]; then
NETLINK=${NETLINK:-eth0}

# We will wait a bit for the network link to be up.
NETLINK_UP=0
NETLINK_COUNT=0

echo "link ${NETLINK} state $(cat /sys/class/net/"${NETLINK}"/operstate)"

while [ ${NETLINK_UP} -eq 0 ] && [ ${NETLINK_COUNT} -lt 20 ]; do
if grep -q "up" /sys/class/net/"${NETLINK}"/operstate; then
NETLINK_UP=1
else
sleep 0.1
((++NETLINK_COUNT))
fi
done

echo "link ${NETLINK} state $(cat /sys/class/net/"${NETLINK}"/operstate) in ${NETLINK_COUNT}"
# asd should always run in the foreground.
set -- "$@" --foreground
NETLINK=${NETLINK:-eth0}

# We will wait a bit for the network link to be up.
NETLINK_UP=0
NETLINK_COUNT=0

echo "link ${NETLINK} state $(cat /sys/class/net/"${NETLINK}"/operstate)"

while [ ${NETLINK_UP} -eq 0 ] && [ ${NETLINK_COUNT} -lt 20 ]; do
if grep -q "up" /sys/class/net/"${NETLINK}"/operstate; then
NETLINK_UP=1
else
sleep 0.1
((++NETLINK_COUNT))
fi
done

echo "link ${NETLINK} state $(cat /sys/class/net/"${NETLINK}"/operstate) in ${NETLINK_COUNT}"
# asd should always run in the foreground.
set -- "$@" --foreground
fi

exec "$@"
2 changes: 1 addition & 1 deletion lib/support.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function support_source_config() {
local edition=$2

local version=
version="$(basename ${version_path})"
version="$(basename "${version_path}")"
local config_dir="${g_data_config_dir}/${version}"

# shellcheck source=data/config/6.4/config.sh
Expand Down

0 comments on commit 76585fd

Please sign in to comment.