2015-10-30 12:34:48 +00:00
|
|
|
#! /bin/bash
|
2016-10-25 17:42:29 +00:00
|
|
|
# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh:
|
2015-10-30 11:01:52 +00:00
|
|
|
|
2018-06-25 04:48:42 +00:00
|
|
|
# vsd - a2cloud script to change ADTPro virtual disk image symlinks
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2015-10-30 11:01:52 +00:00
|
|
|
skipWarning=
|
|
|
|
drive=
|
|
|
|
if [[ $1 == "-1" || $1 == "-d1" ]]; then
|
2016-10-25 17:42:29 +00:00
|
|
|
shift
|
2015-10-30 11:01:52 +00:00
|
|
|
elif [[ $1 = "-2" || $1 == "-d2" ]]; then
|
2016-10-25 17:42:29 +00:00
|
|
|
drive=2
|
|
|
|
shift
|
2015-10-30 11:01:52 +00:00
|
|
|
fi
|
|
|
|
if [[ ! $1 ]]; then
|
2016-10-25 17:42:29 +00:00
|
|
|
echo "virtual drive $(( drive ? 2 : 1 )): $(readlink /usr/local/adtpro/disks/Virtual${drive}.po)"
|
2015-10-30 11:01:52 +00:00
|
|
|
else
|
2016-10-25 17:42:29 +00:00
|
|
|
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
|
2015-10-30 11:01:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
unset drive
|
|
|
|
unset pwd
|