diff options
author | Jannik Schönartz | 2021-04-06 19:43:53 +0200 |
---|---|---|
committer | Jannik Schönartz | 2021-04-06 19:43:53 +0200 |
commit | 11faefa846b1da7595d15a637c5d5a6c4f20af20 (patch) | |
tree | d4c3df33c5c442289ee1253d2e56d084d4c0d9de | |
parent | [bas] Add readlink to smartctl output (diff) | |
download | systemd-init-11faefa846b1da7595d15a637c5d5a6c4f20af20.tar.gz systemd-init-11faefa846b1da7595d15a637c5d5a6c4f20af20.tar.xz systemd-init-11faefa846b1da7595d15a637c5d5a6c4f20af20.zip |
[bas-python] Add programs, drm dependencie for edid data and remove hooks, because this module gets called through a bas registration hook
-rwxr-xr-x | modules.d/bas-python/module-setup.sh | 21 | ||||
-rwxr-xr-x | modules.d/bas-python/scripts/00reboot_script.sh | 10 | ||||
-rwxr-xr-x | modules.d/bas-python/scripts/collect_hw_info_json.py (renamed from modules.d/bas-python/scripts/00collect_hw_info_json.py) | 3 |
3 files changed, 15 insertions, 19 deletions
diff --git a/modules.d/bas-python/module-setup.sh b/modules.d/bas-python/module-setup.sh index 4fa8b260..2b5c6958 100755 --- a/modules.d/bas-python/module-setup.sh +++ b/modules.d/bas-python/module-setup.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash check() { - for bin in python3 pip3; do + for bin in python3 pip3 lshw ip dmidecode; do if ! hash "$bin" 2>&1 /dev/null; then echo "Missing '$bin' please install it..." return 1 @@ -10,13 +10,18 @@ check() { return 255 } depends() { - : + # drm is needed for getting the edid data + echo slx-drm } install() { - # Not needed but for testing the scripts manual + # Copy the python hardware collection script to /opt/bas/ mkdir -p "$initdir/opt/bas" - cp -r "$moddir/scripts" "$initdir/opt/bas/" + cp -r "$moddir/scripts/collect_hw_info_json.py" "$initdir/opt/bas/" + # For testing the scripts manual, copy em all + # cp -r "$moddir/scripts" "$initdir/opt/bas/" + + # Libs needed for python3 and dmiparser mkdir -p "$initdir/usr/lib" cp -r "/usr/lib/python3" "$initdir/usr/lib/" cp -r "/usr/lib/python3.8" "$initdir/usr/lib/" @@ -27,14 +32,14 @@ install() { mkdir -p "$initdir/usr/share" cp -r "/usr/share/python-wheels" "$initdir/usr/share/python-wheels/" + # Certificates mkdir -p "$initdir/etc/ssl/certs/" cp "/etc/ssl/certs/ca-certificates.crt" "$initdir/etc/ssl/certs/" - inst_multiple python3 pip3 + inst_multiple python3 pip3 lshw smartctl ip dmidecode - inst_hook pre-mount 00 "$moddir/scripts/00collect_hw_info_json.py" - # Call finish script instead of Switch Root - inst_hook pre-mount 00 "$moddir/scripts/00reboot_script.sh" + # Exec the python hook and reboot instead of Switch Root + # inst_hook pre-mount 00 "$moddir/scripts/python_hook.sh" return 0 } diff --git a/modules.d/bas-python/scripts/00reboot_script.sh b/modules.d/bas-python/scripts/00reboot_script.sh deleted file mode 100755 index 2ae7ca55..00000000 --- a/modules.d/bas-python/scripts/00reboot_script.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -echo "°(^.^)° Everything finished (hopefully) successfull" - -# . /lib/dracut-lib.sh -# emergency_shell - -read -p "Press Enter to reboot" -reboot - diff --git a/modules.d/bas-python/scripts/00collect_hw_info_json.py b/modules.d/bas-python/scripts/collect_hw_info_json.py index 9eea9ca8..1c2185f8 100755 --- a/modules.d/bas-python/scripts/00collect_hw_info_json.py +++ b/modules.d/bas-python/scripts/collect_hw_info_json.py @@ -76,7 +76,7 @@ def get_smartctl(): # Get and process "lspci -mn" output def get_lspci(): lspci = [] - lspci_raw = run_subprocess('lspci -mn').split('\n') + lspci_raw = run_subprocess('lspci -mmn').split('\n') for line in lspci_raw: if len(line) <= 0: continue @@ -211,6 +211,7 @@ def main(): # Run the tools _collecthw = {} + _collecthw['version'] = 2.0 _collecthw['dmidecode'] = get_dmidecode() _collecthw['smartctl'] = get_smartctl() _collecthw['lspci'] = get_lspci() |