Improve OS detection
- Check /etc/lsb-release if command "lsb_release" is missing
This commit is contained in:
parent
3dbf3a9c09
commit
9ea2b50dae
@ -21,6 +21,9 @@ exiterr() { echo "Error: $1" >&2; exit 1; }
|
||||
exiterr2() { echo "Error: 'apt-get install' failed." >&2; exit 1; }
|
||||
|
||||
os_type="$(lsb_release -si 2>/dev/null)"
|
||||
if [ -z "$os_type" ] && [ -f "/etc/lsb-release" ]; then
|
||||
os_type="$(. /etc/lsb-release && echo "$DISTRIB_ID")"
|
||||
fi
|
||||
if [ "$os_type" != "Ubuntu" ] && [ "$os_type" != "Debian" ] && [ "$os_type" != "Raspbian" ]; then
|
||||
exiterr "This script only supports Ubuntu/Debian."
|
||||
fi
|
||||
|
@ -46,6 +46,9 @@ check_ip() {
|
||||
}
|
||||
|
||||
os_type="$(lsb_release -si 2>/dev/null)"
|
||||
if [ -z "$os_type" ] && [ -f "/etc/lsb-release" ]; then
|
||||
os_type="$(. /etc/lsb-release && echo "$DISTRIB_ID")"
|
||||
fi
|
||||
if [ "$os_type" != "Ubuntu" ] && [ "$os_type" != "Debian" ] && [ "$os_type" != "Raspbian" ]; then
|
||||
exiterr "This script only supports Ubuntu/Debian."
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user