Files
Misc-Scripts/test.sh
2018-10-02 21:12:02 -05:00

45 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
source /dev/stdin <<< "$(curl -sL http://scity.xyz/colorsinc)"
# Detect distribution name
if [[ `which lsb_release 2>/dev/null` ]]; then
# lsb_release available
distrib_name=`lsb_release -is`
else
# lsb_release not available
lsb_files=`find /etc -type f -maxdepth 1 \( ! -wholename /etc/os-release ! -wholename /etc/lsb-release -wholename /etc/\*release -o -wholename /etc/\*version \) 2> /dev/null`
for file in $lsb_files; do
if [[ $file =~ /etc/(.*)[-_] ]]; then
distrib_name=${BASH_REMATCH[1]}
break
else
echo -e "${BOrange}Sorry, GlancesAutoInstall script is not compliant with your system.${Color_Off}"
echo -e "${BOrange}Please read: https://github.com/nicolargo/glances#installation${Color_Off}"
exit 1
fi
done
fi
echo -e "${CS[color,LightGreen]}Detected system: $distrib_name${CS[color,Default]}"
echo ""
arch=$(uname -m)
kernel=$(uname -r)
if [ -n "$(command -v lsb_release)" ]; then
distroname=$(lsb_release -s -d)
elif [ -f "/etc/os-release" ]; then
distroname=$(grep PRETTY_NAME /etc/os-release | sed 's/PRETTY_NAME=//g' | tr -d '="')
elif [ -f "/etc/debian_version" ]; then
distroname="Debian $(cat /etc/debian_version)"
elif [ -f "/etc/redhat-release" ]; then
distroname=$(cat /etc/redhat-release)
else
distroname="$(uname -s) $(uname -r)"
fi
echo "${distroname}"
exit 0