@techsologic/unolock-agent 0.1.43 → 0.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/install-binary.js +21 -16
- package/package.json +1 -1
package/bin/install-binary.js
CHANGED
|
@@ -4,24 +4,24 @@
|
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
const path = require("path");
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
PACKAGE_VERSION,
|
|
9
|
-
binaryUrl,
|
|
10
|
-
ensureDir,
|
|
11
|
-
ensureExecutable,
|
|
12
|
-
fetchToFile,
|
|
13
|
-
installedBinaryPath,
|
|
14
|
-
} = require("./unolock-agent-common");
|
|
7
|
+
const common = require("./unolock-agent-common");
|
|
15
8
|
|
|
16
|
-
async function
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
async function installBinary(options = {}) {
|
|
10
|
+
const fsImpl = options.fsImpl || fs;
|
|
11
|
+
const commonImpl = options.commonImpl || common;
|
|
12
|
+
const dest = commonImpl.installedBinaryPath();
|
|
13
|
+
if (fsImpl.existsSync(dest)) {
|
|
14
|
+
fsImpl.unlinkSync(dest);
|
|
21
15
|
}
|
|
22
|
-
ensureDir(path.dirname(dest));
|
|
23
|
-
process.stderr.write(
|
|
24
|
-
|
|
16
|
+
commonImpl.ensureDir(path.dirname(dest));
|
|
17
|
+
process.stderr.write(
|
|
18
|
+
`Installing UnoLock agent ${commonImpl.PACKAGE_VERSION} for ${process.platform}/${process.arch}...\n`,
|
|
19
|
+
);
|
|
20
|
+
await commonImpl.fetchToFile(commonImpl.binaryUrl(commonImpl.PACKAGE_VERSION), dest);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function main() {
|
|
24
|
+
await installBinary();
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
if (require.main === module) {
|
|
@@ -30,3 +30,8 @@ if (require.main === module) {
|
|
|
30
30
|
process.exit(1);
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
installBinary,
|
|
36
|
+
main,
|
|
37
|
+
};
|