Skip to content

Commit 1d3c661

Browse files
Lantiziamurrant
andauthored
Fix bash-completions when calling lnms via sudo -u librenms (librenms#18229)
* Fix bash-completions when calling lnms via sudo -u librenms * Update lnms * Create CommandStartingListener.php * Update CommandStartingListener.php * Update CommandStartingListener.php * Update CommandStartingListener.php --------- Co-authored-by: Tony Murray <[email protected]>
1 parent d3568c1 commit 1d3c661

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
/**
4+
* CommandStartingListener.php
5+
*
6+
* -Description-
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
*
21+
* @link https://www.librenms.org
22+
*
23+
* @copyright 2025 Tony Murray
24+
* @author Tony Murray <[email protected]>
25+
*/
26+
27+
namespace App\Listeners;
28+
29+
use Illuminate\Console\Events\CommandStarting;
30+
31+
class CommandStartingListener
32+
{
33+
private array $skip_user_check = [
34+
'list:bash-completion',
35+
];
36+
37+
public function handle(CommandStarting $event): void
38+
{
39+
// Check that we don't run this as the wrong user and break the install
40+
if (in_array($event->command, $this->skip_user_check)) {
41+
return;
42+
}
43+
44+
\App\Checks::runningUser();
45+
}
46+
}

lnms

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515

1616
require __DIR__.'/vendor/autoload.php';
1717

18-
// Check that we don't run this as the wrong user and break the install
19-
\App\Checks::runningUser();
20-
2118
$app = require_once __DIR__.'/bootstrap/app.php';
2219

2320
/*

0 commit comments

Comments
 (0)