From 2997952bc97871c140f3724a63a6c7fed6310f57 Mon Sep 17 00:00:00 2001 From: Alvaro Neira Ayuso Date: Mon, 16 Dec 2019 10:18:12 +0100 Subject: Add global variable to set up OpenGnsys path This variable allow us to modify the opengnsys path without modify several parts of the code. This change reduces the probability to add any bug forgetting to change any line. --- src/linux/ogOperations.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/linux') diff --git a/src/linux/ogOperations.py b/src/linux/ogOperations.py index 79bff19..e3d69e2 100644 --- a/src/linux/ogOperations.py +++ b/src/linux/ogOperations.py @@ -1,14 +1,16 @@ import os import subprocess +OG_PATH = '/opt/opengnsys/' + def poweroff(): if os.path.exists('/scripts/oginit'): - subprocess.call('source /opt/opengnsys/etc/preinit/loadenviron.sh; /opt/opengnsys/scripts/poweroff', shell=True) + subprocess.call('source ' + OG_SCRIPT_PATH + 'etc/preinit/loadenviron.sh; ' + OG_SCRIPT_PATH + 'scripts/poweroff', shell=True) else: subprocess.call(['/sbin/poweroff']) def reboot(): if os.path.exists('/scripts/oginit'): - subprocess.call('source /opt/opengnsys/etc/preinit/loadenviron.sh; /opt/opengnsys/scripts/reboot', shell=True) + subprocess.call('source ' + OG_SCRIPT_PATH + 'etc/preinit/loadenviron.sh; ' + OG_SCRIPT_PATH + 'scripts/reboot', shell=True) else: subprocess.call(['/sbin/reboot']) -- cgit v1.2.3-18-g5258