44 lines
1.0 KiB
Python
44 lines
1.0 KiB
Python
#!/usr/bin/python3
|
|
|
|
## early init
|
|
import os
|
|
import sys
|
|
OPENGNSYS = os.environ.get ('OPENGNSYS', '/opt/opengnsys')
|
|
os.environ['PYTHONPATH'] = f'{OPENGNSYS}/lib/python3'
|
|
sys.path.insert (0, os.environ['PYTHONPATH'])
|
|
## end
|
|
|
|
import subprocess
|
|
|
|
import ogGlobals
|
|
from InitLib import loadenviron, write_profile, clean_esp, fileslinks, loadmodules, metadevs, mountrepo, poweroff, filebeat, stunnel, dbus, otherservices, runhttplog
|
|
|
|
IPV4ADDR = os.environ.get ('IPV4ADDR', '')
|
|
OG_IP = os.environ.get ('OG_IP', '')
|
|
|
|
loadenviron()
|
|
write_profile()
|
|
|
|
# Funciones de inicio.
|
|
clean_esp()
|
|
fileslinks()
|
|
loadmodules()
|
|
metadevs()
|
|
mountrepo()
|
|
poweroff()
|
|
filebeat()
|
|
stunnel()
|
|
dbus()
|
|
otherservices()
|
|
runhttplog()
|
|
|
|
if IPV4ADDR and os.path.exists (f'{ogGlobals.OGETC}/init/{IPV4ADDR}.sh'):
|
|
if OG_IP: subprocess.run ([f'{ogGlobals.OGETC}/init/{OG_IP}.sh'])
|
|
|
|
elif os.path.exists (f'{ogGlobals.OGETC}/init.py'):
|
|
subprocess.run ([f'{ogGlobals.OGETC}/init.py'])
|
|
|
|
else:
|
|
print ('No se ha encontrado script de inicio')
|
|
subprocess.run (['halt'])
|