Skip to content

Commit d79d462

Browse files
committed
feat: add sshpass.exe v1.0.6 for Windows, and refactor Windows installer script
https://github.com/xhcoding/sshpass-win32
1 parent b7c3d07 commit d79d462

File tree

5 files changed

+20
-27
lines changed

5 files changed

+20
-27
lines changed

create-windows-installer.iss

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -96,31 +96,12 @@ Source: "license.txt"; DestDir: "{app}"; Flags: ignoreversion
9696
Source: "LICENSE"; DestDir: "{app}"; Flags: ignoreversion
9797
Source: "extra\dll\plugins\*.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion
9898
Source: "extra\Snippets\*.sql"; DestDir: "{#SnippetsDir}"; Tasks: install_snippets
99-
Source: "extra\dll\plink-64.exe"; DestDir: "{app}"; DestName: "plink.exe"; Flags: ignoreversion
100-
Source: "extra\dll\plink-0.81-64.exe"; DestDir: "{app}"; DestName: "plink-0.81.exe"; Flags: ignoreversion
101-
; MySQL + MariaDB:
102-
Source: "extra\dll\libmariadb.dll"; DestDir: "{app}"; DestName: "libmariadb.dll"; Flags: ignoreversion
103-
Source: "extra\dll\libmysql.dll"; DestDir: "{app}"; DestName: "libmysql.dll"; Flags: ignoreversion
104-
Source: "extra\dll\libmysql-6.1.dll"; DestDir: "{app}"; DestName: "libmysql-6.1.dll"; Flags: ignoreversion
105-
Source: "extra\dll\libmysql-8.4.0.dll"; DestDir: "{app}"; DestName: "libmysql-8.4.0.dll"; Flags: ignoreversion
106-
Source: "extra\dll\libmysql-9.4.0.dll"; DestDir: "{app}"; DestName: "libmysql-9.4.0.dll"; Flags: ignoreversion
107-
; PostgreSQL:
108-
Source: "extra\dll\libpq-15.dll"; DestDir: "{app}"; DestName: "libpq-15.dll"; Flags: ignoreversion
109-
Source: "extra\dll\libpq-17.dll"; DestDir: "{app}"; DestName: "libpq-17.dll"; Flags: ignoreversion
110-
Source: "extra\dll\libintl-9.dll"; DestDir: "{app}"; DestName: "libintl-9.dll"; Flags: ignoreversion
111-
Source: "extra\dll\libssl-3-x64.dll"; DestDir: "{app}"; DestName: "libssl-3-x64.dll"; Flags: ignoreversion
112-
Source: "extra\dll\libcrypto-3-x64.dll"; DestDir: "{app}"; DestName: "libcrypto-3-x64.dll"; Flags: ignoreversion
113-
Source: "extra\dll\LICENSE-openssl"; DestDir: "{app}"; Flags: ignoreversion
114-
Source: "extra\dll\libiconv-2.dll"; DestDir: "{app}"; DestName: "libiconv-2.dll"; Flags: ignoreversion
115-
Source: "extra\dll\libwinpthread-1.dll"; DestDir: "{app}"; DestName: "libwinpthread-1.dll"; Flags: ignoreversion
116-
; SQLite:
117-
Source: "extra\dll\sqlite3.dll"; DestDir: "{app}"; DestName: "sqlite3.dll"; Flags: ignoreversion
118-
Source: "extra\dll\sqlite3mc.dll"; DestDir: "{app}"; DestName: "sqlite3mc.dll"; Flags: ignoreversion
119-
; Interbase/Firebird:
120-
Source: "extra\dll\ibclient64-14.1.dll"; DestDir: "{app}"; Flags: ignoreversion
121-
Source: "extra\dll\fbclient-4.0.dll"; DestDir: "{app}"; DestName: "fbclient-4.0.dll"; Flags: ignoreversion
99+
; Just everything from the dll folder, including plink and some others
100+
Source: "extra\dll\*.*"; DestDir: "{app}"; Flags: ignoreversion
122101
; SQL function definitions
123102
Source: "extra\ini\functions-*.ini"; DestDir: "{app}"; Flags: ignoreversion
103+
; Translation files
104+
Source: "extra\locale\*.mo"; DestDir: "{app}\locale"; Flags: ignoreversion
124105

125106

126107
[Icons]

extra/dll/sshpass.exe

208 KB
Binary file not shown.

source/dbconnection.pas

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,14 @@ function TSecureShellCmd.SshpassPath: String;
10401040
{$IFDEF DARWIN}
10411041
// See https://www.heidisql.com/forum.php?t=44716
10421042
Result := '/opt/homebrew/bin/sshpass';
1043-
{$ELSE}
1044-
Result := '';
1043+
{$ENDIF}
1044+
{$IFDEF WINDOWS}
1045+
// https://github.com/xhcoding/sshpass-win32
1046+
Result := GetAppDir + 'sshpass.exe';
1047+
{$ENDIF}
1048+
{$IFDEF LINUX}
1049+
// Should be found in a known path
1050+
Result := 'sshpass';
10451051
{$ENDIF}
10461052
end;
10471053

@@ -1055,7 +1061,7 @@ procedure TSecureShellCmd.Connect;
10551061
CheckIntervalMs: Integer;
10561062
TimeStartedMs, WaitedMs, TimeOutMs: Int64;
10571063
EnvSshpass: String;
1058-
EnvList: TStringList;
1064+
EnvList, ProcOutput: TStringList;
10591065
begin
10601066
// Check if local port is open
10611067
PortChecks := 0;
@@ -1115,7 +1121,13 @@ procedure TSecureShellCmd.Connect;
11151121
FProcess.Execute;
11161122
except
11171123
on E:EProcess do begin
1118-
ErrorText := CRLF + CRLF + SshCmdDisplay + CRLF + CRLF + 'System message: ' + SysErrorMessage(GetLastOSError);
1124+
ProcOutput := TStringList.Create;
1125+
ProcOutput.LoadFromStream(FProcess.Output);
1126+
ErrorText := sLineBreak +
1127+
SshCmdDisplay + sLineBreak +
1128+
ProcOutput.Text + sLineBreak +
1129+
'System message: ' + SysErrorMessage(GetLastOSError);
1130+
ProcOutput.Free;
11191131
ErrorText := f_('Could not execute SSH command: %s', [ErrorText]);
11201132
raise EDbError.Create(ErrorText);
11211133
end;

0 commit comments

Comments
 (0)