@@ -36,6 +36,10 @@
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
# sqlcmd is installed under /opt by mssql-tools18; that path is usually added only in login shells.
|
||||
# Prepend here so migrate-db works in the same non-login SSH session right after --install-deps.
|
||||
export PATH="/opt/mssql-tools18/bin:/opt/mssql-tools/bin:${PATH:-}"
|
||||
|
||||
SCRIPT_NAME=$(basename "$0")
|
||||
|
||||
die() {
|
||||
@@ -85,22 +89,18 @@ EOF
|
||||
|
||||
ensure_sqlcmd() {
|
||||
if [[ -n "${SQLCMD_PATH:-}" ]]; then
|
||||
[[ -x "$SQLCMD_PATH" ]] || die "SQLCMD_PATH is set but not executable: $SQLCMD_PATH"
|
||||
[[ -f "$SQLCMD_PATH" && -x "$SQLCMD_PATH" ]] || die "SQLCMD_PATH is set but not an executable file: $SQLCMD_PATH"
|
||||
export PATH="$(dirname "$SQLCMD_PATH"):$PATH"
|
||||
fi
|
||||
if command -v sqlcmd >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
local d
|
||||
for d in /opt/mssql-tools18/bin /opt/mssql-tools/bin; do
|
||||
if [[ -x "$d/sqlcmd" ]]; then
|
||||
export PATH="$d:$PATH"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
die "sqlcmd not found. On this host run once (needs sudo), then open a new shell or re-login:
|
||||
die "sqlcmd not found. Install Microsoft tools, then retry (same shell is OK):
|
||||
|
||||
$0 --install-deps
|
||||
If sqlcmd is already installed, add it to PATH or set SQLCMD_PATH=/path/to/sqlcmd"
|
||||
|
||||
Or: export PATH=\"\$PATH:/opt/mssql-tools18/bin\"
|
||||
Or set: SQLCMD_PATH=/path/to/sqlcmd"
|
||||
}
|
||||
|
||||
ensure_clickhouse_client() {
|
||||
|
||||
Reference in New Issue
Block a user