mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-21 22:13:19 -07:00
* bin/logo: check that lsb_release is available before using it
* bin/release: try to grab both distro and version from /etc/issue if that's what we're forced to use Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
parent
69aafb8c3b
commit
a8ad735f5c
2 changed files with 7 additions and 5 deletions
6
bin/logo
6
bin/logo
|
@ -90,8 +90,10 @@ 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
|
||||
if which lsb_release >/dev/null 2>&1; then
|
||||
distro=`lsb_release -s -a 2>/dev/null`
|
||||
print_logo "$distro" && exit 0 || true
|
||||
fi
|
||||
|
||||
# No idea!
|
||||
printf " ? "
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if which lsb_release >/dev/null; then
|
||||
if which lsb_release >/dev/null 2>&1; then
|
||||
if [ "$1" = "--detail" ]; then
|
||||
lsb_release -a 2>/dev/null
|
||||
exit 0
|
||||
|
@ -39,8 +39,8 @@ elif [ -r "/etc/issue" ]; then
|
|||
cat /etc/issue
|
||||
exit 0
|
||||
fi
|
||||
# Otherwise, grab part of /etc/issue
|
||||
printf "\005{=b }%s\005{-} " $(head -n1 /etc/issue | awk '{print $1}')
|
||||
# Otherwise, grab part of /etc/issue, ideally the distro and version
|
||||
printf "\005{=b }%s\005{-} " $(head -n1 /etc/issue | sed "s/ [^0-9]* / /" | awk '{print $1 " " $2}')
|
||||
else
|
||||
echo "Unknown"
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue