Skip to content

Commit 6fd2e1a

Browse files
committed
add bundled connect api plugin upon plg installation
1 parent 0b70fb7 commit 6fd2e1a

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

api/src/unraid-api/cli/plugins/plugin.command.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { parsePackageArg } from '@app/utils.js';
1010

1111
interface InstallPluginCommandOptions {
1212
bundled: boolean;
13+
noRestart: boolean;
1314
}
1415

1516
@SubCommand({
@@ -40,7 +41,9 @@ export class InstallPluginCommand extends CommandRunner {
4041
await this.pluginManagementService.addPlugin(...passedParams);
4142
this.logService.log(`Added plugin ${passedParams.join(', ')}`);
4243
}
43-
await this.restartCommand.run();
44+
if (!options.noRestart) {
45+
await this.restartCommand.run();
46+
}
4447
}
4548

4649
@Option({
@@ -51,6 +54,15 @@ export class InstallPluginCommand extends CommandRunner {
5154
parseBundled(): boolean {
5255
return true;
5356
}
57+
58+
@Option({
59+
flags: '--no-restart',
60+
description: 'Do not restart the API after installation',
61+
defaultValue: false,
62+
})
63+
parseNoRestart(): boolean {
64+
return true;
65+
}
5466
}
5567

5668
@SubCommand({
@@ -81,7 +93,9 @@ export class RemovePluginCommand extends CommandRunner {
8193
await this.pluginManagementService.removePlugin(...passedParams);
8294
this.logService.log(`Removed plugin ${passedParams.join(', ')}`);
8395
}
84-
await this.restartCommand.run();
96+
if (!options.noRestart) {
97+
await this.restartCommand.run();
98+
}
8599
}
86100

87101
@Option({
@@ -92,6 +106,15 @@ export class RemovePluginCommand extends CommandRunner {
92106
parseBundled(): boolean {
93107
return true;
94108
}
109+
110+
@Option({
111+
flags: '--no-restart',
112+
description: 'Do not restart the API after installation',
113+
defaultValue: false,
114+
})
115+
parseNoRestart(): boolean {
116+
return true;
117+
}
95118
}
96119

97120
@SubCommand({
@@ -129,6 +152,7 @@ export class ListPluginCommand extends CommandRunner {
129152
installedPlugins.forEach(([name, version]) => {
130153
this.logService.log(`☑️ ${name}@${version}`);
131154
});
155+
this.logService.log(); // for spacing
132156
}
133157
}
134158

plugin/plugins/dynamix.unraid.net.plg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ if [[ -n "$TAG" && "$TAG" != "" ]]; then
251251
fi
252252
253253
echo "Starting Unraid API service"
254+
/etc/rc.d/rc.unraid-api plugins add unraid-api-plugin-connect -b --no-restart
254255
/etc/rc.d/rc.unraid-api start
255256
256257
echo "Unraid API service started"

0 commit comments

Comments
 (0)