From 3e5367e4f3e4b8620fcb2b5d37f379dc784e4bae Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Fri, 30 Oct 2015 04:01:52 -0700 Subject: [PATCH] Add vsd.sh to source tree --- setup/vsd.txt | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 setup/vsd.txt diff --git a/setup/vsd.txt b/setup/vsd.txt new file mode 100644 index 0000000..1fff799 --- /dev/null +++ b/setup/vsd.txt @@ -0,0 +1,42 @@ +#!/bin/bash + +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