2015-10-09 12:29:32 +00:00
|
|
|
#! /bin/bash
|
|
|
|
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
2015-10-03 12:25:44 +00:00
|
|
|
|
|
|
|
# download and install a2server tools:
|
|
|
|
# mkatinit, mkvolinfo, afptype, afpsync, aliases, nulib2
|
|
|
|
|
2015-10-04 08:23:53 +00:00
|
|
|
# Ensure URL we'll use ends in a /
|
|
|
|
case "$A2SERVER_SCRIPT_URL" in
|
|
|
|
*/) scriptURL="$A2SERVER_SCRIPT_URL" ;;
|
|
|
|
*) scriptURL="${A2SERVER_SCRIPT_URL:-http://appleii.ivanx.com/a2server}/" ;;
|
|
|
|
esac
|
|
|
|
|
2015-10-03 12:25:44 +00:00
|
|
|
isRpi=
|
|
|
|
[[ -f /usr/bin/raspi-config ]] && isRpi=1
|
|
|
|
|
|
|
|
isDebian=
|
|
|
|
[[ ( -f /etc/debian_version ) && ( $(cut -c 1-2 < /etc/debian_version) == "7." ) && ( $(uname -m) == "i686" ) ]] && isDebian=1
|
|
|
|
|
|
|
|
echo "A2SERVER: Installing A2SERVER tools..."
|
|
|
|
|
|
|
|
if [[ ! -f /usr/local/bin/nulib2 ]]; then
|
|
|
|
|
|
|
|
echo "A2SERVER: Installing nulib2..."
|
|
|
|
|
|
|
|
cd /tmp
|
|
|
|
if [[ $isRpi ]]; then
|
2015-10-04 09:04:52 +00:00
|
|
|
wget -qO- "http://appleii.ivanx.com/a2server/files/nulib2-rpi.tgz" | sudo tar Pzx
|
2015-10-03 12:25:44 +00:00
|
|
|
elif [[ $isDebian ]]; then
|
2015-10-04 09:04:52 +00:00
|
|
|
wget -qO- "http://appleii.ivanx.com/a2server/files/nulib2-debian7_x86.tgz" | sudo tar Pzx
|
2015-10-03 12:25:44 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! -f /usr/local/bin/nulib2 ]]; then
|
|
|
|
|
|
|
|
if [[ ! -f /tmp/a2server-packageReposUpdated ]]; then
|
|
|
|
# prepare for installing packages
|
|
|
|
sudo apt-get -y update
|
|
|
|
touch /tmp/a2server-packageReposUpdated
|
|
|
|
fi
|
|
|
|
|
|
|
|
sudo apt-get -y install build-essential
|
|
|
|
sudo apt-get -y install zlib1g-dev
|
|
|
|
sudo apt-get -y clean
|
|
|
|
cd /tmp
|
|
|
|
rm -rf /tmp/nulib &> /dev/null
|
|
|
|
mkdir /tmp/nulib
|
|
|
|
cd /tmp/nulib
|
|
|
|
wget -q -O nulib.tgz http://web.archive.org/web/20131031160750/http://www.nulib.com/downloads/nulibdist.tar.gz
|
|
|
|
tar zxf nulib.tgz
|
|
|
|
cd nufxlib*
|
|
|
|
./configure
|
|
|
|
make
|
|
|
|
sudo make install
|
|
|
|
cd ../nulib2*
|
|
|
|
./configure
|
|
|
|
make
|
|
|
|
sudo make install
|
|
|
|
cd
|
|
|
|
rm -rf /tmp/nulib
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
echo "A2SERVER: Nulib2 has already been installed."
|
|
|
|
fi
|
|
|
|
|
|
|
|
# download and install The Unarchiver, for expanding Apple disk images
|
|
|
|
# http://wakaba.c3.cx/s/apps/unarchiver.html
|
|
|
|
|
|
|
|
if [[ ! -f /usr/local/bin/unar ]]; then
|
|
|
|
|
|
|
|
echo "A2SERVER: Installing The Unarchiver..."
|
|
|
|
|
|
|
|
if [[ ! -f /tmp/a2server-packageReposUpdated ]]; then
|
|
|
|
# prepare for installing packages
|
|
|
|
sudo apt-get -y update
|
|
|
|
touch /tmp/a2server-packageReposUpdated
|
|
|
|
fi
|
2015-10-06 06:52:43 +00:00
|
|
|
|
2015-10-03 12:25:44 +00:00
|
|
|
if [[ $isRpi || $isDebian ]]; then
|
|
|
|
sudo apt-get -y install libgnustep-base1.22
|
|
|
|
sudo apt-get clean
|
|
|
|
if [[ $isRpi ]]; then
|
2015-10-04 09:04:52 +00:00
|
|
|
wget -qO- "http://appleii.ivanx.com/a2server/files/unar-rpi.tgz" | sudo tar Pzx
|
2015-10-03 12:25:44 +00:00
|
|
|
elif [[ $isDebian ]]; then
|
2015-10-04 09:04:52 +00:00
|
|
|
wget -qO- "http://appleii.ivanx.com/a2server/files/unar-debian7_x86.tgz" | sudo tar Pzx
|
2015-10-03 12:25:44 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [[ ! -f /usr/local/bin/unar ]]; 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
|
|
|
|
sudo apt-get clean
|
|
|
|
rm -rf /tmp/unar &> /dev/null
|
|
|
|
mkdir /tmp/unar
|
|
|
|
cd /tmp/unar
|
|
|
|
wget -qO unar1.7_src.zip http://theunarchiver.googlecode.com/files/unar1.7_src.zip
|
|
|
|
unzip -o unar1.7_src.zip
|
|
|
|
cd The\ Unarchiver/XADMaster
|
|
|
|
make -f Makefile.linux
|
|
|
|
sudo mv lsar unar /usr/local/bin
|
|
|
|
cd ../Extra
|
|
|
|
sudo mv lsar.1 unar.1 /usr/local/man/man1
|
|
|
|
cd
|
|
|
|
rm -rf /tmp/unar
|
|
|
|
fi
|
|
|
|
sudo mandb &> /dev/null
|
|
|
|
else
|
|
|
|
echo "A2SERVER: The Unarchiver has already been installed."
|
|
|
|
fi
|
|
|
|
|
2015-10-04 08:23:53 +00:00
|
|
|
sudo wget -q -O /usr/local/bin/afpsync "${scriptURL}scripts/tools/afpsync.txt"
|
2015-10-03 12:25:44 +00:00
|
|
|
sudo chmod ugo+x /usr/local/bin/afpsync
|
2015-10-04 08:23:53 +00:00
|
|
|
sudo wget -q -O /usr/local/bin/afptype "${scriptURL}scripts/tools/afptype.txt"
|
2015-10-03 12:25:44 +00:00
|
|
|
sudo chmod ugo+x /usr/local/bin/afptype
|
2015-10-04 08:23:53 +00:00
|
|
|
sudo wget -q -O /usr/local/bin/mkatinit "${scriptURL}scripts/tools/mkatinit.txt"
|
2015-10-03 12:25:44 +00:00
|
|
|
sudo chmod ugo+x /usr/local/bin/mkatinit
|
2015-10-04 08:23:53 +00:00
|
|
|
sudo wget -q -O /usr/local/bin/mkvolinfo "${scriptURL}scripts/tools/mkvolinfo.txt"
|
2015-10-03 12:25:44 +00:00
|
|
|
sudo chmod ugo+x /usr/local/bin/mkvolinfo
|
2015-10-04 08:23:53 +00:00
|
|
|
sudo wget -q -O /usr/local/bin/cppo "${scriptURL}scripts/tools/cppo.txt"
|
2015-10-03 12:25:44 +00:00
|
|
|
sudo chmod ugo+x /usr/local/bin/cppo
|
2015-10-04 08:23:53 +00:00
|
|
|
sudo wget -q -O /usr/local/etc/a2server-help.txt "${scriptURL}scripts/tools/a2server-help.txt"
|
|
|
|
sudo wget -q -O /usr/local/etc/a2server-aliases "${scriptURL}scripts/tools/a2server-aliases.txt"
|
2015-10-03 12:25:44 +00:00
|
|
|
|
|
|
|
grep a2server-aliases /etc/bash.bashrc > /dev/null || \
|
|
|
|
echo "source /usr/local/etc/a2server-aliases" | sudo tee -a /etc/bash.bashrc > /dev/null
|
|
|
|
|
|
|
|
[[ $(lsb_release -d 2> /dev/null | grep Ubuntu) ]] && motd="/etc/issue" || motd="/etc/motd"
|
|
|
|
if [[ ! $(grep A2SERVER $motd) ]]; then
|
2015-10-09 12:29:32 +00:00
|
|
|
echo | sudo tee -a $motd > /dev/null
|
|
|
|
echo "Type 'system-shutdown' to turn off A2SERVER." | sudo tee -a $motd > /dev/null
|
|
|
|
echo "Type 'a2server-setup' to configure network boot." | sudo tee -a $motd > /dev/null
|
|
|
|
echo "Type 'a2server-help' for a list of other commands." | sudo tee -a $motd > /dev/null
|
|
|
|
echo | sudo tee -a $motd > /dev/null
|
2015-10-03 12:25:44 +00:00
|
|
|
fi
|