Skip to content

Commit 15a19fa

Browse files
authored
Merge pull request #10 from makermelissa/master
Added reboot prompt and kernel version checks
2 parents 82deb93 + 073b68e commit 15a19fa

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

adafruit_shell.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,22 @@ def get_raspbian_version(self):
490490
return raspbian
491491
return None
492492

493+
def prompt_reboot(self):
494+
"""Prompt the user for a reboot"""
495+
if not self.prompt("REBOOT NOW?", default="y"):
496+
print("Exiting without reboot.")
497+
else:
498+
print("Reboot started...")
499+
os.sync()
500+
self.reboot()
501+
self.exit()
502+
503+
def check_kernel_update_reboot_required(self):
504+
"""Checks if the pi needs to be rebooted since the last kernel update"""
505+
if not self.exists("/lib/modules/{}".format(self.release())):
506+
self.error("OS has not been rebooted since last kernel update.")
507+
self.prompt_reboot()
508+
493509
# pylint: enable=invalid-name
494510

495511
@staticmethod

0 commit comments

Comments
 (0)