diff options
author | Alvaro Neira Ayuso <aneira@soleta.eu> | 2019-12-16 10:18:12 +0100 |
---|---|---|
committer | Alvaro Neira Ayuso <alvaroneay@gmail.com> | 2020-01-19 19:50:44 +0100 |
commit | 2997952bc97871c140f3724a63a6c7fed6310f57 (patch) | |
tree | ba26a732c8267011cda07e675f5fa31643c729b2 | |
parent | 694bc492a2cb42179d6341be8d7ad4098a2ac9ce (diff) |
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.
-rw-r--r-- | src/linux/ogOperations.py | 6 |
1 files changed, 4 insertions, 2 deletions
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']) |