mirror of
https://github.com/RasppleII/a2server.git
synced 2025-01-24 03:37:04 +00:00
*.txt: Fix Debian wheezy/jessie version checks
Found some checks that assumed all Debian was wheezy, and also a bunch of use of cut assuming that there will never be a Debian version higher than 9.0. Let's just futureproof that code right now. This closes #56 and uses the method described therein anywhere -c 1 is used now. For the checks against -c 1-2, we still use -d . -f 1 as described in the issue, but modify the following conditionals to test for just the numeric, without the decimal.
This commit is contained in:
parent
cd8271cd56
commit
cd20570999
@ -22,7 +22,7 @@ arch=
|
||||
if [[ -f /usr/bin/raspi-config ]]; then
|
||||
isRpi=1
|
||||
arch='rpi'
|
||||
elif lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian' && [[ $(cut -c 1 <<< $debianVersion) -ge "7" ]]; then
|
||||
elif lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian' && [[ $(cut -d . -f 1 <<< $debianVersion) -ge "7" ]]; then
|
||||
uname_m="$(uname -m)"
|
||||
if [[ $uname_m == "i686" ]]; then
|
||||
arch='debian_x86'
|
||||
@ -33,10 +33,10 @@ fi
|
||||
|
||||
debianName=
|
||||
if [[ $debianVersion ]]; then
|
||||
debianMajor=$(cut -c 1-2 <<< $debianVersion)
|
||||
if [[ $debianMajor == "8." ]]; then
|
||||
debianMajor=$(cut -d . -f 1 <<< $debianVersion)
|
||||
if [[ $debianMajor == "8" ]]; then
|
||||
debianName="jessie"
|
||||
elif [[ $debianMajor == "7." ]]; then
|
||||
elif [[ $debianMajor == "7" ]]; then
|
||||
debianName="wheezy"
|
||||
else
|
||||
debianName="unknown"
|
||||
|
@ -32,7 +32,7 @@ arch=
|
||||
if [[ -f /usr/bin/raspi-config ]]; then
|
||||
isRpi=1
|
||||
arch='rpi'
|
||||
elif lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian' && [[ $(cut -c 1 <<< $debianVersion) -ge "7" ]]; then
|
||||
elif lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian' && [[ $(cut -d . -f 1 <<< $debianVersion) -ge "7" ]]; then
|
||||
uname_m="$(uname -m)"
|
||||
if [[ $uname_m == "i686" ]]; then
|
||||
arch='debian_x86'
|
||||
@ -43,10 +43,10 @@ fi
|
||||
|
||||
debianName=
|
||||
if [[ $debianVersion ]]; then
|
||||
debianMajor=$(cut -c 1-2 <<< $debianVersion)
|
||||
if [[ $debianMajor == "8." ]]; then
|
||||
debianMajor=$(cut -d . -f 1 <<< $debianVersion)
|
||||
if [[ $debianMajor == "8" ]]; then
|
||||
debianName="jessie"
|
||||
elif [[ $debianMajor == "7." ]]; then
|
||||
elif [[ $debianMajor == "7" ]]; then
|
||||
debianName="wheezy"
|
||||
else
|
||||
debianName="unknown"
|
||||
|
@ -14,7 +14,7 @@ password="your password"
|
||||
[[ $isRaspberryPw ]] && password="'raspberry'"
|
||||
|
||||
isDebian=
|
||||
[[ ( -f /etc/debian_version ) && ( $(cut -c 1-2 < /etc/debian_version) == "7." ) && ( $(uname -m) == "i686" ) ]] && isDebian=1
|
||||
b_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian' && [[ ( -f /etc/debian_version ) && ( $(cut -d . -f 1 < /etc/debian_version) -ge "7" ) ]] && isDebian=1
|
||||
|
||||
if [[ $isDebian ]]; then
|
||||
if { lspci 2> /dev/null | grep -q VirtualBox; }; then
|
||||
|
@ -27,7 +27,7 @@ isRpi=
|
||||
[[ -f /usr/bin/raspi-config ]] && isRpi=1
|
||||
|
||||
isDebian=
|
||||
lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian' && [[ ( -f /etc/debian_version ) && ( $(cut -c 1 < /etc/debian_version) -ge "7" ) ]] && isDebian=1
|
||||
lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian' && [[ ( -f /etc/debian_version ) && ( $(cut -d . -f 1 < /etc/debian_version) -ge "7" ) ]] && isDebian=1
|
||||
|
||||
if [ -f /usr/local/etc/A2SERVER-version ]; then
|
||||
installedVersion="$(cat /usr/local/etc/A2SERVER-version)"
|
||||
|
Loading…
x
Reference in New Issue
Block a user