Improve Debian version detection

This commit is contained in:
T. Joseph Carter 2016-10-27 08:17:31 -07:00
parent 94d17f56cc
commit ae89fef8b4
4 changed files with 17 additions and 39 deletions

View File

@ -16,14 +16,14 @@ esac
useExternalURL=1
[[ $A2SERVER_NO_EXTERNAL ]] && useExternalURL=
debianVersion=$(cat /etc/debian_version 2> /dev/null)
debianVersion="$(lsb_release -rs)"
isRpi=
arch=
if [[ -f /usr/bin/raspi-config ]]; then
isRpi=1
arch='rpi'
elif lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian'; then
if [[ $(cut -d . -f 1 <<< $debianVersion) -ge "7" ]]; then
elif [[ "$(lsb_release -ds)" = Debian* ]]; then
if [[ "$debianVersion" -ge 7 || $debianVersion == [a-z]* ]]; then
uname_m="$(uname -m)"
if [[ $uname_m == "i686" ]]; then
arch='debian_x86'
@ -33,17 +33,7 @@ elif lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian'; then
fi
fi
debianName=
if [[ $debianVersion ]]; then
debianMajor=$(cut -d . -f 1 <<< $debianVersion)
if [[ $debianMajor == "8" ]]; then
debianName="jessie"
elif [[ $debianMajor == "7" ]]; then
debianName="wheezy"
else
debianName="unknown"
fi
fi
debianName=$(lsb_release -cs)
echo "A2SERVER: Installing A2SERVER tools..."
@ -123,7 +113,7 @@ if ! hash unar &> /dev/null; then
fi
# jessie and later: Just use the unar package
if [[ $debianMajor -ge 8 ]]; then
if [[ "$debianName" != "wheezy" ]]; then
sudo apt-get -y install unar
sudo apt-get clean
fi

View File

@ -26,15 +26,15 @@ esac
useExternalURL=1
[[ $A2SERVER_NO_EXTERNAL ]] && useExternalURL=
debianVersion=$(cat /etc/debian_version 2> /dev/null)
debianVersion="$(lsb_release -rs)"
isRpi=
arch=
if [[ -f /usr/bin/raspi-config ]]; then
isRpi=1
arch='rpi'
elif lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian'; then
if [[ $(cut -d . -f 1 <<< $debianVersion) -ge "7" ]]; then
uname_m="$(uname -m)"
elif [[ "$(lsb_release -ds)" = Debian* ]]; then
if [[ "$debianVersion" -ge 7 || $debianVersion == [a-z]* ]]; then
uname_m="$(uname -m)"
if [[ $uname_m == "i686" ]]; then
arch='debian_x86'
elif [[ $uname_m == "x86_64" ]]; then
@ -43,23 +43,13 @@ elif lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian'; then
fi
fi
debianName=
if [[ $debianVersion ]]; then
debianMajor=$(cut -d . -f 1 <<< $debianVersion)
if [[ $debianMajor == "8" ]]; then
debianName="jessie"
elif [[ $debianMajor == "7" ]]; then
debianName="wheezy"
else
debianName="unknown"
fi
fi
debianName=$(lsb_release -cs)
# skip this if already done
if [[ -f /usr/local/etc/A2SERVER-version ]]; then
read a2sVersion </usr/local/etc/A2SERVER-version
fi
if [[ $a2sVersion = *.*.* || $a2sVersion -ge 101]]; then
if [[ "$a2sVersion" != *.*.* || "$a2sVersion" -lt 101 ]]; then
echo "A2SERVER: Installing Netatalk (this will take a while)..."
# stop Netatalk and samba if running (during upgrade)
if [[ $(ps --no-headers -C afpd) ]]; then

View File

@ -19,9 +19,8 @@ password="your password"
[[ $isApple2Pw ]] && password="'apple2'"
[[ $isRaspberryPw ]] && password="'raspberry'"
isDebian=
if lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian'; then
if [[ $(cut -d . -f 1 < /etc/debian_version) -ge "7" ]]; then
if [[ "$(lsb_release -ds)" = Debian* ]]; then
if [[ "$debianVersion" -ge 7 || $debianVersion == [a-z]* ]]; then
isDebian=1
fi
fi

View File

@ -36,11 +36,10 @@ isRpi=
[[ -f /usr/bin/raspi-config ]] && isRpi=1
isDebian=
if lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian'; then
if [[ -f /etc/debian_version ]]; then
if [[ $(cut -d . -f 1 < /etc/debian_version) -ge "7" ]]; then
isDebian=1
fi
if [[ "$(lsb_release -ds)" = Debian* ]]; then
debianVersion="$(lsb_release -rs)"
if [[ "$debianVersion" -ge 7 || $debianVersion == [a-z]* ]]; then
isDebian=1
fi
fi