Moved getdistro to a seperate function take 2

This commit is contained in:
Dylan 2016-04-05 00:59:04 +10:00
parent a02f8577e3
commit f6b6a28149
1 changed files with 68 additions and 69 deletions

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}}
}
@ -2888,15 +2896,6 @@ 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
# }}}
@ -2906,7 +2905,7 @@ esac
# Restore cursor and clear screen on ctrl+c
trap 'printf "\033[?25h"; clear; exit' 2
# Get colors / bold
getdistro
colors
bold