Skip to content

Commit 27500c7

Browse files
authored
fix: nix-specific wrappers fix fix (#1112)
1 parent 5dcba64 commit 27500c7

File tree

1 file changed

+13
-11
lines changed
  • ansible/files/admin_api_scripts/pg_upgrade_scripts

1 file changed

+13
-11
lines changed

ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,18 +186,20 @@ function patch_wrappers {
186186
# - new version: wrappers-0.1.18.so
187187
# - workaround to make pg_upgrade happy: copy wrappers-0.1.18.so to wrappers-0.1.16.so
188188
if [ "$IS_NIX_UPGRADE" = "true" ]; then
189-
OLD_WRAPPER_LIB_PATH=$(find "$PGLIBOLD" -name "wrappers*so" -print -quit)
190-
OLD_LIB_FILE_NAME=$(basename "$OLD_WRAPPER_LIB_PATH")
191-
192-
find /nix/store/ -name "wrappers*so" -print0 | while read -r -d $'\0' WRAPPERS_LIB_PATH; do
193-
if [ -f "$WRAPPERS_LIB_PATH" ]; then
194-
WRAPPERS_LIB_PATH_DIR=$(dirname "$WRAPPERS_LIB_PATH")
195-
if [ "$WRAPPERS_LIB_PATH" != "$WRAPPERS_LIB_PATH_DIR/${OLD_LIB_FILE_NAME}" ]; then
196-
echo "Copying $WRAPPERS_LIB_PATH to $WRAPPERS_LIB_PATH_DIR/${OLD_LIB_FILE_NAME}"
197-
cp "$WRAPPERS_LIB_PATH" "$WRAPPERS_LIB_PATH_DIR/${OLD_LIB_FILE_NAME}"
189+
if [ -d "$PGLIBOLD" ]; then
190+
OLD_WRAPPER_LIB_PATH=$(find "$PGLIBOLD" -name "wrappers*so" -print -quit)
191+
OLD_LIB_FILE_NAME=$(basename "$OLD_WRAPPER_LIB_PATH")
192+
193+
find /nix/store/ -name "wrappers*so" -print0 | while read -r -d $'\0' WRAPPERS_LIB_PATH; do
194+
if [ -f "$WRAPPERS_LIB_PATH" ]; then
195+
WRAPPERS_LIB_PATH_DIR=$(dirname "$WRAPPERS_LIB_PATH")
196+
if [ "$WRAPPERS_LIB_PATH" != "$WRAPPERS_LIB_PATH_DIR/${OLD_LIB_FILE_NAME}" ]; then
197+
echo "Copying $WRAPPERS_LIB_PATH to $WRAPPERS_LIB_PATH_DIR/${OLD_LIB_FILE_NAME}"
198+
cp "$WRAPPERS_LIB_PATH" "$WRAPPERS_LIB_PATH_DIR/${OLD_LIB_FILE_NAME}"
199+
fi
198200
fi
199-
fi
200-
done
201+
done
202+
fi
201203
else
202204
if [ -d "$PGLIBOLD" ]; then
203205
WRAPPERS_LIB_PATH=$(find "$PGLIBNEW" -name "wrappers*so" -print -quit)

0 commit comments

Comments
 (0)