go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers/os/resources/reboot/debian.go (about)

     1  // Copyright (c) Mondoo, Inc.
     2  // SPDX-License-Identifier: BUSL-1.1
     3  
     4  package reboot
     5  
     6  import "go.mondoo.com/cnquery/providers/os/connection/shared"
     7  
     8  const LinuxRebootFile = "/var/run/reboot-required"
     9  
    10  // DebianReboot works on Debian and Ubuntu
    11  type DebianReboot struct {
    12  	conn shared.Connection
    13  }
    14  
    15  func (s *DebianReboot) Name() string {
    16  	return "Linux Reboot"
    17  }
    18  
    19  func (s *DebianReboot) RebootPending() (bool, error) {
    20  	// try to stat the file
    21  	_, err := s.conn.FileSystem().Stat(LinuxRebootFile)
    22  	if err != nil {
    23  		return false, nil
    24  	}
    25  	return true, nil
    26  }