* 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:
Dustin Kirkland 2009-05-11 22:29:27 -05:00
commit a8ad735f5c
2 changed files with 7 additions and 5 deletions

View file

@ -90,8 +90,10 @@ fi
# This can be a very expensive operation, do it only # This can be a very expensive operation, do it only
# if all other methods fail # if all other methods fail
if which lsb_release >/dev/null 2>&1; then
distro=`lsb_release -s -a 2>/dev/null` distro=`lsb_release -s -a 2>/dev/null`
print_logo "$distro" && exit 0 || true print_logo "$distro" && exit 0 || true
fi
# No idea! # No idea!
printf " ? " printf " ? "

View file

@ -17,7 +17,7 @@
# 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 which lsb_release >/dev/null; then if 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
exit 0 exit 0
@ -39,8 +39,8 @@ elif [ -r "/etc/issue" ]; then
cat /etc/issue cat /etc/issue
exit 0 exit 0
fi fi
# Otherwise, grab part of /etc/issue # Otherwise, grab part of /etc/issue, ideally the distro and version
printf "\005{=b }%s\005{-} " $(head -n1 /etc/issue | awk '{print $1}') printf "\005{=b }%s\005{-} " $(head -n1 /etc/issue | sed "s/ [^0-9]* / /" | awk '{print $1 " " $2}')
else else
echo "Unknown" echo "Unknown"
fi fi