Skip to content

Commit

Permalink
Create /var/run/reboot-required file
Browse files Browse the repository at this point in the history
Fix #195
  • Loading branch information
FrostyX committed May 18, 2023
1 parent 831fd91 commit fe8a4e8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tracer/controllers/default.py
Expand Up @@ -69,6 +69,7 @@ def render(self):
view.assign("applications", self.applications)
view.assign("args", self.args)
view.render()
self.create_reboot_required_file()
exit(self.status_code())

def render_helpers(self):
Expand Down Expand Up @@ -136,6 +137,15 @@ def status_code(self):
code = 104
return code

def create_reboot_required_file(self):
"""
If a reboot is needed, create a /var/run/reboot-required file.
This is how Debian/Ubuntu distros does it.
"""
if self.applications.count_type(Applications.TYPES["STATIC"]):
with open("/var/run/reboot-required", "w") as fp:
fp.write("Tracer says reboot is required\n")

def _restartable_applications(self, applications, args):
return applications.exclude_types([
Applications.TYPES['STATIC'],
Expand Down

0 comments on commit fe8a4e8

Please sign in to comment.