scripts/*.txt: Collapse multiple apt-gets in a row

As Debian has gone from large to huge, actions operating on the package
database have gotten slower and slower, so it's best to do them as few
times as possible.

Here we've got the trivial optimization.  A more complete optimization
requires a refactoring of code, and we're kind of in a 1.3.0 "freeze",
so let's not do that here and now.
This commit is contained in:
T. Joseph Carter 2015-12-21 16:17:13 -08:00
parent 0fffaf93cb
commit 06bc59ece7
3 changed files with 39 additions and 11 deletions

View File

@ -40,9 +40,10 @@ if ! command -v nulib2 > /dev/null; then
touch /tmp/a2server-packageReposUpdated
fi
sudo apt-get -y install build-essential
sudo apt-get -y install zlib1g-dev
# Dependencies: build-dep for nulib
sudo apt-get -y install build-essential zlib1g-dev
sudo apt-get -y clean
cd /tmp
rm -rf /tmp/nulib &> /dev/null
mkdir /tmp/nulib
@ -78,6 +79,7 @@ if ! command -v unar > /dev/null; then
touch /tmp/a2server-packageReposUpdated
fi
# jessie and later: Just use the unar package
if [[ $isJessie ]]; then
sudo apt-get install -y unar
sudo apt-get clean
@ -85,8 +87,11 @@ if ! command -v unar > /dev/null; then
if ! command -v unar > /dev/null; then
if [[ $isRpi || $isDebian ]]; then
# Dependencies: for unar
sudo apt-get -y install libgnustep-base1.22
sudo apt-get clean
if [[ $isRpi ]]; then
wget -qO- "http://appleii.ivanx.com/a2server/files/unar-rpi_wheezy.tgz" | sudo tar Pzx
elif [[ $isDebian ]]; then
@ -96,10 +101,11 @@ if ! command -v unar > /dev/null; then
# If all else fails, compile from source.
if ! command -v unar >/dev/null; then
sudo apt-get -y install build-essential
sudo apt-get -y install libgnustep-base-dev libz-dev libbz2-dev
sudo apt-get -y install libssl-dev libicu-dev unzip
# Dependencies: build-deps for unar
sudo apt-get -y install build-essential libgnustep-base-dev libz-dev libbz2-dev libssl-dev libicu-dev unzip
sudo apt-get clean
rm -rf /tmp/unar &> /dev/null
mkdir /tmp/unar
cd /tmp/unar
@ -121,7 +127,9 @@ fi
if ! command -v unzip >/dev/null; then
echo "A2SERVER: Installing unzip..."
sudo apt-get -y install unzip
# Dependencies: unzip
sudo apt-get -y install unzip
else
echo "A2SERVER: unzip has already been installed."
fi

View File

@ -74,15 +74,19 @@ else
getOldPackage "http://ftp.debian.org/debian/pool/main/d/db/libdb5.1_5.1.29-5_i386.deb"
fi
elif [[ $(apt-cache search '^libdb4.8$') ]]; then
# FIXME: Obsolete?
sudo apt-get -y install libdb4.8
elif [[ $(apt-cache search '^libdb5.1$') ]]; then
# Dependencies: netatalk 2.2.4
sudo apt-get -y install libdb5.1
else
break
fi
if [[ $(apt-cache search '^libssl1.0.0$') ]]; then
# Dependencies: netatalk 2.2.4
sudo apt-get -y install libssl1.0.0
elif [[ $(apt-cache search '^libssl0.9.8$') ]]; then
# FIXME: Obsolete?
sudo apt-get -y install libssl0.9.8
else
break
@ -95,6 +99,7 @@ else
getOldPackage "http://ftp.debian.org/debian/pool/main/libg/libgcrypt11/libgcrypt11_1.5.0-5+deb7u3_i386.deb"
fi
elif [[ $(apt-cache search '^libgcrypt11$') ]]; then
# Dependencies: netatalk 2.2.4
sudo apt-get -y install libgcrypt11
else
break
@ -114,9 +119,8 @@ else
done
if [[ $compileFromSource ]]; then
# Install development libraries needed by Netatalk
sudo apt-get -y install build-essential
sudo apt-get -y install libssl-dev
# Dependencies: build-deps for netatalk 2.2.4
sudo apt-get -y install build-essential libssl-dev
if [[ $isJessie ]]; then
if [[ $isRpi ]]; then
getOldPackage "http://mirrordirector.raspbian.org/raspbian/pool/main/d/db/libdb5.1-dev_5.1.29-5_armhf.deb"
@ -124,11 +128,14 @@ else
getOldPackage "http://ftp.us.debian.org/debian/pool/main/d/db/libdb5.1-dev_5.1.29-5_i386.deb"
fi
elif [[ $(apt-cache search '^libdb4.8-dev$') ]]; then
# FIXME: Obsolete?
sudo apt-get -y install libdb4.8-dev
elif [[ $(apt-cache search '^libdb5.1-dev$') ]]; then
# Dependencies: build-deps for netatalk 2.2.4
sudo apt-get -y install libdb5.1-dev
else
echo "A2SERVER: WARNING: unknown version of libdb-dev is being installed."
# Dependencies: build-deps for netatalk 2.2.4
sudo apt-get -y install libdb-dev
fi
if [[ $isJessie ]]; then
@ -139,9 +146,11 @@ else
getOldPackage "http://ftp.debian.org/debian/pool/main/libg/libgcrypt11/libgcrypt11-dev_1.5.0-5+deb7u3_i386.deb"
fi
elif [[ $(apt-cache search '^libgcrypt11-dev$') ]]; then
# Dependencies: build-deps for netatalk 2.2.4
sudo apt-get -y install libgcrypt11-dev
else
echo "A2SERVER: WARNING: unknown version of libgcrypt-dev is being installed."
# Dependencies: build-deps for netatalk 2.2.4
sudo apt-get -y install $(apt-cache search '^libgcrypt.*dev$' | sort -r | head -1 | cut -d ' ' -f 1)
fi
sudo apt-get clean
@ -276,6 +285,7 @@ if [[ -d /srv/A2SERVER/A2FILES && ! -d /srv/A2SERVER/.a2files ]]; then
sudo /etc/init.d/netatalk stop &> /dev/null
sudo /etc/init.d/samba stop &> /dev/null
if ! command -v getfattr &> /dev/null; then
# Dependency: for ciopfs conversion (setfattr)
sudo apt-get -y install attr &> /dev/null
sudo apt-get clean
fi
@ -328,7 +338,10 @@ sudo sed -i \
if ! command -v ciopfs > /dev/null; then
echo "A2SERVER: Installing ciopfs (case insensitive file system)..."
cd /tmp
# Dependency: For ciopfs
sudo apt-get -y install fuse libglib2.0-0 libattr1 libfuse2
if [[ $isRpi ]]; then
wget -qO- "http://appleii.ivanx.com/a2server/files/ciopfs-rpi.tgz" | sudo tar Pzx
elif [[ $isDebian_x86 ]]; then
@ -346,9 +359,11 @@ if ! command -v ciopfs > /dev/null; then
sudo apt-get -y update
touch /tmp/a2server-packageReposUpdated
fi
sudo apt-get -y install build-essential
sudo apt-get -y install libfuse-dev libglib2.0-dev libattr1-dev
# Dependency: build-dep for ciopfs
sudo apt-get -y install build-essential libfuse-dev libglib2.0-dev libattr1-dev
sudo apt-get -y clean
cd /tmp
rm -rf /tmp/ciopfs &> /dev/null
mkdir /tmp/ciopfs
@ -544,7 +559,10 @@ if [[ ! $(dpkg -l avahi-daemon 2> /dev/null | grep ^ii) || ! $(dpkg -l libnss-md
sudo apt-get -y update
touch /tmp/a2server-packageReposUpdated
fi
# Dependency: Bonjour for netatalk
sudo apt-get -y install avahi-daemon libnss-mdns &> /dev/null
fi
sudo sed -i 's/^\(hosts.*\)$/\1 mdns/' /etc/nsswitch.conf
if [[ ! -f /etc/avahi/services/afpd.service && ! -f /etc/avahi/services/afpd.service_disabled ]]; then

View File

@ -28,6 +28,8 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupWindowsSharing ]]; then
touch /tmp/a2server-packageReposUpdated
fi
# 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
sudo apt-get clean