usr/lib/byobu/release: use /etc/issue first, much, much faster,

thanks to the suggestion from Daniel Hahler, LP: #674275
This commit is contained in:
Dustin Kirkland 2010-11-12 22:43:02 -06:00
commit 089e56e8ea
2 changed files with 17 additions and 7 deletions

2
debian/changelog vendored
View file

@ -14,6 +14,8 @@ byobu (3.9) unreleased; urgency=low
usr/share/byobu/profiles/byoburc, usr/share/byobu/profiles/common, usr/share/byobu/profiles/byoburc, usr/share/byobu/profiles/common,
usr/share/man/man1/byobu.1: clean up the broken xdg changes, usr/share/man/man1/byobu.1: clean up the broken xdg changes,
maintain both the xdg dir and a symlink for now; LP: #674217 maintain both the xdg dir and a symlink for now; LP: #674217
* usr/lib/byobu/release: use /etc/issue first, much, much faster,
thanks to the suggestion from Daniel Hahler, LP: #674275
-- Dustin Kirkland <kirkland@ubuntu.com> Wed, 10 Nov 2010 18:29:06 -0600 -- Dustin Kirkland <kirkland@ubuntu.com> Wed, 10 Nov 2010 18:29:06 -0600

View file

@ -26,8 +26,22 @@ if [ "$1" = "--detail" ]; then
fi fi
if [ -n "$DISTRO" ]; then if [ -n "$DISTRO" ]; then
# skip down to the bottom # user defined
true true
elif [ -r "/etc/issue" ]; then
# lsb_release is *really* slow; try to use /etc/issue first
issue=$(grep -m1 "^[A-Za-z]" /etc/issue)
case "$issue" in
Ubuntu*)
DISTRO=$(echo "$issue" | sed "s/ \\\.*$//")
;;
Debian*)
DISTRO="Debian $(cat /etc/debian_version)"
;;
*)
DISTRO=$(echo "$issue" | sed "s/ [^0-9]* / /" | awk '{print $1 " " $2}')
;;
esac
elif which lsb_release >/dev/null 2>&1; then elif which lsb_release >/dev/null 2>&1; then
if [ "$1" = "--detail" ]; then if [ "$1" = "--detail" ]; then
lsb_release -a 2>/dev/null lsb_release -a 2>/dev/null
@ -48,12 +62,6 @@ elif which lsb_release >/dev/null 2>&1; then
DISTRO="$i $r" DISTRO="$i $r"
;; ;;
esac esac
elif [ -r "/etc/palm-build-info" ]; then
# Palm Pre hack
DISTRO=$(grep "^PRODUCT_VERSION_STRING=Palm " /etc/palm-build-info | sed "s/^.*=Palm //")
elif [ -r "/etc/issue" ]; then
# Otherwise, grab part of /etc/issue, ideally the distro and version
DISTRO=$(grep -m1 "^[A-Za-z]" /etc/issue | sed "s/ [^0-9]* / /" | awk '{print $1 " " $2}')
else else
DISTRO="Byobu" DISTRO="Byobu"
fi fi