Files
a2cloud/scripts/install_archive_tools
T. Joseph Carter c7818ab379 Yeah, unar's a package, just use Debian's
The Unarchiver for UNIX is available on Debian, Ubuntu, Fedora, and on
macOS under the package name "unar".  It's in Arch Linux as well called
"unarchiver".  What this means is we really have no need whatsoever to
download the source code and compile it, so we won't.

Also made install_archive_tools ignore args it doesn't understand.
2018-05-10 10:26:18 -07:00

124 lines
3.4 KiB
Bash
Executable File

#! /bin/bash
# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh:
# install_archive_tools - temporary script for archive tools from ivan.sh
#
# To the extent possible under law, T. Joseph Carter and Ivan Drucker have
# waived all copyright and related or neighboring rights to the a2cloud
# scripts themselves. Software used or installed by these scripts is subject
# to other licenses. This work is published from the United States.
a2cBinaryURL="http://blocksfree.com/downloads"
# Find the path of our source directory
a2cSource="$( dirname "${BASH_SOURCE[0]}" )/.."
pushd $a2cSource >/dev/null
a2cSource="$PWD"
popd >/dev/null
if [[ ! -f "$a2cSource/.a2cloud_source" ]]; then
printf "\na2cloud: cannot find a2cloud source directory in $a2cSource.\n\n"
exit 1
fi
# Make sure ras2_{os,arch} get set
. "$a2cSource/scripts/system_ident" -q
install_nulib2() {
if ! hash nulib2 2> /dev/null; then
echo "A2CLOUD: Installing nulib2..."
local nulibWork="$(mktemp -d /tmp/nulib.XXXXXXXXXXXX)"
pushd "$nulibWork" >/dev/null
if [[ ! $noPicoPkg ]]; then
### ArchiveTools: Install nulib2 binaries
wget -q "${a2cBinaryURL}/picopkg/nulib2-${ras2_os}_${ras2_arch}.tgz"
if [[ -f "nulib2-${ras2_os}_${ras2_arch}.tgz" ]]; then
sudo tar Pzxf "nulib2-${ras2_os}_${ras2_arch}.tgz"
fi
fi
if ! hash nulib2 2> /dev/null; then
### ArchiveTools: Install nulib2 from source
sudo apt-get -y install build-essential
sudo apt-get -y install zlib1g-dev
sudo apt-get -y clean
# install nulib2
wget -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
fi
popd >/dev/null
rm -rf "$nulibWork"
else
echo "A2CLOUD: nulib2 is already installed."
fi
}
install_sciibin() {
if ! hash sciibin 2> /dev/null; then
### ArchiveTools: Install undoit (sciibin, etc.)
echo "A2CLOUD: Installing sciibin, unblu, unbit, unexec, usq..."
sudo apt-get -y install build-essential unzip
sudo apt-get -y clean
local undoitWork="$(mktemp -d /tmp/undoit.XXXXXXXXXXXX)"
pushd "$undoitWork" >/dev/null
wget -q http://web.archive.org/web/20110619163030/http://fadden.com/dl-apple2/undoit.zip
unzip undoit.zip
make
sudo mv sciibin unbit unblu unexec usq /usr/local/bin
popd >/dev/null
rm -rf "$undoitWork"
else
echo "A2CLOUD: sciibin, unblu, unbit, unexec, usq are already installed."
fi
}
install_shk2image() {
echo "A2CLOUD: Setting up shk2image command..."
### ArchiveTools: Install shk2image command
sudo install -o root -g root -m 755 "$a2cSource/setup/shk2image" /usr/local/bin/shk2image
}
install_unar() {
# Remove locally installed unar if found
if [[ -f /usr/local/bin/unar ]]; then
echo "Removing local unar in favor of the system package"
sudo rm -f /usr/local/bin/lsar
sudo rm -f /usr/local/bin/unar
sudo rm -f /usr/local/man/man1/lsar.1
sudo rm -f /usr/local/man/man1/unar.1
fi
# http://wakaba.c3.cx/s/apps/unarchiver.html
if ! hash unar 2> /dev/null; then
echo "a2cloud: Installing unar (The Unarchiver)..."
sudo apt-get -y install unar
sudo apt-get clean
else
echo "a2cloud: unar has already been installed."
fi
}
noPicoPkg=
while [[ $1 ]]; do
if [[ $1 == -c ]]; then
noPicoPkg=1
fi
shift
done
install_nulib2
install_sciibin
install_shk2image
install_unar