a2cloud/setup/vsd
T. Joseph Carter a3d67123cc Removed a2cScriptURL and renmaed .txt from scripts
Replaced downloading scripts and files from a2cScriptURL with
installation from the source tree.  This obsoletes a2cScriptURL, so it's
been removed.

It made sense to remove the .txt from the script names since I was
rewriting the lines that use them anyway.
2018-04-22 14:44:27 -07:00

44 lines
1.3 KiB
Bash
Executable File

#! /bin/bash
# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh:
skipWarning=
drive=
if [[ $1 == "-1" || $1 == "-d1" ]]; then
shift
elif [[ $1 = "-2" || $1 == "-d2" ]]; then
drive=2
shift
fi
if [[ ! $1 ]]; then
echo "virtual drive $(( drive ? 2 : 1 )): $(readlink /usr/local/adtpro/disks/Virtual${drive}.po)"
else
if [[ $1 == "-f" ]]; then
shift
skipWarning=1
fi
if [[ ! -f $1 ]]; then
echo "Image file '$1' was not found."
elif [[ -f /usr/local/adtpro/disks/Virtual${drive}.po && ! -L /usr/local/adtpro/disks/Virtual${drive}.po ]]; then
echo "/usr/local/adtpro/disks/Virtual${drive}.po is an actual disk image"
echo "file, not a symbolic link. Please move or rename it, and try again."
else
rm /usr/local/adtpro/disks/Virtual${drive}.po &>/dev/null;
[[ ${1:0:1} != "/" ]] && pwd="$PWD/";
ln -s "$pwd$1" /usr/local/adtpro/disks/Virtual${drive}.po
[[ $drive ]] && VSD2="$pwd$1" || VSD1="$pwd$1"
if [[ $(ps aux | grep [A]DTPro) ]]; then
if [[ ! $skipWarning ]]; then
echo "Please make sure you're not writing to either virtual drive on your Apple II."
echo -n " Press return when ready, or control-C to cancel..."
read
fi
sudo pkill -f [A]DTPro
while [[ $(ps aux | grep [A]DTPro) ]]; do sleep 1; done
/usr/local/bin/adtpro-start
fi
fi
fi
unset drive
unset pwd