shell-host/modules/host-utils.mod

46 lines
859 B
Bash

#!/bin/bash
arch () {
uname -m
}
get_arch () {
local arch
arch=$(uname -m)
[[ ! $arch ]] && return 1
case $arch in
x86_64) binArch='amd64' ;;
armhf) binArch='armv6' ;;
armv7) binArch='armv7' ;;
aarch64) binArch='arm64' ;;
ppc64el|ppc64le) binArch='ppc64le' ;;
s390x) binArch='s390x' ;;
.*386.*) binArch='amd32' ;;
*) return 2 ;;\
esac;
echo $binArch
}
function get_os () {
declare -l os
os=$(uname -s)
echo $os
}
function get_platform() {
echo $(get_os)-$(get_chip_type)
}
hostinfo () {
hostnamectl
echo -e "--------------------------"
echo kernel: $(uname -r)
echo chip architecture: $(uname -m)
echo -e "--------------------------"
cat /etc/os-release
echo -e "--------------------------"
[[ -f /etc/upstream-release/lsb-release ]] && cat /etc/upstream-release/lsb-release
}