Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Verify-kernel-conf
#!/bin/bash
unset kernel_data[6]
unset tegra_version[3]
unset cpu_verstion
Green='\033[0;32m'
Red='\033[0;31m'
Blue='\033[0;34m'
Cyan='\033[0;36m'
NC='\033[0m'
# Seccion de validacion para la carga de dependencia tanto como de una SBC o Cloud
Verify_Kernel_Conf(){
#tipo de procesador
kernel_data[0]=$(uname -p)
#tipo de sistema operativo
kernel_data[1]=$(uname -s)
#version completa del kernel
kernel_data[2]=$(uname -r | sed -r 's/-[a-z]+//')
#version partida del kernel
kernel_data[3]=$(uname -r | sed -r 's/([0-9]+.[0-9]+).*/\1/')
#version del sistema operativo
kernel_data[4]=$(lsb_release -r | sed -r 's/.*([0-9][0-9]+\.[0-9]+).*/\1/')
if [[ ${kernel_data[0]} == "x86_64" && ${kernel_data[1]} == "Linux" ]]; then
printf "${Cyan} This is a AMD/INTEL X86-64 device ${NC} \n"
printf "${Blue} Processor Architecture: ${Green} ${kernel_data[0]} \n"
printf "${Blue} Operative Version: ${Green} ${kernel_data[4]} \n"
printf "${Blue} Kernel Version: ${Green} ${kernel_data[2]} ${NC}\n"
elif [[ ${kernel_data[0]} == "aarch64" && ${kernel_data[1]} == "Linux" ]]; then
printf "${Cyan} This is a ARM-DEVICE ${NC}\n"
#jetson AGX-X
tegra_version[0]=$(cat /etc/nv_tegra_release | cut -d " " -f2 | sed -r 's/\w([0-9]+)/\1/')
tegra_version[1]=$(cat /etc/nv_tegra_release | cut -d " " -f5 | sed -r 's/([0-9]+.[0-9]),/\1/')
#version de las librerias de L4T(linux for tegra)
tegra_version[2]="${tegra_version[0]}.${tegra_version[1]}"
printf "${Blue} Processor Architecture: ${Green} ${kernel_data[0]} \n"
printf "${Blue} Operative Version: ${Green} ${kernel_data[4]} \n"
printf "${Blue} Kernel Version: ${Green} ${kernel_data[2]}${NC} \n"
if [[ -f "/etc/nv_tegra_release" ]]; then
printf "${Blue} Library of jetson L4T: ${Green} ${tegra_version[2]}${NC} \n"
fi
else
printf "${Red} warning this Operative System was not contenplated on this automatization ${NC}"
#Configuracion de instalacion de k8s
fi
}
Verify_Kernel_Conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment