16 lines
408 B
Python
16 lines
408 B
Python
#!/usr/bin/python3
|
|
import subprocess
|
|
import os
|
|
|
|
# Update package lists
|
|
subprocess.run(['sudo', 'apt', 'update'], check=True)
|
|
# Upgrade packages
|
|
subprocess.run(['sudo', 'apt', 'upgrade', '-y'], check=True)
|
|
|
|
# Check if reboot is required
|
|
if os.path.exists('/var/run/reboot-required'):
|
|
print("Reboot required. Rebooting now...")
|
|
subprocess.run(['sudo', 'reboot'])
|
|
else:
|
|
print("No reboot required.")
|