change 'command -v' to 'hash'; make sure libdb5.1 installs on Wheezy

(Raspbian Wheezy has both libdb5.1 and libdb5.3, so now tries 5.1 first.)
This commit is contained in:
Ivan X 2016-01-03 17:39:09 -05:00
parent 00adf2673d
commit 02442b16e5
3 changed files with 22 additions and 22 deletions

View File

@ -109,7 +109,7 @@ fi
# download and install The Unarchiver, for expanding Apple disk images
# http://wakaba.c3.cx/s/apps/unarchiver.html
if ! command -v unar > /dev/null; then
if ! hash unar &> /dev/null; then
echo "A2SERVER: Installing The Unarchiver..."
@ -125,7 +125,7 @@ if ! command -v unar > /dev/null; then
sudo apt-get clean
fi
if ! command -v unar > /dev/null; then
if ! hash unar &> /dev/null; then
if [[ $arch && ! -f /tmp/a2server-compileAlways ]]; then
# Dependencies: for unar
sudo apt-get -y install libgnustep-base1.22
@ -134,7 +134,7 @@ if ! command -v unar > /dev/null; then
fi
# If all else fails, compile from source.
if ! command -v unar >/dev/null; then
if ! hash unar &> /dev/null; then
# Dependencies: build-deps for unar
sudo apt-get -y install build-essential libgnustep-base-dev libz-dev libbz2-dev libssl-dev libicu-dev unzip
@ -165,7 +165,7 @@ else
echo "A2SERVER: The Unarchiver has already been installed."
fi
if ! command -v unzip >/dev/null; then
if ! hash unzip &> /dev/null; then
echo "A2SERVER: Installing unzip..."
if [[ ! -f /tmp/a2server-packageReposUpdated ]]; then
# prepare for installing packages

View File

@ -97,12 +97,12 @@ else
urls=
while [[ $arch ]]; do
# Install runtime libraries needed by Netatalk
if [[ $(apt-cache search '^libdb5.3$') ]]; then # Jessie
# Dependencies: netatalk 2.2.4
sudo apt-get -y install libdb5.3
elif [[ $(apt-cache search '^libdb5.1$') ]]; then # Wheezy
if [[ $(apt-cache search '^libdb5.1$') ]]; then # Wheezy
# Dependencies: netatalk 2.2.4
sudo apt-get -y install libdb5.1
elif [[ $(apt-cache search '^libdb5.3$') ]]; then # Jessie
# Dependencies: netatalk 2.2.4
sudo apt-get -y install libdb5.3
else
break
fi
@ -113,12 +113,12 @@ else
break
fi
if [[ $(apt-cache search '^libgcrypt20$') ]]; then # Jessie
# Dependencies: netatalk 2.2.4
sudo apt-get -y install libgcrypt20
elif [[ $(apt-cache search '^libgcrypt11$') ]]; then # Wheezy
if [[ $(apt-cache search '^libgcrypt11$') ]]; then # Wheezy
# Dependencies: netatalk 2.2.4
sudo apt-get -y install libgcrypt11
elif [[ $(apt-cache search '^libgcrypt20$') ]]; then # Jessie
# Dependencies: netatalk 2.2.4
sudo apt-get -y install libgcrypt20
else
break
fi
@ -137,12 +137,12 @@ else
if [[ $compileFromSource ]]; then
# Dependencies: build-deps for netatalk 2.2.4
sudo apt-get -y install build-essential libssl-dev
if [[ $(apt-cache search '^libdb5.3-dev$') ]]; then # Jessie
# Dependencies: build-deps for netatalk 2.2.4
sudo apt-get -y install libdb5.3-dev
elif [[ $(apt-cache search '^libdb5.1-dev$') ]]; then # Wheezy
if [[ $(apt-cache search '^libdb5.1-dev$') ]]; then # Wheezy
# Dependencies: build-deps for netatalk 2.2.4
sudo apt-get -y install libdb5.1-dev
elif [[ $(apt-cache search '^libdb5.3-dev$') ]]; then # Jessie
# Dependencies: build-deps for netatalk 2.2.4
sudo apt-get -y install libdb5.3-dev
else
echo "A2SERVER: WARNING: unknown version of libdb-dev is being installed."
# Dependencies: build-deps for netatalk 2.2.4
@ -197,14 +197,14 @@ else
fi
# --- Install MacIPgw
if ! command -v macipgw > /dev/null; then
if ! hash macipgw &> /dev/null; then
echo "A2SERVER: Installing TCP over AppleTalk (MacIP)..."
if [[ $arch && ! -f /tmp/a2server-compileAlways ]]; then
{ wget -qO- "${binaryURL}precompiled/macipgw-${arch}.tgz" | sudo tar Pzx; } 2> /dev/null
fi
if ! command -v macipgw > /dev/null; then
if ! hash macipgw &> /dev/null; then
wd="$PWD"
sudo apt-get -y install build-essential
rm -rf /tmp/macipgw &> /dev/null
@ -333,7 +333,7 @@ if [[ -d /srv/A2SERVER/A2FILES && ! -d /srv/A2SERVER/.a2files ]]; then
echo "A2SERVER: Converting A2FILES to support mixed case..."
sudo /etc/init.d/netatalk stop &> /dev/null
sudo /etc/init.d/samba stop &> /dev/null
if ! command -v getfattr &> /dev/null; then
if ! hash getfattr &> /dev/null; then
# Dependency: for ciopfs conversion (setfattr)
sudo apt-get -y install attr &> /dev/null
sudo apt-get clean
@ -385,7 +385,7 @@ sudo sed -i \
[[ -d /srv/A2SERVER/.a2files ]] || mkdir -p /srv/A2SERVER/.a2files
# set up ciopfs
if ! command -v ciopfs > /dev/null; then
if ! hash ciopfs &> /dev/null; then
echo "A2SERVER: Installing ciopfs (case insensitive file system)..."
cd /tmp
@ -400,7 +400,7 @@ if ! command -v ciopfs > /dev/null; then
echo "user_allow_other" | sudo tee /etc/fuse.conf > /dev/null
fi
if ! command -v ciopfs > /dev/null; then
if ! hash ciopfs &> /dev/null; then
if [[ ! -f /tmp/a2server-packageReposUpdated ]]; then
# prepare for installing packages
sudo apt-get -y update

View File

@ -31,7 +31,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupWindowsSharing ]]; then
# Dependency: samba for Windows/modern Macs
# FIXME: Figure out when smbpasswd moved and adjust this as necessary
sudo apt-get -y install samba
command -v smbpasswd > /dev/null || sudo apt-get -y install samba-common-bin
hash smbpasswd &> /dev/null || sudo apt-get -y install samba-common-bin
sudo apt-get clean
fi