diff options
author | Andrei Pavel <andrei@isc.org> | 2024-02-20 23:56:10 +0100 |
---|---|---|
committer | Andrei Pavel <andrei@isc.org> | 2024-02-22 09:06:33 +0100 |
commit | ee3c643346a4732709a754f34237d77b08548c6d (patch) | |
tree | a300014e3383d125b52c9322d9a46b7a2a1520aa | |
parent | [#3025] address review comments (diff) | |
download | kea-ee3c643346a4732709a754f34237d77b08548c6d.tar.xz kea-ee3c643346a4732709a754f34237d77b08548c6d.zip |
[#3025] use admin-utils.sh based on location in upgrade scripts
58 files changed, 406 insertions, 290 deletions
diff --git a/src/share/database/scripts/mysql/upgrade_001.0_to_002.0.sh.in b/src/share/database/scripts/mysql/upgrade_001.0_to_002.0.sh.in index 35fede46d0..a34fbd10ad 100644 --- a/src/share/database/scripts/mysql/upgrade_001.0_to_002.0.sh.in +++ b/src/share/database/scripts/mysql/upgrade_001.0_to_002.0.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_002.0_to_003.0.sh.in b/src/share/database/scripts/mysql/upgrade_002.0_to_003.0.sh.in index c51401be53..1524100c07 100644 --- a/src/share/database/scripts/mysql/upgrade_002.0_to_003.0.sh.in +++ b/src/share/database/scripts/mysql/upgrade_002.0_to_003.0.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_003.0_to_004.0.sh.in b/src/share/database/scripts/mysql/upgrade_003.0_to_004.0.sh.in index 786c77c1fa..f2d9d87b0e 100644 --- a/src/share/database/scripts/mysql/upgrade_003.0_to_004.0.sh.in +++ b/src/share/database/scripts/mysql/upgrade_003.0_to_004.0.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_004.0_to_004.1.sh.in b/src/share/database/scripts/mysql/upgrade_004.0_to_004.1.sh.in index 8c2f84e01f..4dfca82f17 100644 --- a/src/share/database/scripts/mysql/upgrade_004.0_to_004.1.sh.in +++ b/src/share/database/scripts/mysql/upgrade_004.0_to_004.1.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_004.1_to_005.0.sh.in b/src/share/database/scripts/mysql/upgrade_004.1_to_005.0.sh.in index 58b5e08008..aa51b9798e 100644 --- a/src/share/database/scripts/mysql/upgrade_004.1_to_005.0.sh.in +++ b/src/share/database/scripts/mysql/upgrade_004.1_to_005.0.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_005.0_to_005.1.sh.in b/src/share/database/scripts/mysql/upgrade_005.0_to_005.1.sh.in index 1f1f217004..be0d520591 100644 --- a/src/share/database/scripts/mysql/upgrade_005.0_to_005.1.sh.in +++ b/src/share/database/scripts/mysql/upgrade_005.0_to_005.1.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_005.1_to_005.2.sh.in b/src/share/database/scripts/mysql/upgrade_005.1_to_005.2.sh.in index c238ceb83e..b9bcc4fb3a 100644 --- a/src/share/database/scripts/mysql/upgrade_005.1_to_005.2.sh.in +++ b/src/share/database/scripts/mysql/upgrade_005.1_to_005.2.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_005.2_to_006.0.sh.in b/src/share/database/scripts/mysql/upgrade_005.2_to_006.0.sh.in index c02cbc0d22..552091e0ba 100644 --- a/src/share/database/scripts/mysql/upgrade_005.2_to_006.0.sh.in +++ b/src/share/database/scripts/mysql/upgrade_005.2_to_006.0.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_006.0_to_007.0.sh.in b/src/share/database/scripts/mysql/upgrade_006.0_to_007.0.sh.in index 9c7530be57..d0ddbbfa14 100644 --- a/src/share/database/scripts/mysql/upgrade_006.0_to_007.0.sh.in +++ b/src/share/database/scripts/mysql/upgrade_006.0_to_007.0.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_007.0_to_008.0.sh.in b/src/share/database/scripts/mysql/upgrade_007.0_to_008.0.sh.in index 5092837c6d..a640b7dd2b 100644 --- a/src/share/database/scripts/mysql/upgrade_007.0_to_008.0.sh.in +++ b/src/share/database/scripts/mysql/upgrade_007.0_to_008.0.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_008.0_to_008.1.sh.in b/src/share/database/scripts/mysql/upgrade_008.0_to_008.1.sh.in index a885e22417..db7323cd49 100644 --- a/src/share/database/scripts/mysql/upgrade_008.0_to_008.1.sh.in +++ b/src/share/database/scripts/mysql/upgrade_008.0_to_008.1.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_008.1_to_008.2.sh.in b/src/share/database/scripts/mysql/upgrade_008.1_to_008.2.sh.in index ceabf10b75..3aca6ad156 100644 --- a/src/share/database/scripts/mysql/upgrade_008.1_to_008.2.sh.in +++ b/src/share/database/scripts/mysql/upgrade_008.1_to_008.2.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_008.2_to_009.0.sh.in b/src/share/database/scripts/mysql/upgrade_008.2_to_009.0.sh.in index 0439dab2ca..c0032f7a26 100644 --- a/src/share/database/scripts/mysql/upgrade_008.2_to_009.0.sh.in +++ b/src/share/database/scripts/mysql/upgrade_008.2_to_009.0.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_009.0_to_009.1.sh.in b/src/share/database/scripts/mysql/upgrade_009.0_to_009.1.sh.in index 0404d1c754..036a945a72 100644 --- a/src/share/database/scripts/mysql/upgrade_009.0_to_009.1.sh.in +++ b/src/share/database/scripts/mysql/upgrade_009.0_to_009.1.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_009.1_to_009.2.sh.in b/src/share/database/scripts/mysql/upgrade_009.1_to_009.2.sh.in index a8e7ec81d1..40247a1f99 100644 --- a/src/share/database/scripts/mysql/upgrade_009.1_to_009.2.sh.in +++ b/src/share/database/scripts/mysql/upgrade_009.1_to_009.2.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_009.2_to_009.3.sh.in b/src/share/database/scripts/mysql/upgrade_009.2_to_009.3.sh.in index e27a037291..7bdefe22d1 100644 --- a/src/share/database/scripts/mysql/upgrade_009.2_to_009.3.sh.in +++ b/src/share/database/scripts/mysql/upgrade_009.2_to_009.3.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_009.3_to_009.4.sh.in b/src/share/database/scripts/mysql/upgrade_009.3_to_009.4.sh.in index 1df9aac2ce..bed6be0f29 100644 --- a/src/share/database/scripts/mysql/upgrade_009.3_to_009.4.sh.in +++ b/src/share/database/scripts/mysql/upgrade_009.3_to_009.4.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_009.4_to_009.5.sh.in b/src/share/database/scripts/mysql/upgrade_009.4_to_009.5.sh.in index 1621a5f9e5..0521cfcedf 100644 --- a/src/share/database/scripts/mysql/upgrade_009.4_to_009.5.sh.in +++ b/src/share/database/scripts/mysql/upgrade_009.4_to_009.5.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(mysql_version "$@") diff --git a/src/share/database/scripts/mysql/upgrade_009.5_to_009.6.sh.in b/src/share/database/scripts/mysql/upgrade_009.5_to_009.6.sh.in index 3179751c77..d0eff1a19f 100644 --- a/src/share/database/scripts/mysql/upgrade_009.5_to_009.6.sh.in +++ b/src/share/database/scripts/mysql/upgrade_009.5_to_009.6.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi # Check version. diff --git a/src/share/database/scripts/mysql/upgrade_009.6_to_010.0.sh.in b/src/share/database/scripts/mysql/upgrade_009.6_to_010.0.sh.in index c95cc8e278..18a845819a 100644 --- a/src/share/database/scripts/mysql/upgrade_009.6_to_010.0.sh.in +++ b/src/share/database/scripts/mysql/upgrade_009.6_to_010.0.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi # Check version. diff --git a/src/share/database/scripts/mysql/upgrade_010_to_011.sh.in b/src/share/database/scripts/mysql/upgrade_010_to_011.sh.in index 298822f98f..cfda986b32 100644 --- a/src/share/database/scripts/mysql/upgrade_010_to_011.sh.in +++ b/src/share/database/scripts/mysql/upgrade_010_to_011.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi # Check version. diff --git a/src/share/database/scripts/mysql/upgrade_011_to_012.sh.in b/src/share/database/scripts/mysql/upgrade_011_to_012.sh.in index e2efb1b4b7..34e39e9654 100644 --- a/src/share/database/scripts/mysql/upgrade_011_to_012.sh.in +++ b/src/share/database/scripts/mysql/upgrade_011_to_012.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi # Check version. diff --git a/src/share/database/scripts/mysql/upgrade_012_to_013.sh.in b/src/share/database/scripts/mysql/upgrade_012_to_013.sh.in index 21b376bb02..8b714986b0 100644 --- a/src/share/database/scripts/mysql/upgrade_012_to_013.sh.in +++ b/src/share/database/scripts/mysql/upgrade_012_to_013.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi # Check version. diff --git a/src/share/database/scripts/mysql/upgrade_013_to_014.sh.in b/src/share/database/scripts/mysql/upgrade_013_to_014.sh.in index 01ed768a3e..6f89c0bb2f 100644 --- a/src/share/database/scripts/mysql/upgrade_013_to_014.sh.in +++ b/src/share/database/scripts/mysql/upgrade_013_to_014.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi # Check version. diff --git a/src/share/database/scripts/mysql/upgrade_014_to_015.sh.in b/src/share/database/scripts/mysql/upgrade_014_to_015.sh.in index b667c818d9..627a2538c7 100644 --- a/src/share/database/scripts/mysql/upgrade_014_to_015.sh.in +++ b/src/share/database/scripts/mysql/upgrade_014_to_015.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi # Check version. diff --git a/src/share/database/scripts/mysql/upgrade_015_to_016.sh.in b/src/share/database/scripts/mysql/upgrade_015_to_016.sh.in index aebd1759a1..2bcf15c619 100644 --- a/src/share/database/scripts/mysql/upgrade_015_to_016.sh.in +++ b/src/share/database/scripts/mysql/upgrade_015_to_016.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi # Check version. diff --git a/src/share/database/scripts/mysql/upgrade_016_to_017.sh.in b/src/share/database/scripts/mysql/upgrade_016_to_017.sh.in index 0869c03325..69c6573743 100644 --- a/src/share/database/scripts/mysql/upgrade_016_to_017.sh.in +++ b/src/share/database/scripts/mysql/upgrade_016_to_017.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi # Check version. diff --git a/src/share/database/scripts/mysql/upgrade_017_to_018.sh.in b/src/share/database/scripts/mysql/upgrade_017_to_018.sh.in index d971ff3d88..721d35d570 100644 --- a/src/share/database/scripts/mysql/upgrade_017_to_018.sh.in +++ b/src/share/database/scripts/mysql/upgrade_017_to_018.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi # Check version. diff --git a/src/share/database/scripts/mysql/upgrade_018_to_019.sh.in b/src/share/database/scripts/mysql/upgrade_018_to_019.sh.in index 21eb784afc..902cf9261a 100644 --- a/src/share/database/scripts/mysql/upgrade_018_to_019.sh.in +++ b/src/share/database/scripts/mysql/upgrade_018_to_019.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi # Check version. diff --git a/src/share/database/scripts/mysql/upgrade_019_to_020.sh.in b/src/share/database/scripts/mysql/upgrade_019_to_020.sh.in index 64bc6233e4..5dd22477d2 100644 --- a/src/share/database/scripts/mysql/upgrade_019_to_020.sh.in +++ b/src/share/database/scripts/mysql/upgrade_019_to_020.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi # Check version. diff --git a/src/share/database/scripts/mysql/upgrade_020_to_021.sh.in b/src/share/database/scripts/mysql/upgrade_020_to_021.sh.in index ff948ba37e..125a50ab1b 100644 --- a/src/share/database/scripts/mysql/upgrade_020_to_021.sh.in +++ b/src/share/database/scripts/mysql/upgrade_020_to_021.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi # Check version. diff --git a/src/share/database/scripts/mysql/wipe_data.sh.in b/src/share/database/scripts/mysql/wipe_data.sh.in index ff726b7bdc..d460452960 100644 --- a/src/share/database/scripts/mysql/wipe_data.sh.in +++ b/src/share/database/scripts/mysql/wipe_data.sh.in @@ -20,14 +20,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/mysql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi # First argument must be the expected schema version <major>.<minor> diff --git a/src/share/database/scripts/pgsql/upgrade_001.0_to_002.0.sh.in b/src/share/database/scripts/pgsql/upgrade_001.0_to_002.0.sh.in index a8f4c49d48..6246307754 100644 --- a/src/share/database/scripts/pgsql/upgrade_001.0_to_002.0.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_001.0_to_002.0.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_002.0_to_003.0.sh.in b/src/share/database/scripts/pgsql/upgrade_002.0_to_003.0.sh.in index 93f8ccb1c4..faafbf07b6 100644 --- a/src/share/database/scripts/pgsql/upgrade_002.0_to_003.0.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_002.0_to_003.0.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_003.0_to_003.1.sh.in b/src/share/database/scripts/pgsql/upgrade_003.0_to_003.1.sh.in index b249b52bd2..d21c945b8a 100644 --- a/src/share/database/scripts/pgsql/upgrade_003.0_to_003.1.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_003.0_to_003.1.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_003.1_to_003.2.sh.in b/src/share/database/scripts/pgsql/upgrade_003.1_to_003.2.sh.in index bc2489f178..ee398afc89 100644 --- a/src/share/database/scripts/pgsql/upgrade_003.1_to_003.2.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_003.1_to_003.2.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_003.2_to_003.3.sh.in b/src/share/database/scripts/pgsql/upgrade_003.2_to_003.3.sh.in index fe182767f2..d582df42c4 100644 --- a/src/share/database/scripts/pgsql/upgrade_003.2_to_003.3.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_003.2_to_003.3.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_003.3_to_004.0.sh.in b/src/share/database/scripts/pgsql/upgrade_003.3_to_004.0.sh.in index d17dd0619a..0e18498433 100644 --- a/src/share/database/scripts/pgsql/upgrade_003.3_to_004.0.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_003.3_to_004.0.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_004.0_to_005.0.sh.in b/src/share/database/scripts/pgsql/upgrade_004.0_to_005.0.sh.in index 78b9175a27..48ae9ec538 100644 --- a/src/share/database/scripts/pgsql/upgrade_004.0_to_005.0.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_004.0_to_005.0.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_005.0_to_005.1.sh.in b/src/share/database/scripts/pgsql/upgrade_005.0_to_005.1.sh.in index 2767f0eb2e..2721ae562b 100644 --- a/src/share/database/scripts/pgsql/upgrade_005.0_to_005.1.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_005.0_to_005.1.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_005.1_to_006.0.sh.in b/src/share/database/scripts/pgsql/upgrade_005.1_to_006.0.sh.in index d1b2faa010..0382347ce6 100644 --- a/src/share/database/scripts/pgsql/upgrade_005.1_to_006.0.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_005.1_to_006.0.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_006.0_to_006.1.sh.in b/src/share/database/scripts/pgsql/upgrade_006.0_to_006.1.sh.in index 7c1e1f69e1..3a940ad341 100644 --- a/src/share/database/scripts/pgsql/upgrade_006.0_to_006.1.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_006.0_to_006.1.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_006.1_to_006.2.sh.in b/src/share/database/scripts/pgsql/upgrade_006.1_to_006.2.sh.in index 0b36dadf90..c006dc3dfe 100644 --- a/src/share/database/scripts/pgsql/upgrade_006.1_to_006.2.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_006.1_to_006.2.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_006.2_to_007.0.sh.in b/src/share/database/scripts/pgsql/upgrade_006.2_to_007.0.sh.in index 029fed8dcd..f34ef709c4 100644 --- a/src/share/database/scripts/pgsql/upgrade_006.2_to_007.0.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_006.2_to_007.0.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_007_to_008.sh.in b/src/share/database/scripts/pgsql/upgrade_007_to_008.sh.in index 35d3ac8df5..b2d8fbcea1 100644 --- a/src/share/database/scripts/pgsql/upgrade_007_to_008.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_007_to_008.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_008_to_009.sh.in b/src/share/database/scripts/pgsql/upgrade_008_to_009.sh.in index c0894080ec..afb5b0a020 100644 --- a/src/share/database/scripts/pgsql/upgrade_008_to_009.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_008_to_009.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_009_to_010.sh.in b/src/share/database/scripts/pgsql/upgrade_009_to_010.sh.in index 18fb4901de..c9194fc84c 100644 --- a/src/share/database/scripts/pgsql/upgrade_009_to_010.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_009_to_010.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_010_to_011.sh.in b/src/share/database/scripts/pgsql/upgrade_010_to_011.sh.in index 92af8a7044..8b83184c22 100644 --- a/src/share/database/scripts/pgsql/upgrade_010_to_011.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_010_to_011.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_011_to_012.sh.in b/src/share/database/scripts/pgsql/upgrade_011_to_012.sh.in index b94d9e600b..822192921d 100644 --- a/src/share/database/scripts/pgsql/upgrade_011_to_012.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_011_to_012.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_012_to_013.sh.in b/src/share/database/scripts/pgsql/upgrade_012_to_013.sh.in index f9ac5b1b24..4f48181cc1 100644 --- a/src/share/database/scripts/pgsql/upgrade_012_to_013.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_012_to_013.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_013_to_014.sh.in b/src/share/database/scripts/pgsql/upgrade_013_to_014.sh.in index 6810ed0997..72c13dc117 100644 --- a/src/share/database/scripts/pgsql/upgrade_013_to_014.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_013_to_014.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_014_to_015.sh.in b/src/share/database/scripts/pgsql/upgrade_014_to_015.sh.in index eecf52f6fd..95e9f28acb 100644 --- a/src/share/database/scripts/pgsql/upgrade_014_to_015.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_014_to_015.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_015_to_016.sh.in b/src/share/database/scripts/pgsql/upgrade_015_to_016.sh.in index 7258b6f74e..b72170074b 100644 --- a/src/share/database/scripts/pgsql/upgrade_015_to_016.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_015_to_016.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_016_to_017.sh.in b/src/share/database/scripts/pgsql/upgrade_016_to_017.sh.in index 7bcfc414c1..d62a42903c 100644 --- a/src/share/database/scripts/pgsql/upgrade_016_to_017.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_016_to_017.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_017_to_018.sh.in b/src/share/database/scripts/pgsql/upgrade_017_to_018.sh.in index 4af85f92d1..2f1670bb3e 100644 --- a/src/share/database/scripts/pgsql/upgrade_017_to_018.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_017_to_018.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_018_to_019.sh.in b/src/share/database/scripts/pgsql/upgrade_018_to_019.sh.in index f56cb1dc35..a52961412f 100644 --- a/src/share/database/scripts/pgsql/upgrade_018_to_019.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_018_to_019.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/upgrade_019_to_020.sh.in b/src/share/database/scripts/pgsql/upgrade_019_to_020.sh.in index 2a80f5e278..41e3c97b41 100644 --- a/src/share/database/scripts/pgsql/upgrade_019_to_020.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_019_to_020.sh.in @@ -14,14 +14,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi VERSION=$(pgsql_version "$@") diff --git a/src/share/database/scripts/pgsql/wipe_data.sh.in b/src/share/database/scripts/pgsql/wipe_data.sh.in index 4cb4d3689c..cb40b793fc 100644 --- a/src/share/database/scripts/pgsql/wipe_data.sh.in +++ b/src/share/database/scripts/pgsql/wipe_data.sh.in @@ -20,14 +20,16 @@ set -eu # SC2034: ... appears unused. Verify use (or export if used externally). prefix="@prefix@" -# Include utilities. Use installed version if available and -# use build version if it isn't. -if test -f "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"; then +# Include utilities based on location of this script. Check for sources first, +# so that the unexpected situations with weird paths fall on the default +# case of installed. +script_path=$(cd "$(dirname "${0}")" && pwd) +if test "${script_path}" = "@abs_top_builddir@/src/share/database/scripts/pgsql"; then # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" + . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" else # shellcheck source=./src/bin/admin/admin-utils.sh.in - . "@abs_top_builddir@/src/bin/admin/admin-utils.sh" + . "@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" fi # First argument must be the expected schema version <major>.<minor> |