@@ -10,12 +10,13 @@ replace_signaling_url() {
10
10
echo " Replacing signaling URL in $HTTPD_CONF ..."
11
11
12
12
sed -i " s|$SIGNALING_URL |$OPENMINA_SIGNALING_URL |g" " $HTTPD_CONF "
13
-
14
- if [[ $? -ne 0 ]]; then
13
+ sed_exit_code= $?
14
+ if [[ $sed_exit_code -ne 0 ]]; then
15
15
echo " Failed to replace the signaling URL, exiting."
16
16
exit 1
17
17
else
18
- echo " Successfully replaced signaling URL with '$OPENMINA_SIGNALING_URL ' in $HTTPD_CONF "
18
+ echo " Successfully replaced signaling URL with" \
19
+ " '$OPENMINA_SIGNALING_URL ' in $HTTPD_CONF "
19
20
fi
20
21
else
21
22
echo " OPENMINA_SIGNALING_URL is not set. No replacement performed."
@@ -63,8 +64,11 @@ download_circuit_files() {
63
64
echo " $FILE already exists in $DOWNLOAD_DIR , skipping download."
64
65
else
65
66
echo " Downloading $FILE to $DOWNLOAD_DIR ..."
66
- curl -s -L --retry 3 --retry-delay 5 -o " $DOWNLOAD_DIR /$FILE " " $CIRCUITS_BASE_URL /$CIRCUITS_VERSION /$FILE "
67
- if [[ $? -ne 0 ]]; then
67
+ curl -s -L --retry 3 --retry-delay 5 \
68
+ -o " $DOWNLOAD_DIR /$FILE " \
69
+ " $CIRCUITS_BASE_URL /$CIRCUITS_VERSION /$FILE "
70
+ curl_exit_code=$?
71
+ if [[ $curl_exit_code -ne 0 ]]; then
68
72
echo " Failed to download $FILE after 3 attempts, exiting."
69
73
exit 1
70
74
else
@@ -80,24 +84,28 @@ download_wasm_files() {
80
84
exit 1
81
85
fi
82
86
83
- WASM_URL=" $OPENMINA_BASE_URL /openmina/releases/download/$OPENMINA_WASM_VERSION /openmina-$OPENMINA_WASM_VERSION -webnode-wasm.tar.gz"
87
+ WASM_URL=" $OPENMINA_BASE_URL /openmina/releases/download/\
88
+ $OPENMINA_WASM_VERSION /openmina-$OPENMINA_WASM_VERSION -webnode-wasm.tar.gz"
84
89
TARGET_DIR=" /usr/local/apache2/htdocs/assets/webnode/pkg"
85
90
86
91
mkdir -p " $TARGET_DIR "
87
92
88
93
echo " Downloading WASM files from $WASM_URL ..."
89
- curl -s -L --retry 3 --retry-delay 5 -o " /tmp/openmina-$OPENMINA_WASM_VERSION -webnode-wasm.tar.gz" " $WASM_URL "
90
-
91
- if [[ $? -ne 0 ]]; then
94
+ curl -s -L --retry 3 --retry-delay 5 \
95
+ -o " /tmp/openmina-$OPENMINA_WASM_VERSION -webnode-wasm.tar.gz" \
96
+ " $WASM_URL "
97
+ curl_exit_code=$?
98
+ if [[ $curl_exit_code -ne 0 ]]; then
92
99
echo " Failed to download the WASM file after 3 attempts, exiting."
93
100
exit 1
94
101
else
95
102
echo " WASM file downloaded successfully. Extracting to $TARGET_DIR ..."
96
103
97
- tar -xzf " /tmp/openmina-$OPENMINA_WASM_VERSION -webnode-wasm.tar.gz" -C " $TARGET_DIR "
98
-
99
104
# Check if the extraction was successful
100
- if [[ $? -ne 0 ]]; then
105
+ tar -xzf " /tmp/openmina-$OPENMINA_WASM_VERSION -webnode-wasm.tar.gz" \
106
+ -C " $TARGET_DIR "
107
+ tar_exit_code=$?
108
+ if [[ $tar_exit_code -ne 0 ]]; then
101
109
echo " Failed to extract the WASM file, exiting."
102
110
exit 1
103
111
else
0 commit comments