mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 14:24:39 -07:00
bin/logo: lsb_release is really expensive, try /etc/issue first,
and fall back to lsb_release if that fails -Dustin Kirkland <kirkland@ubuntu.com>Fri, 17 Apr 2009 18:11:12 -0500
This commit is contained in:
parent
fd906813ac
commit
28f7467baa
2 changed files with 53 additions and 41 deletions
48
bin/logo
48
bin/logo
|
@ -17,23 +17,8 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
if [ -r "$HOME/.screen-profiles/logo" ]; then
|
print_logo() {
|
||||||
# Allow users to define their own logo
|
distro="$1"
|
||||||
cat "$HOME/.screen-profiles/logo"
|
|
||||||
elif [ -r "$HOME/.screen-profiles/distro" ]; then
|
|
||||||
# Allow manual override of distro
|
|
||||||
distro=`cat "$HOME/.screen-profiles/distro"`
|
|
||||||
elif which lsb_release >/dev/null; then
|
|
||||||
# If lsb_release is available, use it
|
|
||||||
distro=`lsb_release -s -a 2>/dev/null`
|
|
||||||
elif [ -r "/etc/issue" ]; then
|
|
||||||
# Otherwise, grab part of /etc/issue
|
|
||||||
distro=`cat /etc/issue`
|
|
||||||
else
|
|
||||||
# No idea!
|
|
||||||
distro="Unknown"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if echo "$distro" | grep -qsi "ubuntu"; then
|
if echo "$distro" | grep -qsi "ubuntu"; then
|
||||||
printf "\005{=b kr}\\\\\005{= ky}o\005{=b kY}/"
|
printf "\005{=b kr}\\\\\005{= ky}o\005{=b kY}/"
|
||||||
elif echo "$distro" | grep -qsi "arch"; then
|
elif echo "$distro" | grep -qsi "arch"; then
|
||||||
|
@ -59,6 +44,31 @@ elif echo "$distro" | grep -qsi "suse"; then
|
||||||
elif echo "$distro" | grep -qsi "xandros"; then
|
elif echo "$distro" | grep -qsi "xandros"; then
|
||||||
printf "\005{= Wr} X "
|
printf "\005{= Wr} X "
|
||||||
else
|
else
|
||||||
printf " ? "
|
false
|
||||||
fi
|
fi
|
||||||
exit 0
|
}
|
||||||
|
|
||||||
|
if [ -r "$HOME/.screen-profiles/logo" ]; then
|
||||||
|
# Allow users to define their own logo
|
||||||
|
cat "$HOME/.screen-profiles/logo" && exit 0 || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -r "$HOME/.screen-profiles/distro" ]; then
|
||||||
|
# Allow manual override of distro
|
||||||
|
distro=`cat "$HOME/.screen-profiles/distro"`
|
||||||
|
print_logo "$distro" && exit 0 || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -r "/etc/issue" ]; then
|
||||||
|
# Otherwise, check /etc/issue
|
||||||
|
distro=`cat /etc/issue`
|
||||||
|
print_logo "$distro" && exit 0 || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This can be a very expensive operation, do it only
|
||||||
|
# if all other methods fail
|
||||||
|
distro=`lsb_release -s -a 2>/dev/null`
|
||||||
|
print_logo "$distro" && exit 0 || true
|
||||||
|
|
||||||
|
# No idea!
|
||||||
|
printf " ? "
|
||||||
|
|
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -2,8 +2,10 @@ screen-profiles (1.47) unreleased; urgency=low
|
||||||
|
|
||||||
* screen-profiles-status: stop grepping after one match, subtle perf
|
* screen-profiles-status: stop grepping after one match, subtle perf
|
||||||
improvement
|
improvement
|
||||||
|
* bin/logo: lsb_release is really expensive, try /etc/issue first,
|
||||||
|
and fall back to lsb_release if that fails
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 17 Apr 2009 16:33:53 -0500
|
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 17 Apr 2009 18:11:12 -0500
|
||||||
|
|
||||||
screen-profiles (1.46-0ubuntu1) jaunty; urgency=low
|
screen-profiles (1.46-0ubuntu1) jaunty; urgency=low
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue