From c8a071c1a9e00521cccd5aad5cf863a7aaddb95e Mon Sep 17 00:00:00 2001 From: Teddysun Date: Mon, 27 Feb 2017 23:39:06 +0900 Subject: [PATCH] update get latest version Signed-off-by: Teddysun --- bbr.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bbr.sh b/bbr.sh index 836d674..910fd47 100644 --- a/bbr.sh +++ b/bbr.sh @@ -38,6 +38,8 @@ get_latest_version() { latest_version=$(wget -qO- http://kernel.ubuntu.com/~kernel-ppa/mainline/ | awk -F'\"v' '/v[4-9]./{print $2}' | cut -d/ -f1 | grep -v - | sort -V | tail -1) + [ -z ${latest_version} ] && return 1 + if [[ `getconf WORD_BIT` == "32" && `getconf LONG_BIT` == "64" ]]; then deb_name=$(wget -qO- http://kernel.ubuntu.com/~kernel-ppa/mainline/v${latest_version}/ | grep "linux-image" | grep "generic" | awk -F'\">' '/amd64.deb/{print $2}' | cut -d'<' -f1 | head -1) deb_kernel_url="http://kernel.ubuntu.com/~kernel-ppa/mainline/v${latest_version}/${deb_name}" @@ -48,7 +50,7 @@ get_latest_version() { deb_kernel_name="linux-image-${latest_version}-i386.deb" fi - [ ! -z ${latest_version} ] && return 0 || return 1 + [ ! -z ${deb_name} ] && return 0 || return 1 } get_opsy() {