1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Record var devicetree_model to /etc/iiab/iiab.ini

This commit is contained in:
root 2021-11-27 10:36:20 -05:00
parent 0067172579
commit e16e22c6c5
3 changed files with 15 additions and 2 deletions

View file

@ -3,7 +3,7 @@
# Higher-level purpose explained at the bottom of:
# https://github.com/iiab/iiab/blob/master/vars/default_vars.yml
# 2020-10-27: Most of the 10 variables require a command[*] to be run to
# 2020-10-27: Most of the 11 variables require a command[*] to be run to
# establish the var's value. WE DISPLAY ALL ERRORS / DIAGNOSTICS AND CONTINUE.
#
# [*] DOESN'T MATTER WHAT COMMAND: so long as it fails with Return Code != 0
@ -16,6 +16,7 @@ IIAB_BRANCH="none"
IIAB_COMMIT="none"
#XO_MODEL="none"
RPI_MODEL="none"
DEVICETREE_MODEL="none"
ANSIBLE_VERSION="none"
DHCPCD="none" # The last 3 conditioned on string output not RC. SEE BELOW.
NETWORK_MANAGER="none"
@ -97,6 +98,12 @@ tmp=$(git rev-parse --verify HEAD) &&
tmp=$(grep -ai raspberry /proc/device-tree/model) &&
RPI_MODEL=$tmp
# /proc/device-tree/model e.g. 'Parallels ARM Virtual Machine' identical to...
# /sys/firmware/devicetree/base/model (also true on RPi hardware!)
tmp=$(cat /proc/device-tree/model) &&
DEVICETREE_MODEL=$tmp
tmp=$(ansible --version) &&
ANSIBLE_VERSION=$(echo "$tmp" | head -1 | cut -f 2- -d " " | sed 's/.* \([^ ]*\)\].*/\1/')
# Above works with 'ansible [core 2.11.0rc2]' -- these old ways do not:
@ -134,6 +141,7 @@ cat <<EOF
"iiab_branch" : "$IIAB_BRANCH",
"iiab_commit" : "$IIAB_COMMIT",
"rpi_model" : "$RPI_MODEL",
"devicetree_model" : "$DEVICETREE_MODEL",
"ansible_version" : "$ANSIBLE_VERSION",
"os" : "$OS",
"os_ver" : "$OS_VER"}