Skip to content

Commit 3228e45

Browse files
sbalousekDjelibeybi
authored andcommitted
Oracle GoldenGate
- Reformat shell scripts through `shfmt -w -i 4` Signed-off-by: Stephen Balousek <[email protected]>
1 parent bb4cce0 commit 3228e45

File tree

5 files changed

+56
-56
lines changed

5 files changed

+56
-56
lines changed

OracleGoldenGate/23/bin/create-certificate.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -e
1111
function create_certificate() {
1212
local config
1313
config="$(mktemp)"
14-
cat<<EOF > "${config}"
14+
cat <<EOF >"${config}"
1515
[req]
1616
distinguished_name = distinguished_name
1717
x509_extensions = x509_extensions
@@ -24,10 +24,10 @@ CN = GoldenGate Deployment
2424
extendedKeyUsage = serverAuth
2525
EOF
2626
mkdir -p "$(dirname "${NGINX_CRT}")"
27-
openssl req -x509 -sha256 \
28-
-newkey rsa:2048 -nodes -keyout "${NGINX_KEY}" \
29-
-days $((365 * 3)) -out "${NGINX_CRT}" \
30-
-config "${config}"
27+
openssl req -x509 -sha256 \
28+
-newkey rsa:2048 -nodes -keyout "${NGINX_KEY}" \
29+
-days $((365 * 3)) -out "${NGINX_CRT}" \
30+
-config "${config}"
3131
rm "${config}"
3232
}
3333

OracleGoldenGate/23/bin/deployment-main.sh

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ function abort() {
1414
exit 1
1515
}
1616

17-
: "${OGG_DEPLOYMENT:=Local}"
18-
: "${OGG_ADMIN:=oggadmin}"
19-
: "${OGG_LISTEN_ON:=127.0.0.1}"
17+
: "${OGG_DEPLOYMENT:=Local}"
18+
: "${OGG_ADMIN:=oggadmin}"
19+
: "${OGG_LISTEN_ON:=127.0.0.1}"
2020

21-
: "${OGG_DEPLOYMENT_HOME:?}"
21+
: "${OGG_DEPLOYMENT_HOME:?}"
2222
[[ -d "${OGG_DEPLOYMENT_HOME}" ]] || abort "Deployment storage, '${OGG_DEPLOYMENT_HOME}', not found."
23-
: "${OGG_TEMPORARY_FILES:?}"
23+
: "${OGG_TEMPORARY_FILES:?}"
2424
[[ -d "${OGG_TEMPORARY_FILES}" ]] || abort "Deployment temporary storage, '${OGG_TEMPORARY_FILES}', not found."
25-
: "${OGG_HOME:?}"
26-
[[ -d "${OGG_HOME}" ]] || abort "Deployment runtime, '${OGG_HOME}'. not found."
25+
: "${OGG_HOME:?}"
26+
[[ -d "${OGG_HOME}" ]] || abort "Deployment runtime, '${OGG_HOME}'. not found."
2727

28-
: "${OGG_DEPLOYMENT_SCRIPTS:?}"
28+
: "${OGG_DEPLOYMENT_SCRIPTS:?}"
2929
[[ -d "${OGG_DEPLOYMENT_SCRIPTS}" ]] || abort "OGG deployment scripts storage, '${OGG_DEPLOYMENT_SCRIPTS}', not found."
3030

31-
NGINX_CRT="$(awk '$1 == "ssl_certificate" { gsub(/;/, ""); print $NF; exit }' < /etc/nginx/nginx.conf)"
32-
NGINX_KEY="$(awk '$1 == "ssl_certificate_key" { gsub(/;/, ""); print $NF; exit }' < /etc/nginx/nginx.conf)"
31+
NGINX_CRT="$(awk '$1 == "ssl_certificate" { gsub(/;/, ""); print $NF; exit }' </etc/nginx/nginx.conf)"
32+
NGINX_KEY="$(awk '$1 == "ssl_certificate_key" { gsub(/;/, ""); print $NF; exit }' </etc/nginx/nginx.conf)"
3333

3434
export OGG_DEPLOYMENT OGG_ADMIN NGINX_CRT NGINX_KEY
3535

@@ -40,14 +40,14 @@ export OGG_DEPLOYMENT OGG_ADMIN NGINX_CRT NGINX_KEY
4040
## - at least one digit character
4141
##
4242
function generatePassword {
43-
if [[ -n "${OGG_ADMIN_PWD}" || -d "${OGG_DEPLOYMENT_HOME}/Deployment/etc" ]]; then
43+
if [[ -n "${OGG_ADMIN_PWD}" || -d "${OGG_DEPLOYMENT_HOME}/Deployment/etc" ]]; then
4444
return
4545
fi
4646
local password
4747
password="$(openssl rand -base64 9)-$(openssl rand -base64 3)"
48-
if [[ "${password}" != "${password/[A-Z]/_}" && \
49-
"${password}" != "${password/[a-z]/_}" && \
50-
"${password}" != "${password/[0-9]/_}" ]]; then
48+
if [[ "${password}" != "${password/[A-Z]/_}" &&
49+
"${password}" != "${password/[a-z]/_}" &&
50+
"${password}" != "${password/[0-9]/_}" ]]; then
5151
export OGG_ADMIN_PWD="${password}"
5252
echo "----------------------------------------------------------------------------------"
5353
echo "-- Password for OGG administrative user '${OGG_ADMIN}' is '${OGG_ADMIN_PWD}'"
@@ -83,7 +83,7 @@ function locate_lib_jvm() {
8383
echo "Warning: The shared library libjvm.so cannot be located."
8484
else
8585
local JVM_LIBRARY_PATH
86-
JVM_LIBRARY_PATH="$(dirname "${libjvm}" )"
86+
JVM_LIBRARY_PATH="$(dirname "${libjvm}")"
8787
export LD_LIBRARY_PATH=$JVM_LIBRARY_PATH:$LD_LIBRARY_PATH
8888
fi
8989
}
@@ -103,35 +103,35 @@ function run_as_ogg() {
103103
## Create and set permissions for directories for the deployment
104104
##
105105
function setup_deployment_directories() {
106-
rm -fr "${OGG_DEPLOYMENT_HOME}"/Deployment/var/{run,temp,lib/db} \
107-
"${OGG_TEMPORARY_FILES}"/{run,temp}
108-
mkdir -p "${OGG_TEMPORARY_FILES}"/{run,temp,db} \
109-
"${OGG_DEPLOYMENT_HOME}"/Deployment/var/lib
110-
ln -s "${OGG_TEMPORARY_FILES}"/run "${OGG_DEPLOYMENT_HOME}"/Deployment/var/run
111-
ln -s "${OGG_TEMPORARY_FILES}"/temp "${OGG_DEPLOYMENT_HOME}"/Deployment/var/temp
112-
ln -s "${OGG_TEMPORARY_FILES}"/db "${OGG_DEPLOYMENT_HOME}"/Deployment/var/lib/db
113-
114-
chown ogg:ogg "${OGG_DEPLOYMENT_HOME}" "${OGG_TEMPORARY_FILES}"
115-
chmod 0750 "${OGG_DEPLOYMENT_HOME}" "${OGG_TEMPORARY_FILES}"
116-
find "${OGG_DEPLOYMENT_HOME}" "${OGG_TEMPORARY_FILES}" -mindepth 1 -maxdepth 1 -not -name '.*' -exec \
117-
chown -R ogg:ogg {} \;
106+
rm -fr "${OGG_DEPLOYMENT_HOME}"/Deployment/var/{run,temp,lib/db} \
107+
"${OGG_TEMPORARY_FILES}"/{run,temp}
108+
mkdir -p "${OGG_TEMPORARY_FILES}"/{run,temp,db} \
109+
"${OGG_DEPLOYMENT_HOME}"/Deployment/var/lib
110+
ln -s "${OGG_TEMPORARY_FILES}"/run "${OGG_DEPLOYMENT_HOME}"/Deployment/var/run
111+
ln -s "${OGG_TEMPORARY_FILES}"/temp "${OGG_DEPLOYMENT_HOME}"/Deployment/var/temp
112+
ln -s "${OGG_TEMPORARY_FILES}"/db "${OGG_DEPLOYMENT_HOME}"/Deployment/var/lib/db
113+
114+
chown ogg:ogg "${OGG_DEPLOYMENT_HOME}" "${OGG_TEMPORARY_FILES}"
115+
chmod 0750 "${OGG_DEPLOYMENT_HOME}" "${OGG_TEMPORARY_FILES}"
116+
find "${OGG_DEPLOYMENT_HOME}" "${OGG_TEMPORARY_FILES}" -mindepth 1 -maxdepth 1 -not -name '.*' -exec \
117+
chown -R ogg:ogg {} \;
118118
}
119119

120120
##
121121
## Run custom scripts in the container before and after GoldenGate starts
122122
##
123123
function run_user_scripts {
124-
local scripts="${1}";
124+
local scripts="${1}"
125125
while read -r script; do
126126
case "${script}" in
127-
*.sh)
128-
echo "Running script '${script}'"
129-
# shellcheck disable=SC1090
130-
source "${script}"
131-
;;
132-
*)
133-
echo "Ignoring '${script}'"
134-
;;
127+
*.sh)
128+
echo "Running script '${script}'"
129+
# shellcheck disable=SC1090
130+
source "${script}"
131+
;;
132+
*)
133+
echo "Ignoring '${script}'"
134+
;;
135135
esac
136136
done < <(find "${scripts}" -type f | sort)
137137
}
@@ -162,8 +162,8 @@ function start_nginx() {
162162
##
163163
function termination_handler() {
164164
[[ -z "${ogg_pid}" ]] || {
165-
kill "${ogg_pid}"
166-
unset ogg_pid
165+
kill "${ogg_pid}"
166+
unset ogg_pid
167167
}
168168
[[ ! -f "/var/run/nginx.pid" ]] || {
169169
/usr/sbin/nginx -s stop
@@ -175,7 +175,7 @@ function termination_handler() {
175175
## Signal Handling for this script
176176
##
177177
function signal_handling() {
178-
trap - SIGTERM SIGINT
178+
trap - SIGTERM SIGINT
179179
trap termination_handler SIGTERM SIGINT
180180
}
181181

OracleGoldenGate/23/bin/healthcheck

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
##
77

88
declare -A Ports=([nginx]=443
9-
[ServiceManager]=9011
10-
[adminsrvr]=9012
11-
[distsrvr]=9013
12-
[recvsrvr]=9014
13-
[pmsrvr]=9015)
9+
[ServiceManager]=9011
10+
[adminsrvr]=9012
11+
[distsrvr]=9013
12+
[recvsrvr]=9014
13+
[pmsrvr]=9015)
1414

1515
function service_healthy() {
1616
local serviceName="${1}" health healthy

OracleGoldenGate/23/install-deployment.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ function run_as_ogg() {
3535
## Unpack the OGG installation software
3636
##
3737
function ogg_installer_setup() {
38-
[[ -f "${INSTALLER}" ]] || abort "Source file '${INSTALLER}' does not exist"
38+
[[ -f "${INSTALLER}" ]] || abort "Source file '${INSTALLER}' does not exist"
3939
mkdir "/tmp/installer"
4040
unzip -q "${INSTALLER}" -d "/tmp/installer" || abort "Unzip operation failed for '${INSTALLER}'"
41-
chmod -R o=g-w "/tmp/installer"
41+
chmod -R o=g-w "/tmp/installer"
4242
}
4343

4444
##
@@ -60,11 +60,11 @@ function ogg_install_option() {
6060
## Perform an OGG installation
6161
##
6262
function ogg_install() {
63-
mkdir -p "${OGG_HOME}"
63+
mkdir -p "${OGG_HOME}"
6464
chown -R ogg:ogg "$(dirname "${OGG_HOME}")"
6565
installer="$(find /tmp/installer -name runInstaller | head -1)"
6666
if [[ -n "${installer}" ]]; then
67-
cat<<EOF >"/tmp/installer.rsp"
67+
cat <<EOF >"/tmp/installer.rsp"
6868
oracle.install.responseFileVersion=/oracle/install/rspfmt_ogginstall_response_schema_v20_0_0
6969
INSTALL_OPTION=${INSTALL_OPTION:-$(ogg_install_option)}
7070
SOFTWARE_LOCATION=${OGG_HOME}

OracleGoldenGate/23/install-prerequisites.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -e
77
##
88

99
packages=(java-17-openjdk jq libaio libnsl nginx perl python39 python39-requests python39-psutil tar unzip xz)
10-
packages+=(unixODBC libpq) ## Required for PostgreSQL
10+
packages+=(unixODBC libpq) ## Required for PostgreSQL
1111

1212
function success() {
1313
echo "Packages installed after ${sequence} attempts"
@@ -19,7 +19,7 @@ function success() {
1919
## Attempt the module and package installation up to three times
2020
## in case there are network issues that cause failures.
2121
for sequence in $(seq 3); do
22-
dnf -y module enable nginx:1.22 python39 && \
23-
dnf -y install "${packages[@]}" && success "${sequence}"
22+
dnf -y module enable nginx:1.22 python39 &&
23+
dnf -y install "${packages[@]}" && success "${sequence}"
2424
done
2525
exit 1

0 commit comments

Comments
 (0)