@@ -473,6 +473,87 @@ type DisableUnitFileChange struct {
473
473
Destination string // Destination of the symlink
474
474
}
475
475
476
+ // MaskUnitFiles masks one or more units in the system
477
+ //
478
+ // It takes three arguments:
479
+ // * list of units to mask (either just file names or full
480
+ // absolute paths if the unit files are residing outside
481
+ // the usual unit search paths)
482
+ // * runtime to specify whether the unit was enabled for runtime
483
+ // only (true, /run/systemd/..), or persistently (false, /etc/systemd/..)
484
+ // * force flag
485
+ func (c * Conn ) MaskUnitFiles (files []string , runtime bool , force bool ) ([]MaskUnitFileChange , error ) {
486
+ result := make ([][]interface {}, 0 )
487
+ err := c .sysobj .Call ("org.freedesktop.systemd1.Manager.MaskUnitFiles" , 0 , files , runtime , force ).Store (& result )
488
+ if err != nil {
489
+ return nil , err
490
+ }
491
+
492
+ resultInterface := make ([]interface {}, len (result ))
493
+ for i := range result {
494
+ resultInterface [i ] = result [i ]
495
+ }
496
+
497
+ changes := make ([]MaskUnitFileChange , len (result ))
498
+ changesInterface := make ([]interface {}, len (changes ))
499
+ for i := range changes {
500
+ changesInterface [i ] = & changes [i ]
501
+ }
502
+
503
+ err = dbus .Store (resultInterface , changesInterface ... )
504
+ if err != nil {
505
+ return nil , err
506
+ }
507
+
508
+ return changes , nil
509
+ }
510
+
511
+ type MaskUnitFileChange struct {
512
+ Type string // Type of the change (one of symlink or unlink)
513
+ Filename string // File name of the symlink
514
+ Destination string // Destination of the symlink
515
+ }
516
+
517
+ // UnmaskUnitFiles unmasks one or more units in the system
518
+ //
519
+ // It takes two arguments:
520
+ // * list of unit files to mask (either just file names or full
521
+ // absolute paths if the unit files are residing outside
522
+ // the usual unit search paths)
523
+ // * runtime to specify whether the unit was enabled for runtime
524
+ // only (true, /run/systemd/..), or persistently (false, /etc/systemd/..)
525
+ func (c * Conn ) UnmaskUnitFiles (files []string , runtime bool ) ([]UnmaskUnitFileChange , error ) {
526
+ result := make ([][]interface {}, 0 )
527
+ err := c .sysobj .Call ("org.freedesktop.systemd1.Manager.UnmaskUnitFiles" , 0 , files , runtime ).Store (& result )
528
+ if err != nil {
529
+ return nil , err
530
+ }
531
+
532
+ resultInterface := make ([]interface {}, len (result ))
533
+ for i := range result {
534
+ resultInterface [i ] = result [i ]
535
+ }
536
+
537
+ changes := make ([]UnmaskUnitFileChange , len (result ))
538
+ changesInterface := make ([]interface {}, len (changes ))
539
+ for i := range changes {
540
+ changesInterface [i ] = & changes [i ]
541
+ }
542
+
543
+ err = dbus .Store (resultInterface , changesInterface ... )
544
+ if err != nil {
545
+ return nil , err
546
+ }
547
+
548
+ return changes , nil
549
+ }
550
+
551
+ type UnmaskUnitFileChange struct {
552
+ Type string // Type of the change (one of symlink or unlink)
553
+ Filename string // File name of the symlink
554
+ Destination string // Destination of the symlink
555
+ }
556
+
476
557
// Reload instructs systemd to scan for and reload unit files. This is
477
558
// equivalent to a 'systemctl daemon-reload'.
478
559
func (c * Conn ) Reload () error {
0 commit comments