Merge pull request #217 from dylanaraps/distro_func

Moved getdistro to a seperate function take 2
This commit is contained in:
Dylan Araps 2016-04-05 01:02:10 +10:00
commit 695bd7401d

View file

@ -452,7 +452,10 @@ esac
# Distro {{{
case "$os" in
getdistro () {
[ ! -z "$distro" ] && return
case "$os" in
"Linux" )
if type -p lsb_release >/dev/null 2>&1; then
distro="$(lsb_release -d 2>/dev/null | awk -F ':' '/Description/ {printf $2}')"
@ -507,14 +510,19 @@ case "$os" in
distro=${distro// }
distro=${distro/Microsoft }
;;
esac
distro=${distro//+( )/ }
ascii_distro="$distro"
esac
distro=${distro//+( )/ }
ascii_distro="$distro"
getdistro () {
# Get architecture
[ "$os_arch" == "on" ] && \
distro+=" $(uname -m)"
[ "$osx_codename" == "off" ] && \
distro=${distro/${codename}/Mac OS X}
[ "$osx_buildversion" == "off" ] && \
distro=${distro/ ${osx_build}}
}
@ -2886,27 +2894,13 @@ done
# }}}
# OS overides {{{
# Overide OS X codename
case "$osx_codename" in
"off") distro=${distro/${codename}/Mac OS X} ;;
esac
case "$osx_buildversion" in
"off") distro=${distro/ ${osx_build}} ;;
esac
# }}}
# Call Functions and Finish Up {{{
# Restore cursor and clear screen on ctrl+c
trap 'printf "\033[?25h"; clear; exit' 2
# Get colors / bold
getdistro
colors
bold