32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
#!/usr/bin/env python3
|
|
"""
|
|
@file metadevs.py
|
|
@brief Script de inicio para detectar metadispositivos LVM y RAID.
|
|
@note Desglose del script "loadenviron.sh".
|
|
@warning License: GNU GPLv3+
|
|
"""
|
|
|
|
def main():
|
|
opengnsys = os.getenv('OPENGNSYS')
|
|
print(f"____________________________________ OpenGnsys environment: {opengnsys}")
|
|
msg_detectlvmraid = os.getenv('MSG_DETECTLVMRAID', '')
|
|
|
|
print(f"____________________________________ Message: {msg_detectlvmraid}")
|
|
|
|
if opengnsys:
|
|
print(msg_detectlvmraid)
|
|
# Detectar metadispositivos LVM.
|
|
subprocess.run(['vgchange', '-ay'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
# Detectar metadispositivos RAID.
|
|
subprocess.run(['dmraid', '-ay'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
else:
|
|
# FIXME Error: entorno de OpenGnsys no configurado.
|
|
print("Error: OpenGnsys environment is not configured.") # FIXME: definir mensaje.
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
main() |