File tree 2 files changed +20
-18
lines changed
2 files changed +20
-18
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,12 @@ func main() {
16
16
log .Fatal ("This program must be run as root! (sudo)" )
17
17
}
18
18
19
+ cmd = exec .Command ("ufw" , "status" )
20
+ _ , err = cmd .Output ()
21
+ if err != nil {
22
+ log .Fatal ("Cannot find ufw. Is it installed?" )
23
+ }
24
+
19
25
tui := service .CreateApplication ()
20
26
tui .Init ()
21
27
data , err := tui .LoadTableData ()
Original file line number Diff line number Diff line change @@ -460,24 +460,20 @@ func (t *Tui) Build(data []string) {
460
460
root := t .CreateLayout ()
461
461
462
462
if len (data ) <= 1 {
463
- if len (data ) == 1 && strings .Contains (data [0 ], "inactive" ) {
464
- t .pages .HidePage ("base" )
465
- t .CreateModal ("ufw is disabled.\n Do you want to enable it?" ,
466
- func () {
467
- utils .Shellout ("ufw --force enable" )
468
- },
469
- func () {
470
- t .app .Stop ()
471
- },
472
- func () {
473
- t .pages .HidePage ("modal" )
474
- t .pages .ShowPage ("base" )
475
- t .app .SetFocus (t .menu )
476
- },
477
- )
478
- } else {
479
- panic ("ufw is not installed.\n Be sure to install it before launching tufw" )
480
- }
463
+ t .pages .HidePage ("base" )
464
+ t .CreateModal ("ufw is disabled.\n Do you want to enable it?" ,
465
+ func () {
466
+ utils .Shellout ("ufw --force enable" )
467
+ },
468
+ func () {
469
+ t .app .Stop ()
470
+ },
471
+ func () {
472
+ t .pages .HidePage ("modal" )
473
+ t .pages .ShowPage ("base" )
474
+ t .app .SetFocus (t .menu )
475
+ },
476
+ )
481
477
}
482
478
483
479
t .CreateTable (data )
You can’t perform that action at this time.
0 commit comments