Skip to content

Commit 5bfba4c

Browse files
committed
refactor: use pushd/popd instead of cd
1 parent b943457 commit 5bfba4c

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

scripts/build/build_libpq.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
109109
https://github.com/openssl/openssl/archive/${openssl_tag}.tar.gz \
110110
| tar xzf -
111111

112-
cd "${openssl_dir}"
112+
pushd "${openssl_dir}"
113113

114114
options=(--prefix=${LIBPQ_BUILD_PREFIX} --openssldir=${LIBPQ_BUILD_PREFIX} \
115115
zlib -fPIC shared)
@@ -122,12 +122,12 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
122122
make depend
123123
make
124124
else
125-
cd "${openssl_dir}"
125+
pushd "${openssl_dir}"
126126
fi
127127

128128
# Install openssl
129129
make install_sw
130-
cd ..
130+
popd
131131

132132
fi
133133

@@ -140,15 +140,15 @@ if [ "$ID" == "macos" ]; then
140140
curl -sL "https://kerberos.org/dist/krb5/${krb5_version%.*}/krb5-${krb5_version}.tar.gz" \
141141
| tar xzf -
142142

143-
cd "${krb5_dir}"
143+
pushd "${krb5_dir}"
144144
./configure "${make_configure_standard_flags[@]}"
145145
make
146146
else
147-
cd "${krb5_dir}"
147+
pushd "${krb5_dir}"
148148
fi
149149

150150
make install
151-
cd ../..
151+
popd
152152

153153
fi
154154

@@ -161,15 +161,15 @@ if [ "$ID" == "macos" ]; then
161161
curl -sL "https://ftp.gnu.org/pub/gnu/gettext/gettext-${gettext_version}.tar.gz" \
162162
| tar xzf -
163163

164-
cd "${gettext_dir}"
164+
pushd "${gettext_dir}"
165165
./configure --disable-java "${make_configure_standard_flags[@]}"
166166
make -C gettext-runtime all
167167
else
168-
cd "${gettext_dir}"
168+
pushd "${gettext_dir}"
169169
fi
170170

171171
make -C gettext-runtime install
172-
cd ..
172+
popd
173173

174174
fi
175175

@@ -187,20 +187,20 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
187187
https://github.com/cyrusimap/cyrus-sasl/archive/${sasl_tag}.tar.gz \
188188
| tar xzf -
189189

190-
cd "${sasl_dir}"
190+
pushd "${sasl_dir}"
191191

192192
autoreconf -i
193193
./configure "${make_configure_standard_flags[@]}" --disable-macos-framework
194194
make
195195
else
196-
cd "${sasl_dir}"
196+
pushd "${sasl_dir}"
197197
fi
198198

199199
# Install libsasl2
200200
# requires missing nroff to build
201201
touch saslauthd/saslauthd.8
202202
make install
203-
cd ..
203+
popd
204204

205205
fi
206206

@@ -215,7 +215,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
215215
https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-${ldap_tag}.tgz \
216216
| tar xzf -
217217

218-
cd "${ldap_dir}"
218+
pushd "${ldap_dir}"
219219

220220
./configure "${make_configure_standard_flags[@]}" --enable-backends=no --enable-null
221221

@@ -224,15 +224,15 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
224224
make -C libraries/liblber/
225225
make -C libraries/libldap/
226226
else
227-
cd "${ldap_dir}"
227+
pushd "${ldap_dir}"
228228
fi
229229

230230
# Install openldap
231231
make -C libraries/liblber/ install
232232
make -C libraries/libldap/ install
233233
make -C include/ install
234234
chmod +x ${LIBPQ_BUILD_PREFIX}/lib/{libldap,liblber}*.${library_suffix}*
235-
cd ..
235+
popd
236236

237237
fi
238238

@@ -245,7 +245,7 @@ if [ ! -d "${postgres_dir}" ]; then
245245
https://github.com/postgres/postgres/archive/${postgres_tag}.tar.gz \
246246
| tar xzf -
247247

248-
cd "${postgres_dir}"
248+
pushd "${postgres_dir}"
249249

250250
if [ "$ID" != "macos" ]; then
251251
# Match the default unix socket dir default with what defined on Ubuntu and
@@ -265,13 +265,13 @@ if [ ! -d "${postgres_dir}" ]; then
265265
make -C src/bin/pg_config
266266
make -C src/include
267267
else
268-
cd "${postgres_dir}"
268+
pushd "${postgres_dir}"
269269
fi
270270

271271
# Install libpq
272272
make -C src/interfaces/libpq install
273273
make -C src/bin/pg_config install
274274
make -C src/include install
275-
cd ..
275+
popd
276276

277277
find ${LIBPQ_BUILD_PREFIX} -name \*.${library_suffix}.\* -type f -exec strip --strip-unneeded {} \;

0 commit comments

Comments
 (0)