@@ -12,9 +12,9 @@ import (
12
12
"path/filepath"
13
13
)
14
14
15
- // Function to download and make the binary executable
15
+ // Function to download and make the binary and plugin binary executable
16
16
func InstallRelayBinary () {
17
- downloadSpinner , _ := pterm .DefaultSpinner .Start (fmt .Sprintf ("Downloading %s relay binary ..." , RelayName ))
17
+ downloadSpinner , _ := pterm .DefaultSpinner .Start (fmt .Sprintf ("Downloading %s binaries ..." , RelayName ))
18
18
19
19
// Check for and remove existing git repository
20
20
directories .RemoveDirectory (GitRepoTmpDirPath )
@@ -26,38 +26,38 @@ func InstallRelayBinary() {
26
26
27
27
// Install
28
28
// Determine the file name from the URL
29
- tmpFileName := filepath .Base (DownloadURL )
29
+ tmpBinaryFileName := filepath .Base (DownloadURL )
30
30
31
31
// Temporary file path
32
- tmpFilePath := fmt .Sprintf ("%s/%s" , relays .TmpDirPath , tmpFileName )
32
+ tmpBinaryFilePath := fmt .Sprintf ("%s/%s" , relays .TmpDirPath , tmpBinaryFileName )
33
33
34
34
// Check if the temporary file exists and remove it if it does
35
- files .RemoveFile (tmpFilePath )
35
+ files .RemoveFile (tmpBinaryFilePath )
36
36
37
37
// Download and copy the file
38
- files .DownloadAndCopyFile (tmpFilePath , DownloadURL )
39
-
40
- // Extract binary
41
- files .ExtractFile (tmpFilePath , relays .BinaryDestDir )
38
+ files .DownloadAndCopyFile (tmpBinaryFilePath , DownloadURL )
42
39
43
40
// Determine the file name from the URL
44
- tmpFileName = filepath .Base (BinaryPluginDownloadURL )
41
+ tmpBinaryPluginFileName : = filepath .Base (BinaryPluginDownloadURL )
45
42
46
43
// Temporary file path
47
- tmpFilePath = fmt .Sprintf ("%s/%s" , relays .TmpDirPath , tmpFileName )
44
+ tmpBinaryPluginFilePath : = fmt .Sprintf ("%s/%s" , relays .TmpDirPath , tmpBinaryPluginFileName )
48
45
49
46
// Check if the temporary file exists and remove it if it does
50
- files .RemoveFile (tmpFilePath )
47
+ files .RemoveFile (tmpBinaryPluginFilePath )
51
48
52
49
// Download and copy the file
53
- files .DownloadAndCopyFile (tmpFilePath , BinaryPluginDownloadURL )
50
+ files .DownloadAndCopyFile (tmpBinaryPluginFilePath , BinaryPluginDownloadURL )
54
51
55
- downloadSpinner .Success (fmt .Sprintf ("%s relay binary downloaded" , RelayName ))
52
+ downloadSpinner .Success (fmt .Sprintf ("%s binaries downloaded" , RelayName ))
56
53
57
54
// Verify relay binary
58
- verification .VerifyRelayBinary (tmpFilePath )
55
+ verification .VerifyRelayBinary (BinaryName , tmpBinaryFilePath )
56
+
57
+ // Verify relay binary plugin
58
+ verification .VerifyRelayBinary (fmt .Sprintf ("%s plugin" , RelayName ), tmpBinaryPluginFilePath )
59
59
60
- installSpinner , _ := pterm .DefaultSpinner .Start (fmt .Sprintf ("Installing %s relay binary ..." , RelayName ))
60
+ installSpinner , _ := pterm .DefaultSpinner .Start (fmt .Sprintf ("Installing %s binaries ..." , RelayName ))
61
61
62
62
// Check if the service file exists and disable and stop the service if it does
63
63
if files .FileExists (ServiceFilePath ) {
@@ -69,8 +69,11 @@ func InstallRelayBinary() {
69
69
installSpinner .UpdateText ("Service file not found..." )
70
70
}
71
71
72
- // Extract binary
73
- files .ExtractFile (tmpFilePath , relays .BinaryDestDir )
72
+ // Extract relay binary
73
+ files .ExtractFile (tmpBinaryFilePath , relays .BinaryDestDir )
74
+
75
+ // Extract relay binary plugin
76
+ files .ExtractFile (tmpBinaryPluginFilePath , relays .BinaryDestDir )
74
77
75
78
// TODO
76
79
// Currently, the downloaded binary is expected to have a name that matches the BinaryName variable
@@ -88,5 +91,5 @@ func InstallRelayBinary() {
88
91
// Make the file executable
89
92
files .SetPermissions (destPath , 0755 )
90
93
91
- installSpinner .Success (fmt .Sprintf ("%s relay binary installed" , RelayName ))
94
+ installSpinner .Success (fmt .Sprintf ("%s binaries installed" , RelayName ))
92
95
}
0 commit comments