mirror of
https://github.com/RasppleII/a2cloud.git
synced 2025-04-14 11:37:09 +00:00
setup.txt: Change most command -v's to hash
This is a change made in A2SERVER already--the choice between the which, command -v, type, and hash... The problem is that POSIX defines none of these so consistently that you can depend on one of them to work. We happen to use bash specifically, which gives us an advantage in that bash's behavior is well-defined. For us, hash is the best way to find out whether or not a command exists as it turns out. So that's what we'll use.
This commit is contained in:
parent
e57b75c952
commit
6c59cae33b
@ -159,7 +159,7 @@ else
|
||||
installADTPro=
|
||||
echo
|
||||
echo -n "Install ADTPro server, for virtual drives and floppy disk transfers"
|
||||
if ! command -v X >/dev/null; then
|
||||
if ! hash X 2>/dev/null; then
|
||||
echo
|
||||
echo -n "(the X Window System and LXDE desktop environment will be installed)"
|
||||
fi
|
||||
@ -370,11 +370,12 @@ if [[ $installADTPro ]]; then
|
||||
[[ $0 == "-bash" ]] && return 3 || exit 3
|
||||
fi
|
||||
|
||||
if ! command -v X >/dev/null; then
|
||||
if ! hash X 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing X Window System and LXDE..."
|
||||
sudo apt-get -y install xorg lxde
|
||||
sudo apt-get -y clean
|
||||
# prevent automatically running at startup
|
||||
# FIXME: JESSIE/RPI: Not how this is done for systemd/RPi/etc
|
||||
sudo sed -i 's/^GRUB_CMDLINE_LINUX_DEFAULT=.*$/GRUB_CMDLINE_LINUX_DEFAULT="text"/' /etc/default/grub
|
||||
sudo update-grub
|
||||
else
|
||||
@ -516,7 +517,7 @@ if [[ $installADTPro ]]; then
|
||||
[[ ! -f /usr/lib/RXTXcomm.jar ]] && sudo ln -s /usr/share/java/RXTXcomm.jar /usr/lib &> /dev/null
|
||||
[[ ! -d /usr/local/adtpro/lib/rxtx/rxtx-2.2pre2-local/arm ]] && ln -s /usr/lib/jni /usr/local/adtpro/lib/rxtx/rxtx-2.2pre2-local/arm &> /dev/null
|
||||
|
||||
if ! command -v xvfb-run >/dev/null; then
|
||||
if ! hash xvfb-run 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing xvfb for headless operation..."
|
||||
sudo apt-get -y install xvfb
|
||||
sudo apt-get -y clean
|
||||
@ -579,7 +580,7 @@ if [[ $installADTPro ]]; then
|
||||
|
||||
fi
|
||||
|
||||
if command -v X >/dev/null; then
|
||||
if hash X 2>/dev/null; then
|
||||
if dpkg-query -l xrdp; then
|
||||
echo "A2CLOUD: Installing xrdp/tightvncserver..."
|
||||
sudo apt-get -y install xrdp
|
||||
@ -598,7 +599,7 @@ if [[ $setupSerialPortLogin ]]; then
|
||||
sudo sed -i 's/^\(T.*\)ttyAMA0 .* /#\1ttyAMA0 4800 /' /etc/inittab
|
||||
sudo sed -i 's/ttyAMA0,[0-9]*/ttyAMA0,4800/g' /boot/cmdline.txt 2> /dev/null
|
||||
|
||||
if ! command -v screen >/dev/null; then
|
||||
if ! hash screen 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing Screen for multiple terminals..."
|
||||
sudo apt-get -y install screen
|
||||
sudo apt-get -y clean
|
||||
@ -699,7 +700,7 @@ fi
|
||||
|
||||
if [[ $installCommTools ]]; then
|
||||
|
||||
if ! command -v curl >/dev/null; then
|
||||
if ! hash curl 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing curl..."
|
||||
sudo apt-get -y install curl
|
||||
sudo apt-get -y clean
|
||||
@ -707,7 +708,7 @@ if [[ $installCommTools ]]; then
|
||||
echo "A2CLOUD: curl is already installed."
|
||||
fi
|
||||
|
||||
if ! command -v sz >/dev/null; then
|
||||
if ! hash sz 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing rzsz for X/Y/Zmodem transfers..."
|
||||
sudo apt-get -y install lrzsz
|
||||
sudo apt-get -y clean
|
||||
@ -715,7 +716,7 @@ if [[ $installCommTools ]]; then
|
||||
echo "A2CLOUD: rzsz is already installed."
|
||||
fi
|
||||
|
||||
if ! command -v ftp >/dev/null; then
|
||||
if ! hash ftp 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing ftp..."
|
||||
sudo apt-get -y install ftp
|
||||
sudo apt-get -y clean
|
||||
@ -723,7 +724,7 @@ if [[ $installCommTools ]]; then
|
||||
echo "A2CLOUD: ftp is already installed."
|
||||
fi
|
||||
|
||||
if ! command -v cftp >/dev/null; then
|
||||
if ! hash cftp 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing cftp..."
|
||||
cd /tmp/a2cloud-install
|
||||
if [[ $downloadBinaries ]]; then
|
||||
@ -733,7 +734,7 @@ if [[ $installCommTools ]]; then
|
||||
wget -qO- http://appleii.ivanx.com/a2cloud/files/cftp-debian7_x86.tgz | sudo tar Pzx
|
||||
fi
|
||||
fi
|
||||
if ! command -v cftp >/dev/null; then
|
||||
if ! hash cftp 2>/dev/null; then
|
||||
sudo apt-get -y install build-essential
|
||||
sudo apt-get -y install ncurses-dev
|
||||
sudo apt-get -y clean
|
||||
@ -753,7 +754,7 @@ if [[ $installCommTools ]]; then
|
||||
echo "A2CLOUD: cftp is already installed."
|
||||
fi
|
||||
|
||||
if ! command -v lynx >/dev/null; then
|
||||
if ! hash lynx 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing lynx..."
|
||||
sudo apt-get -y install lynx
|
||||
sudo apt-get -y clean
|
||||
@ -761,7 +762,7 @@ if [[ $installCommTools ]]; then
|
||||
echo "A2CLOUD: lynx is already installed."
|
||||
fi
|
||||
|
||||
if ! command -v links >/dev/null; then
|
||||
if ! hash links 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing links..."
|
||||
sudo apt-get -y --force-yes install links
|
||||
sudo apt-get -y clean
|
||||
@ -771,7 +772,7 @@ if [[ $installCommTools ]]; then
|
||||
|
||||
sudo wget -qO /usr/local/bin/a2news ${scriptURL}setup/a2news.txt
|
||||
sudo chmod ugo+x /usr/local/bin/a2news
|
||||
if ! command -v tin >/dev/null; then
|
||||
if ! hash tin 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing a2news/tin..."
|
||||
sudo apt-get -y install tin
|
||||
sudo apt-get -y clean
|
||||
@ -796,7 +797,7 @@ if [[ $installCommTools ]]; then
|
||||
|
||||
sudo wget -qO /usr/local/bin/a2chat ${scriptURL}setup/a2chat.txt
|
||||
sudo chmod ugo+x /usr/local/bin/a2chat
|
||||
if ! command -v irssi >/dev/null; then
|
||||
if ! hash irssi 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing a2chat/irssi..."
|
||||
sudo apt-get -y install irssi
|
||||
sudo apt-get -y clean
|
||||
@ -804,7 +805,7 @@ if [[ $installCommTools ]]; then
|
||||
echo "A2CLOUD: a2chat/irssi is already installed."
|
||||
fi
|
||||
|
||||
if ! command -v telnet >/dev/null; then
|
||||
if ! hash telnet 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing telnet..."
|
||||
sudo apt-get -y install telnet
|
||||
sudo apt-get -y clean
|
||||
@ -814,7 +815,7 @@ if [[ $installCommTools ]]; then
|
||||
|
||||
# Do we need to check for the readline module here as well?
|
||||
#if [[ ( ! -f /usr/bin/ttytter && ! -f /usr/local/bin/ttytter ) || ! -f "/usr/local/share/perl/5.14.2/Term/ReadLine/TTYtter.pm" ]]; then
|
||||
if ! command -v ttyter >/dev/null; then
|
||||
if ! hash ttyter 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing TTYtter..."
|
||||
sudo wget -qO /usr/local/bin/ttytter http://www.floodgap.com/software/ttytter/dist2/2.1.00.txt
|
||||
sudo chmod ugo+x /usr/local/bin/ttytter
|
||||
@ -860,7 +861,7 @@ fi
|
||||
|
||||
if [[ $installEmulators ]]; then
|
||||
|
||||
if [[ -f /usr/local/bin/gsport ]]; then
|
||||
if ! hash gsport 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing GSport..."
|
||||
cd /tmp/a2cloud-install
|
||||
if [[ $downloadBinaries ]]; then
|
||||
@ -870,7 +871,7 @@ if [[ $installEmulators ]]; then
|
||||
wget -qO- http://appleii.ivanx.com/a2cloud/files/gsport-debian7_x86.tgz | sudo tar Pzx 2> /dev/null
|
||||
fi
|
||||
fi
|
||||
if ! command -v gsport >/dev/null; then
|
||||
if ! hash gsport 2>/dev/null; then
|
||||
echo "A2CLOUD: Building GSport from source..."
|
||||
sudo apt-get -y install build-essential &> /dev/null
|
||||
sudo apt-get -y install libx11-dev libxext-dev xfonts-base libpcap0.8-dev &> /dev/null
|
||||
@ -948,7 +949,7 @@ if [[ $installEmulators ]]; then
|
||||
|
||||
|
||||
# LinApple
|
||||
if ! command -v linapple >/dev/null; then
|
||||
if ! hash linapple 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing LinApple..."
|
||||
cd /tmp/a2cloud-install
|
||||
if [[ $downloadBinaries ]]; then
|
||||
@ -958,7 +959,7 @@ if [[ $installEmulators ]]; then
|
||||
wget -qO- http://appleii.ivanx.com/a2cloud/files/linapple-debian7_x86.tgz | sudo tar Pzx
|
||||
fi
|
||||
fi
|
||||
if ! command -v linapple >/dev/null; then
|
||||
if ! hash linapple 2>/dev/null; then
|
||||
sudo apt-get -y install build-essential
|
||||
sudo apt-get -y install libsdl1.2-dev libcurl4-openssl-dev zlib1g-dev libzip-dev
|
||||
sudo apt-get -y clean
|
||||
@ -990,8 +991,7 @@ fi
|
||||
|
||||
if [[ $installArchiveTools ]]; then
|
||||
|
||||
if [[ ! -f /usr/local/bin/nulib2 || ! -f /usr/local/bin/sciibin || ! -f /usr/local/bin/usq ]]; then
|
||||
if ! command -v nulib2 >/dev/null; then
|
||||
if ! hash nulib2 2>/dev/null; then
|
||||
|
||||
echo "A2CLOUD: Installing nulib2..."
|
||||
|
||||
@ -1003,7 +1003,7 @@ if [[ $installArchiveTools ]]; then
|
||||
wget -qO- http://appleii.ivanx.com/a2cloud/files/nulib2-debian7_x86.tgz | sudo tar Pzx
|
||||
fi
|
||||
fi
|
||||
if ! command -v nulib2 >/dev/null; then
|
||||
if ! hash nulib2 2>/dev/null; then
|
||||
sudo apt-get -y install build-essential
|
||||
sudo apt-get -y install zlib1g-dev
|
||||
sudo apt-get -y clean
|
||||
@ -1029,7 +1029,7 @@ if [[ $installArchiveTools ]]; then
|
||||
echo "A2CLOUD: nulib2 is already installed."
|
||||
fi
|
||||
|
||||
if ! command -v sciibin >/dev/null; then
|
||||
if ! hash sciibin 2>/dev/null; then
|
||||
|
||||
echo "A2CLOUD: Installing sciibin, unblu, unbit, unexec, usq..."
|
||||
|
||||
@ -1054,7 +1054,7 @@ if [[ $installArchiveTools ]]; then
|
||||
|
||||
# download and install The Unarchiver, for expanding apple.com disk images
|
||||
# http://wakaba.c3.cx/s/apps/unarchiver.html
|
||||
if ! command -v unar >/dev/null; then
|
||||
if ! hash unar 2>/dev/null; then
|
||||
echo "A2CLOUD: Installing The Unarchiver..."
|
||||
if apt-cache show unar &>/dev/null; then
|
||||
sudo apt-get -y install unar
|
||||
@ -1071,7 +1071,7 @@ if [[ $installArchiveTools ]]; then
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if ! command -v unar >/dev/null; then
|
||||
if ! hash unar 2>/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
|
||||
@ -1098,7 +1098,7 @@ if [[ $installArchiveTools ]]; then
|
||||
fi
|
||||
|
||||
# add shortcuts to LXDE desktop and menu
|
||||
if command -v X >/dev/null; then
|
||||
if hash X 2>/dev/null; then
|
||||
|
||||
[[ -d /etc/xdg/lxsession/LXDE-pi ]] && lxde="lxde-pi" || lxde="lxde"
|
||||
echo "A2CLOUD: Creating LXDE desktop and menu shortcuts..."
|
||||
@ -1253,7 +1253,7 @@ if [[ $a2CloudDisk ]]; then
|
||||
sysutilsBackupURL="http://archive.org/download/download.info.apple.com.2012.11/download.info.apple.com.2012.11.zip/download.info.apple.com%2FApple_Support_Area%2FApple_Software_Updates%2FEnglish-North_American%2FApple_II%2FApple_II_Supplemental%2F"
|
||||
|
||||
# Apple System Utilities 3.1 support files
|
||||
if command -v unar >/dev/null; then
|
||||
if hash unar 2>/dev/null; then
|
||||
echo "A2CLOUD: Downloading and copying System Utilities support files..."
|
||||
cd /tmp/a2cloud-install
|
||||
wget --max-redirect 0 -qO Apple_II_System_Disk_3.2.sea.bin ${sysutilsURL}Apple_II_System_Disk_3.2.sea.bin
|
||||
@ -1323,7 +1323,7 @@ if [[ $a2CloudDisk ]]; then
|
||||
nulib2 -p dsk2file.shk dsk2file58 | acmd -p "$a2CloudDisk" DSK2FILE SYS
|
||||
|
||||
# Apple System Utilities 3.1 launch file
|
||||
if command -v unar >/dev/null; then
|
||||
if hash unar 2>/dev/null; then
|
||||
echo "A2CLOUD: Copying System Utilities launch file..."
|
||||
acmd -g A2SYSDISK32.PO SYSUTIL.SYSTEM - | acmd -p "$a2CloudDisk" SYSUTIL SYS
|
||||
else
|
||||
@ -1466,7 +1466,7 @@ cd "$origDir"
|
||||
rm setup &> /dev/null
|
||||
rm a2cloud-setup &> /dev/null
|
||||
rm -rf /tmp/a2cloud-install &> /dev/null
|
||||
if command -v gsport >/dev/null; then
|
||||
if hash gsport 2>/dev/null; then
|
||||
sudo addgroup gsport &> /dev/null
|
||||
sudo usermod -a -G audio,video,netdev,fuse,gsport,plugdev $USER &> /dev/null
|
||||
[[ ! $noSetGroups ]] && { groups | grep -q 'gsport' || exec sudo su -l $USER; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user