drone/app/gitspace/orchestrator/common/script/os_info.sh
Vikyath Harekal 9e9790a67d feat: [CDE-332]: Install tools (#2907)
* 

feat: [CDE-332]: Install tools
* 

feat: [CDE-332]: Install tools
* 

feat: [CDE-332]: Install tools
* 

feat: [CDE-332]: Install tools
* 

feat: [CDE-332]: Install tools
* 

feat: [CDE-332]: lint issues
* 





feat: [CDE-332]: Install tools
2024-10-30 11:16:57 +00:00

56 lines
886 B
Bash

os() {
uname="$(uname)"
case $uname in
Linux) echo linux ;;
Darwin) echo macos ;;
FreeBSD) echo freebsd ;;
*) echo "$uname" ;;
esac
}
distro() {
local os_name
os_name=$(os)
if [ "$os_name" = "macos" ] || [ "$os_name" = "freebsd" ]; then
echo "$os_name"
return
fi
if [ -f /etc/os-release ]; then
(
. /etc/os-release
if [ "${ID_LIKE-}" ]; then
for id_like in $ID_LIKE; do
case "$id_like" in debian | fedora | opensuse | arch)
echo "$id_like"
return
;;
esac
done
fi
echo "$ID"
)
return
fi
}
distro_name() {
if [ "$(uname)" = "Darwin" ]; then
echo "macOS v$(sw_vers -productVersion)"
return
fi
if [ -f /etc/os-release ]; then
(
. /etc/os-release
echo "$PRETTY_NAME"
)
return
fi
uname -sr
}