Просмотр исходного кода

Added os-release as an option for distroname

Daniel Gibbs 9 лет назад
Родитель
Сommit
0c471b91f0
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      lgsm/functions/info_distro.sh

+ 4 - 2
lgsm/functions/info_distro.sh

@@ -15,6 +15,8 @@ arch=$(uname -m)
 kernel=$(uname -r)
 kernel=$(uname -r)
 if [ -n "$(command -v lsb_release)" ]; then
 if [ -n "$(command -v lsb_release)" ]; then
 	distroname=$(lsb_release -s -d)
 	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
 elif [ -f "/etc/debian_version" ]; then
 	distroname="Debian $(cat /etc/debian_version)"
 	distroname="Debian $(cat /etc/debian_version)"
 elif [ -f "/etc/redhat-release" ]; then
 elif [ -f "/etc/redhat-release" ]; then
@@ -23,7 +25,7 @@ else
 	distroname="$(uname -s) $(uname -r)"
 	distroname="$(uname -s) $(uname -r)"
 fi
 fi
 
 
-distroversion=$(grep VERSION_ID /etc/os-release |tr -cd '[:digit:]')
+distroversion=$(grep VERSION_ID /etc/os-release | tr -cd '[:digit:]')
 
 
 ## Glibc version
 ## Glibc version
 # e.g: 1.17
 # e.g: 1.17
@@ -33,7 +35,7 @@ glibcversion="$(ldd --version | sed -n '1s/.* //p')"
 # e.g: tmux 1.6
 # e.g: tmux 1.6
 if [ -z "$(command -v tmux)" ]; then
 if [ -z "$(command -v tmux)" ]; then
 	tmuxv="${red}NOT INSTALLED!${default}"
 	tmuxv="${red}NOT INSTALLED!${default}"
-elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -lt "16" ]; then
+elif [ "$(tmux -V|sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')" -lt "16" ]; then
 	tmuxv="$(tmux -V) (>= 1.6 required for console log)"
 	tmuxv="$(tmux -V) (>= 1.6 required for console log)"
 else
 else
 	tmuxv=$(tmux -V)
 	tmuxv=$(tmux -V)