@@ -117,21 +117,24 @@ stdenv.mkDerivation {
117
117
NIX_PROFILE="/var/lib/postgresql/.nix-profile"
118
118
119
119
# Follow the complete chain of symlinks to find the multi-version directory
120
- CURRENT_LINK="$NIX_PROFILE/lib/pg_cron-$VERSION.so "
120
+ CURRENT_LINK="$NIX_PROFILE/lib/pg_cron-$VERSION${ postgresql . dlSuffix } "
121
121
echo "Starting with link: $CURRENT_LINK"
122
122
123
- while [ -L "$CURRENT_LINK" ]; do
124
- NEXT_LINK=$(readlink "$CURRENT_LINK")
125
- echo "Following link: $NEXT_LINK"
126
- if echo "$NEXT_LINK" | grep -q '^/'; then
127
- CURRENT_LINK="$NEXT_LINK"
128
- else
129
- CURRENT_LINK="$(dirname "$CURRENT_LINK")/$NEXT_LINK"
123
+ # Follow first two symlinks to get to the multi-version directory
124
+ for i in 1 2; do
125
+ if [ -L "$CURRENT_LINK" ]; then
126
+ NEXT_LINK=$(readlink "$CURRENT_LINK")
127
+ echo "Following link: $NEXT_LINK"
128
+ if echo "$NEXT_LINK" | grep -q '^/'; then
129
+ CURRENT_LINK="$NEXT_LINK"
130
+ else
131
+ CURRENT_LINK="$(dirname "$CURRENT_LINK")/$NEXT_LINK"
132
+ fi
133
+ echo "Current link is now: $CURRENT_LINK"
130
134
fi
131
- echo "Current link is now: $CURRENT_LINK"
132
135
done
133
136
134
- # The final link should be in the multi-version directory
137
+ # The multi-version directory should be the parent of the current link
135
138
MULTI_VERSION_DIR=$(dirname "$CURRENT_LINK")
136
139
echo "Found multi-version directory: $MULTI_VERSION_DIR"
137
140
LIB_DIR="$MULTI_VERSION_DIR"
0 commit comments