lightman-agent 1.0.21 → 1.0.22
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/cms-agent.js +26 -13
- package/package.json +1 -1
- package/scripts/install-windows.ps1 +8 -7
package/bin/cms-agent.js
CHANGED
|
@@ -183,12 +183,21 @@ async function promptServer(defaultServer) {
|
|
|
183
183
|
function resolveInstallScript() {
|
|
184
184
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
185
185
|
const packaged = resolve(here, '../scripts/install-windows.ps1');
|
|
186
|
-
const localRepo = resolve(cwd(), 'scripts/install-windows.ps1');
|
|
187
|
-
if (existsSync(packaged)) return packaged;
|
|
188
|
-
if (existsSync(localRepo)) return localRepo;
|
|
186
|
+
const localRepo = resolve(cwd(), 'scripts/install-windows.ps1');
|
|
187
|
+
if (existsSync(packaged)) return packaged;
|
|
188
|
+
if (existsSync(localRepo)) return localRepo;
|
|
189
189
|
throw new Error('install-windows.ps1 not found. Expected in package scripts/ or current folder scripts/.');
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
function scriptSupportsPairingTimeout(scriptPath) {
|
|
193
|
+
try {
|
|
194
|
+
const script = readFileSync(scriptPath, 'utf8');
|
|
195
|
+
return script.includes('PairingTimeoutSeconds');
|
|
196
|
+
} catch {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
192
201
|
function runVersion() {
|
|
193
202
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
194
203
|
const bundledPkg = safeReadJson(resolve(here, '../package.json')) || {};
|
|
@@ -202,16 +211,20 @@ function runVersion() {
|
|
|
202
211
|
console.log(`node: ${process.version}`);
|
|
203
212
|
}
|
|
204
213
|
|
|
205
|
-
function installUsingPowerShell({ scriptPath, slug, server, timezone, pairingTimeoutSeconds, noRestart }) {
|
|
206
|
-
console.log(`powershell -ExecutionPolicy Bypass -File scripts\\install-windows.ps1 -Slug "${slug}" -Server "${server}" -ShellReplace`);
|
|
207
|
-
const args = ['-ExecutionPolicy', 'Bypass', '-File', scriptPath, '-Slug', slug, '-Server', server, '-ShellReplace'];
|
|
208
|
-
if (timezone) {
|
|
209
|
-
args.push('-Timezone', timezone);
|
|
210
|
-
}
|
|
211
|
-
if (
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
function installUsingPowerShell({ scriptPath, slug, server, timezone, pairingTimeoutSeconds, noRestart }) {
|
|
215
|
+
console.log(`powershell -ExecutionPolicy Bypass -File scripts\\install-windows.ps1 -Slug "${slug}" -Server "${server}" -ShellReplace`);
|
|
216
|
+
const args = ['-ExecutionPolicy', 'Bypass', '-File', scriptPath, '-Slug', slug, '-Server', server, '-ShellReplace'];
|
|
217
|
+
if (timezone) {
|
|
218
|
+
args.push('-Timezone', timezone);
|
|
219
|
+
}
|
|
220
|
+
if (
|
|
221
|
+
Number.isInteger(pairingTimeoutSeconds)
|
|
222
|
+
&& pairingTimeoutSeconds >= 0
|
|
223
|
+
&& scriptSupportsPairingTimeout(scriptPath)
|
|
224
|
+
) {
|
|
225
|
+
args.push('-PairingTimeoutSeconds', String(pairingTimeoutSeconds));
|
|
226
|
+
}
|
|
227
|
+
runOrFail('powershell.exe', args);
|
|
215
228
|
|
|
216
229
|
if (!noRestart) {
|
|
217
230
|
console.log('Installation completed. Rebooting now...');
|
package/package.json
CHANGED
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
# powershell -ExecutionPolicy Bypass -File install-windows.ps1 -Slug "F-AV01" -Server "http://..." -ShellReplace
|
|
10
10
|
#Requires -RunAsAdministrator
|
|
11
11
|
|
|
12
|
-
param(
|
|
13
|
-
[Parameter(Mandatory=$true)] [string]$Slug,
|
|
14
|
-
[Parameter(Mandatory=$true)] [string]$Server,
|
|
15
|
-
[string]$Timezone = "Asia/Kolkata",
|
|
16
|
-
[string]$Username = "",
|
|
17
|
-
[switch]$ShellReplace = $false
|
|
18
|
-
|
|
12
|
+
param(
|
|
13
|
+
[Parameter(Mandatory=$true)] [string]$Slug,
|
|
14
|
+
[Parameter(Mandatory=$true)] [string]$Server,
|
|
15
|
+
[string]$Timezone = "Asia/Kolkata",
|
|
16
|
+
[string]$Username = "",
|
|
17
|
+
[switch]$ShellReplace = $false,
|
|
18
|
+
[int]$PairingTimeoutSeconds = 900
|
|
19
|
+
)
|
|
19
20
|
|
|
20
21
|
$ErrorActionPreference = "Stop"
|
|
21
22
|
|