Skip to content

Commit

Permalink
Fixed duplicate Include parameters for agent and agent2 images
Browse files Browse the repository at this point in the history
  • Loading branch information
dotneft committed Dec 25, 2024
1 parent e8dc2fe commit f30fdce
Show file tree
Hide file tree
Showing 29 changed files with 175 additions and 73 deletions.
16 changes: 11 additions & 5 deletions Dockerfiles/agent/alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,20 @@ update_config_var() {
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
fi

# Remove configuration parameter definition in case of unset parameter value
# Remove configuration parameter definition in case of unset or empty parameter value
if [ -z "$var_value" ]; then
sed -i -e "/^$var_name=/d" "$config_path"
echo "removed"
return
fi

# Remove value from configuration parameter in case of double quoted parameter value
if [ "$var_value" == '""' ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
# Remove value from configuration parameter in case of set to double quoted parameter value
if [[ "$var_value" == '""' ]]; then
if [ "$(grep -E "^$var_name=" $config_path)" ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
else
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path"
fi
echo "undefined"
return
fi
Expand All @@ -78,7 +82,9 @@ update_config_var() {
var_value=$(escape_spec_char "$var_value")
var_name=$(escape_spec_char "$var_name")

if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
if [ "$(grep -E "^$var_name=$var_value" $config_path)" ]; then
echo "exists"
elif [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
echo "updated"
elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then
Expand Down
16 changes: 11 additions & 5 deletions Dockerfiles/agent/centos/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,20 @@ update_config_var() {
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
fi

# Remove configuration parameter definition in case of unset parameter value
# Remove configuration parameter definition in case of unset or empty parameter value
if [ -z "$var_value" ]; then
sed -i -e "/^$var_name=/d" "$config_path"
echo "removed"
return
fi

# Remove value from configuration parameter in case of double quoted parameter value
if [ "$var_value" == '""' ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
# Remove value from configuration parameter in case of set to double quoted parameter value
if [[ "$var_value" == '""' ]]; then
if [ "$(grep -E "^$var_name=" $config_path)" ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
else
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path"
fi
echo "undefined"
return
fi
Expand All @@ -78,7 +82,9 @@ update_config_var() {
var_value=$(escape_spec_char "$var_value")
var_name=$(escape_spec_char "$var_name")

if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
if [ "$(grep -E "^$var_name=$var_value" $config_path)" ]; then
echo "exists"
elif [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
echo "updated"
elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then
Expand Down
16 changes: 11 additions & 5 deletions Dockerfiles/agent/ol/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,20 @@ update_config_var() {
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
fi

# Remove configuration parameter definition in case of unset parameter value
# Remove configuration parameter definition in case of unset or empty parameter value
if [ -z "$var_value" ]; then
sed -i -e "/^$var_name=/d" "$config_path"
echo "removed"
return
fi

# Remove value from configuration parameter in case of double quoted parameter value
if [ "$var_value" == '""' ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
# Remove value from configuration parameter in case of set to double quoted parameter value
if [[ "$var_value" == '""' ]]; then
if [ "$(grep -E "^$var_name=" $config_path)" ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
else
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path"
fi
echo "undefined"
return
fi
Expand All @@ -78,7 +82,9 @@ update_config_var() {
var_value=$(escape_spec_char "$var_value")
var_name=$(escape_spec_char "$var_name")

if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
if [ "$(grep -E "^$var_name=$var_value" $config_path)" ]; then
echo "exists"
elif [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
echo "updated"
elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then
Expand Down
16 changes: 11 additions & 5 deletions Dockerfiles/agent/rhel/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,20 @@ update_config_var() {
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
fi

# Remove configuration parameter definition in case of unset parameter value
# Remove configuration parameter definition in case of unset or empty parameter value
if [ -z "$var_value" ]; then
sed -i -e "/^$var_name=/d" "$config_path"
echo "removed"
return
fi

# Remove value from configuration parameter in case of double quoted parameter value
if [ "$var_value" == '""' ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
# Remove value from configuration parameter in case of set to double quoted parameter value
if [[ "$var_value" == '""' ]]; then
if [ "$(grep -E "^$var_name=" $config_path)" ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
else
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path"
fi
echo "undefined"
return
fi
Expand All @@ -78,7 +82,9 @@ update_config_var() {
var_value=$(escape_spec_char "$var_value")
var_name=$(escape_spec_char "$var_name")

if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
if [ "$(grep -E "^$var_name=$var_value" $config_path)" ]; then
echo "exists"
elif [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
echo "updated"
elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then
Expand Down
16 changes: 11 additions & 5 deletions Dockerfiles/agent/ubuntu/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,20 @@ update_config_var() {
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
fi

# Remove configuration parameter definition in case of unset parameter value
# Remove configuration parameter definition in case of unset or empty parameter value
if [ -z "$var_value" ]; then
sed -i -e "/^$var_name=/d" "$config_path"
echo "removed"
return
fi

# Remove value from configuration parameter in case of double quoted parameter value
if [ "$var_value" == '""' ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
# Remove value from configuration parameter in case of set to double quoted parameter value
if [[ "$var_value" == '""' ]]; then
if [ "$(grep -E "^$var_name=" $config_path)" ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
else
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path"
fi
echo "undefined"
return
fi
Expand All @@ -78,7 +82,9 @@ update_config_var() {
var_value=$(escape_spec_char "$var_value")
var_name=$(escape_spec_char "$var_name")

if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
if [ "$(grep -E "^$var_name=$var_value" $config_path)" ]; then
echo "exists"
elif [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
echo "updated"
elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then
Expand Down
16 changes: 11 additions & 5 deletions Dockerfiles/agent2/alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,20 @@ update_config_var() {
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
fi

# Remove configuration parameter definition in case of unset parameter value
# Remove configuration parameter definition in case of unset or empty parameter value
if [ -z "$var_value" ]; then
sed -i -e "/^$var_name=/d" "$config_path"
echo "removed"
return
fi

# Remove value from configuration parameter in case of double quoted parameter value
if [ "$var_value" == '""' ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
# Remove value from configuration parameter in case of set to double quoted parameter value
if [[ "$var_value" == '""' ]]; then
if [ "$(grep -E "^$var_name=" $config_path)" ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
else
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path"
fi
echo "undefined"
return
fi
Expand All @@ -78,7 +82,9 @@ update_config_var() {
var_value=$(escape_spec_char "$var_value")
var_name=$(escape_spec_char "$var_name")

if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
if [ "$(grep -E "^$var_name=$var_value" $config_path)" ]; then
echo "exists"
elif [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
echo "updated"
elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then
Expand Down
16 changes: 11 additions & 5 deletions Dockerfiles/agent2/centos/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,20 @@ update_config_var() {
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
fi

# Remove configuration parameter definition in case of unset parameter value
# Remove configuration parameter definition in case of unset or empty parameter value
if [ -z "$var_value" ]; then
sed -i -e "/^$var_name=/d" "$config_path"
echo "removed"
return
fi

# Remove value from configuration parameter in case of double quoted parameter value
if [ "$var_value" == '""' ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
# Remove value from configuration parameter in case of set to double quoted parameter value
if [[ "$var_value" == '""' ]]; then
if [ "$(grep -E "^$var_name=" $config_path)" ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
else
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path"
fi
echo "undefined"
return
fi
Expand All @@ -78,7 +82,9 @@ update_config_var() {
var_value=$(escape_spec_char "$var_value")
var_name=$(escape_spec_char "$var_name")

if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
if [ "$(grep -E "^$var_name=$var_value" $config_path)" ]; then
echo "exists"
elif [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
echo "updated"
elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then
Expand Down
16 changes: 11 additions & 5 deletions Dockerfiles/agent2/ol/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,20 @@ update_config_var() {
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
fi

# Remove configuration parameter definition in case of unset parameter value
# Remove configuration parameter definition in case of unset or empty parameter value
if [ -z "$var_value" ]; then
sed -i -e "/^$var_name=/d" "$config_path"
echo "removed"
return
fi

# Remove value from configuration parameter in case of double quoted parameter value
if [ "$var_value" == '""' ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
# Remove value from configuration parameter in case of set to double quoted parameter value
if [[ "$var_value" == '""' ]]; then
if [ "$(grep -E "^$var_name=" $config_path)" ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
else
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path"
fi
echo "undefined"
return
fi
Expand All @@ -78,7 +82,9 @@ update_config_var() {
var_value=$(escape_spec_char "$var_value")
var_name=$(escape_spec_char "$var_name")

if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
if [ "$(grep -E "^$var_name=$var_value" $config_path)" ]; then
echo "exists"
elif [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
echo "updated"
elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then
Expand Down
16 changes: 11 additions & 5 deletions Dockerfiles/agent2/rhel/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,20 @@ update_config_var() {
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
fi

# Remove configuration parameter definition in case of unset parameter value
# Remove configuration parameter definition in case of unset or empty parameter value
if [ -z "$var_value" ]; then
sed -i -e "/^$var_name=/d" "$config_path"
echo "removed"
return
fi

# Remove value from configuration parameter in case of double quoted parameter value
if [ "$var_value" == '""' ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
# Remove value from configuration parameter in case of set to double quoted parameter value
if [[ "$var_value" == '""' ]]; then
if [ "$(grep -E "^$var_name=" $config_path)" ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
else
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path"
fi
echo "undefined"
return
fi
Expand All @@ -78,7 +82,9 @@ update_config_var() {
var_value=$(escape_spec_char "$var_value")
var_name=$(escape_spec_char "$var_name")

if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
if [ "$(grep -E "^$var_name=$var_value" $config_path)" ]; then
echo "exists"
elif [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
echo "updated"
elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then
Expand Down
16 changes: 11 additions & 5 deletions Dockerfiles/agent2/ubuntu/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,20 @@ update_config_var() {
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
fi

# Remove configuration parameter definition in case of unset parameter value
# Remove configuration parameter definition in case of unset or empty parameter value
if [ -z "$var_value" ]; then
sed -i -e "/^$var_name=/d" "$config_path"
echo "removed"
return
fi

# Remove value from configuration parameter in case of double quoted parameter value
if [ "$var_value" == '""' ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
# Remove value from configuration parameter in case of set to double quoted parameter value
if [[ "$var_value" == '""' ]]; then
if [ "$(grep -E "^$var_name=" $config_path)" ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
else
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path"
fi
echo "undefined"
return
fi
Expand All @@ -78,7 +82,9 @@ update_config_var() {
var_value=$(escape_spec_char "$var_value")
var_name=$(escape_spec_char "$var_name")

if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
if [ "$(grep -E "^$var_name=$var_value" $config_path)" ]; then
echo "exists"
elif [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
echo "updated"
elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then
Expand Down
4 changes: 3 additions & 1 deletion Dockerfiles/proxy-mysql/alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ update_config_var() {
var_value=$(escape_spec_char "$var_value")
var_name=$(escape_spec_char "$var_name")

if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
if [ "$(grep -E "^$var_name=$var_value" $config_path)" ]; then
echo "exists"
elif [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
echo "updated"
elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then
Expand Down
4 changes: 3 additions & 1 deletion Dockerfiles/proxy-mysql/centos/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ update_config_var() {
var_value=$(escape_spec_char "$var_value")
var_name=$(escape_spec_char "$var_name")

if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
if [ "$(grep -E "^$var_name=$var_value" $config_path)" ]; then
echo "exists"
elif [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
echo "updated"
elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then
Expand Down
4 changes: 3 additions & 1 deletion Dockerfiles/proxy-mysql/ol/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ update_config_var() {
var_value=$(escape_spec_char "$var_value")
var_name=$(escape_spec_char "$var_name")

if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
if [ "$(grep -E "^$var_name=$var_value" $config_path)" ]; then
echo "exists"
elif [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
echo "updated"
elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then
Expand Down
Loading

0 comments on commit f30fdce

Please sign in to comment.