summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2023-05-04 12:56:26 +0200
committerJose M. Guisado <jguisado@soleta.eu>2023-05-09 13:09:07 +0200
commit66a464f7d04b9b8abed578b7ba9456a50ee9a3f8 (patch)
tree31a323852ad1beb36f2e3046e6adfe58fd0480c4
parentef06618a8c5b00680fb4f92e2d3b9f5dae1cbea7 (diff)
live: rewrite reboot operationv1.2.9
Add optional 'operation' parameter to _poweroff_oglive function. Reuse _poweroff_oglive code before the busybox subprocess when rebooting an ogLive client.
-rw-r--r--src/live/ogOperations.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py
index a86db5c..6f759d7 100644
--- a/src/live/ogOperations.py
+++ b/src/live/ogOperations.py
@@ -190,7 +190,7 @@ class OgLiveOperations:
with open(logfile, 'wb', 0) as f:
f.truncate(0)
- def _poweroff_oglive(self):
+ def _poweroff_oglive(self, operation='poweroff'):
interface = os.getenv('DEVICE')
cmd_ethtool = shlex.split(f'ethtool -s {interface} wol g')
cmd_browser = shlex.split('pkill -9 browser')
@@ -198,7 +198,7 @@ class OgLiveOperations:
busybox = 'busybox'
else:
busybox = shutil.which('busyboxOLD')
- cmd_busybox = shlex.split(f'{busybox} poweroff')
+ cmd_busybox = shlex.split(f'{busybox} {operation}')
umount_all()
umount_cache()
@@ -219,9 +219,7 @@ class OgLiveOperations:
def reboot(self):
logging.info('Rebooting client')
if os.path.exists('/scripts/oginit'):
- cmd = f'source {ogClient.OG_PATH}etc/preinit/loadenviron.sh; ' \
- f'{ogClient.OG_PATH}scripts/reboot'
- subprocess.call([cmd], shell=True, executable=OG_SHELL)
+ self._poweroff_oglive(operation='reboot')
else:
subprocess.call(['/sbin/reboot'])