mirror of
https://github.com/RasppleII/a2cloud.git
synced 2025-03-11 06:29:59 +00:00
Fix indentation and remove dead code
This commit is contained in:
parent
11cf8145da
commit
51d825a2b6
@ -27,10 +27,6 @@ helpExit () {
|
||||
fi
|
||||
echoerr "-c <filename> <imagename> [[$|0x]<type>] [[$|0x]<auxtype>] synonym for -p"
|
||||
echoerr " with filename and imagename reversed."
|
||||
#echoerr "-cd <imagename> <filename> <dateTimeString>|<dateTimeStamp>"
|
||||
#echoerr " set creation date and time of file in ProDOS disk image"
|
||||
#echoerr "-md <imagename> <filename> <dateTimeString>|<dateTimeStamp>"
|
||||
#echoerr " set modified date and time of file in ProDOS disk image"
|
||||
else
|
||||
cat $acmdStdErr
|
||||
fi
|
||||
|
@ -97,14 +97,12 @@ def pdosDateToUnixDate(arg1):
|
||||
day = binToDec(slyce(arg1,11,5))
|
||||
hour = binToDec(slyce(arg1,19,5))
|
||||
minute = binToDec(slyce(arg1,26,6))
|
||||
# print(year, month, day, hour, minute)
|
||||
td = (datetime.datetime(year, month, day, hour, minute) -
|
||||
datetime.datetime(1970,1,1))
|
||||
unixDate_naive = (td.days*24*60*60 + td.seconds)
|
||||
td2 = (datetime.datetime.fromtimestamp(unixDate_naive) -
|
||||
datetime.datetime.utcfromtimestamp(unixDate_naive))
|
||||
utcoffset = (td2.days*24*60*60 + td2.seconds)
|
||||
# print(unixDate_naive - utcoffset)
|
||||
return (unixDate_naive - utcoffset) # local time zone with DST
|
||||
|
||||
def unixDateToADDate(arg1):
|
||||
@ -115,7 +113,6 @@ def unixDateToADDate(arg1):
|
||||
if (adDate < 0 ):
|
||||
adDate += 4294967296 # to get negative hex number
|
||||
adDateHex = to_hex(adDate).zfill(8).upper()
|
||||
# print(arg1, adDate, adDateHex)
|
||||
return adDateHex
|
||||
|
||||
# cppo support functions:
|
||||
@ -260,7 +257,6 @@ def getFileLength(arg1, arg2):
|
||||
pos = ts(prevTSpair)
|
||||
# now find out where the file really ends by finding the last 00
|
||||
for offset in range(255, -1, -1):
|
||||
#print("pos: " + to_hex(pos))
|
||||
if (readcharDec(g.imageData, pos+offset) != 0):
|
||||
fileSize += (offset + 1)
|
||||
break
|
||||
@ -345,8 +341,6 @@ def getWorkingDirName(arg1, arg2=None):
|
||||
def getDirEntryCount(arg1):
|
||||
if g.D33:
|
||||
entryCount = 0
|
||||
#nextSector = [readcharDec(g.imageData, ts(arg1)+1),
|
||||
# readcharDec(g.imageData, ts(arg1)+2)]
|
||||
nextSector = arg1
|
||||
while True:
|
||||
top = ts(nextSector)
|
||||
@ -445,7 +439,6 @@ def copyBlock(arg1, arg2):
|
||||
#arg1: block number or [t,s] to copy
|
||||
#arg2: bytes to write (should be 256 (DOS 3.3) or 512 (ProDOS),
|
||||
# unless final block with less)
|
||||
#print(arg1 + " " + arg2 + " " + g.activeFileBytesCopied)
|
||||
if (arg1 == 0):
|
||||
outBytes = (b'\x00' * arg2)
|
||||
else:
|
||||
@ -498,19 +491,14 @@ def processDir(arg1, arg2=None, arg3=None, arg4=None, arg5=None):
|
||||
g.PDOSPATH_SEGMENT = g.PDOSPATH[g.PDOSPATH_INDEX]
|
||||
else:
|
||||
pass
|
||||
# print(g.DIRPATH)
|
||||
while (pe < entryCount):
|
||||
if (getStorageType(arg1, e) > 0):
|
||||
#print(pe, e, entryCount)
|
||||
processEntry(arg1, e)
|
||||
pe += 1
|
||||
e += 1
|
||||
if not ((e + (0 if g.D33 else (e>11)) ) % (7 if g.D33 else 13)):
|
||||
processDir(getDirNextChunkPointer(arg1),
|
||||
entryCount,
|
||||
e,
|
||||
workingDirName,
|
||||
pe)
|
||||
entryCount, e, workingDirName, pe)
|
||||
break
|
||||
|
||||
def processEntry(arg1, arg2):
|
||||
@ -589,7 +577,6 @@ def processEntry(arg1, arg2):
|
||||
eTargetName = (g.targetName + "#" +
|
||||
getFileType(arg1, arg2).lower() +
|
||||
getAuxType(arg1, arg2).lower())
|
||||
# touch(g.targetDir + "/" + g.targetName)
|
||||
if g.AD:
|
||||
makeADfile()
|
||||
copyFile(arg1, arg2)
|
||||
@ -609,16 +596,14 @@ def processEntry(arg1, arg2):
|
||||
if g.AD: # AppleDouble
|
||||
# set dates
|
||||
ADfilePath = (g.ADdir + "/" + g.targetName)
|
||||
writecharsHex(g.exFileData,
|
||||
637,
|
||||
writecharsHex(g.exFileData, 637,
|
||||
(unixDateToADDate(creationDate) +
|
||||
unixDateToADDate(modifiedDate)))
|
||||
writecharHex(g.exFileData, 645, "80")
|
||||
writecharHex(g.exFileData, 649, "80")
|
||||
#set type/creator
|
||||
writechars(g.exFileData, 653, b'p')
|
||||
writecharsHex(g.exFileData,
|
||||
654,
|
||||
writecharsHex(g.exFileData, 654,
|
||||
getFileType(arg1, arg2) +
|
||||
getAuxType(arg1, arg2))
|
||||
writechars(g.exFileData, 657, b'pdos')
|
||||
@ -633,8 +618,6 @@ def processEntry(arg1, arg2):
|
||||
(g.extractFile.lower() == origFileName.lower()))):
|
||||
quitNow(0)
|
||||
g.targetName = None
|
||||
#else:
|
||||
#print(g.activeFileName + " doesn't match " + g.PDOSPATH_SEGMENT)
|
||||
|
||||
def processForkedFile(arg1):
|
||||
# finder info except type/creator
|
||||
@ -653,7 +636,6 @@ def processForkedFile(arg1):
|
||||
g.resourceFork = f
|
||||
g.activeFileBytesCopied = 0
|
||||
forkStart = (arg1 * 512) # start of Forked File key block
|
||||
# print("--" + forkStart)
|
||||
forkStorageType = readcharDec(g.imageData, forkStart+f+0)
|
||||
forkKeyPointer = (readcharDec(g.imageData, forkStart+f+1) +
|
||||
readcharDec(g.imageData, forkStart+f+2)*256)
|
||||
@ -665,7 +647,6 @@ def processForkedFile(arg1):
|
||||
rsrcForkLenHex = (readcharHex(g.imageData, forkStart+f+7) +
|
||||
readcharHex(g.imageData, forkStart+f+6) +
|
||||
readcharHex(g.imageData, forkStart+f+5))
|
||||
# print(">>>" + rsrcForkLenHex)
|
||||
if (g.AD or g.EX):
|
||||
print(" [resource fork]")
|
||||
if g.AD:
|
||||
@ -678,7 +659,6 @@ def processForkedFile(arg1):
|
||||
processIndexBlock(forkKeyPointer)
|
||||
elif (forkStorageType == 3): #tree
|
||||
processMasterIndexBlock(forkKeyPointer)
|
||||
# print()
|
||||
g.resourceFork = 0
|
||||
|
||||
def processMasterIndexBlock(arg1):
|
||||
@ -693,7 +673,6 @@ def processIndexBlock(arg1, arg2=False):
|
||||
if g.D33:
|
||||
targetTS = [readcharDec(g.imageData, ts(arg1)+pos+0),
|
||||
readcharDec(g.imageData, ts(arg1)+pos+1)]
|
||||
#print(to_hex(targetTS[0]),to_hex(targetTS[1]))
|
||||
bytesRemaining = (g.activeFileSize - g.activeFileBytesCopied)
|
||||
bs = (bytesRemaining if (bytesRemaining < 256) else 256)
|
||||
copyBlock(targetTS, bs)
|
||||
@ -1033,7 +1012,6 @@ def get_object_names(cls, include_subclasses=True):
|
||||
|
||||
def touch(filePath, modTime=None):
|
||||
# http://stackoverflow.com/questions/1158076/implement-touch-using-python
|
||||
# print(filePath)
|
||||
import os
|
||||
if (os.name == "nt"):
|
||||
if filePath[-1] == ".": filePath += "-"
|
||||
@ -1206,8 +1184,7 @@ if g.SHK:
|
||||
"else if grep -q \"no records match\" <<< \"$result\"" +
|
||||
" > /dev/null; then exit 2; else exit 0; fi; fi'")
|
||||
if (result == 512):
|
||||
print(
|
||||
"File not found in ShrinkIt archive. Try cppo -cat to get the path,")
|
||||
print("File not found in ShrinkIt archive. Try cppo -cat to get the path,")
|
||||
print(" and omit any leading slash or colon.")
|
||||
quitNow(1)
|
||||
elif (result != 0):
|
||||
@ -1294,44 +1271,31 @@ if (g.imageFile.lower().endswith(".2mg") or
|
||||
|
||||
# handle 140K disk image
|
||||
if (len(g.imageData) == 143360):
|
||||
#print("140K disk")
|
||||
prodosDisk = 0
|
||||
fixOrder = 0
|
||||
# is it ProDOS?
|
||||
if (to_hex(readchars(g.imageData, ts(0,0)+0, 4)) == '0138b003'):
|
||||
#print("detected ProDOS by boot block")
|
||||
if (readchars(g.imageData, ts(0,1)+3, 6) == b'PRODOS'):
|
||||
prodosDisk = 1
|
||||
#print("order OK (PO)")
|
||||
elif (readchars(g.imageData, ts(0,14)+3, 6) == b'PRODOS'):
|
||||
#print("order needs fixing (DO)")
|
||||
prodosDisk = 1
|
||||
fixOrder = 1
|
||||
# is it DOS 3.3?
|
||||
else:
|
||||
#print("it's not ProDOS")
|
||||
if (readcharDec(g.imageData, ts(17,0)+3) == 3):
|
||||
vtocT = readcharDec(g.imageData, ts(17,0)+1)
|
||||
vtocS = readcharDec(g.imageData, ts(17,0)+2)
|
||||
if (vtocT<35 and vtocS<16):
|
||||
#print("it's DOS 3.3")
|
||||
g.D33 = 1
|
||||
# it's DOS 3.3; check sector order next
|
||||
if (readcharDec(g.imageData, ts(17,14)+2) != 13):
|
||||
#print("order needs fixing (PO)")
|
||||
fixOrder = 1
|
||||
#else: # remove this
|
||||
# print("order OK (DO)")
|
||||
# pass
|
||||
# fall back on disk extension if weird boot block (e.g. AppleCommander)
|
||||
if not prodosDisk and not g.D33:
|
||||
#print("format and ordering unknown, checking extension")
|
||||
if (g.imageFile.lower().endswith(".dsk") or
|
||||
g.imageFile.lower().endswith(".do")):
|
||||
fixOrder = 1
|
||||
# print("extension indicates DO, changing to PO")
|
||||
if fixOrder:
|
||||
#print("fixing order")
|
||||
# for each track,
|
||||
# read each sector in the right sequence to make
|
||||
# valid ProDOS blocks (sector pairs)
|
||||
@ -1342,9 +1306,6 @@ if (len(g.imageData) == 143360):
|
||||
ts(t,((15-s) if (s%15) else s)),
|
||||
readchars(g.imageData, ts(t,s), 256))
|
||||
g.imageData = bytes(imageDataFixed)
|
||||
#print("saving fixed order file as outfile.dsk")
|
||||
#saveFile("outfile.dsk", g.imageData)
|
||||
#print("saved")
|
||||
|
||||
if not prodosDisk and not g.D33:
|
||||
print("Warning: Unable to determine disk format, assuming ProDOS.")
|
||||
@ -1404,7 +1365,6 @@ if g.extractFile:
|
||||
quitNow(2)
|
||||
else:
|
||||
if not g.CAT:
|
||||
# print(args[0], args[1], args[2])
|
||||
g.targetDir = (args[2] + "/" + getVolumeName().decode("L1"))
|
||||
g.ADdir = (g.targetDir + "/.AppleDouble")
|
||||
if not os.path.isdir(g.targetDir):
|
||||
|
@ -452,18 +452,6 @@ if [[ ! -f $imagesDir/INSTALL.HDV ]] \
|
||||
|| [[ ! -f $imagesDir/"$gsosHD" ]] \
|
||||
|| [[ ! $kegs && ! -f $imagesDir/spectrum.hdv ]]; then
|
||||
|
||||
# if [[ ! $autoAnswerYes ]]; then
|
||||
# echo
|
||||
# echo -n "Do you want to download the GS/OS installer disks"
|
||||
# if [[ ! -f $imagesDir/"$gsosHD" ]]; then
|
||||
# echo -n -e "\nand create a hard disk image file"
|
||||
# fi
|
||||
# if [[ ! $kegs && -f /usr/local/bin/acmd && ! -f $imagesDir/spectrum.hdv ]]; then
|
||||
# echo -n -e "\nand download Spectrum communications software"
|
||||
# fi
|
||||
# echo -n "? "
|
||||
# read
|
||||
# fi
|
||||
REPLY="y"
|
||||
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
|
||||
|
||||
@ -513,7 +501,6 @@ if [[ ! -f $imagesDir/INSTALL.HDV ]] \
|
||||
|
||||
echo "Copying ProDOS..."
|
||||
acmd -g "$imagesDir/INSTALL.HDV" PRODOS "PRODOS#ff0000"
|
||||
#writecharsHex "PRODOS#ff0000" 0 "4C.00.C5.00"
|
||||
wget -qO- ${binaryURL}${emulatorName}SPLASH.SYS | dd of="PRODOS#ff0000" conv=notrunc &> /dev/null
|
||||
echo "Copying Teach..."
|
||||
cppo -uc -e $imagesDir/SYSTEMTOOLS2.HDV /SYSTEMTOOLS2/TEACH . &> /dev/null
|
||||
@ -529,8 +516,6 @@ if [[ ! -f $imagesDir/INSTALL.HDV ]] \
|
||||
acmd -n $imagesDir/"$gsosHD" $gsosHDvolName
|
||||
dd bs=512 count=1 conv=notrunc if="$imagesDir/INSTALL.HDV" of="$imagesDir/$gsosHD" 2> /dev/null
|
||||
sudo chmod ugo+rw $imagesDir/"$gsosHD"
|
||||
#acmd -p "$imagesDir/$gsosHD" PRODOS SYS < $tempDir/PRODOS
|
||||
#rm $tempDir/PRODOS
|
||||
fi
|
||||
echo 4
|
||||
if [[ $(grep ^s7d1 /usr/local/lib/$configFileName) ]]; then
|
||||
|
@ -95,9 +95,6 @@ while [[ $1 ]]; do
|
||||
elif [[ $1 == "-6" ]]; then
|
||||
shift
|
||||
slot6=1
|
||||
# elif [[ $1 == "-os" || $1 == "os" ]]; then
|
||||
# shift
|
||||
# updateRasppleII=1
|
||||
elif [[ $1 == "-v" ]]; then
|
||||
shift
|
||||
# Version was already printed
|
||||
@ -121,14 +118,6 @@ while [[ $1 ]]; do
|
||||
fi
|
||||
done
|
||||
|
||||
### RaspbianUpdate
|
||||
#if [[ $updateRasppleII ]]; then
|
||||
# echo "A2CLOUD: Updating Raspple II (takes up to an hour)..."
|
||||
# wget -qO /tmp/raspbian-update ${scriptURL}setup/raspbian-update.txt
|
||||
# source /tmp/raspbian-update a2cloud a2server $autoAnswerYes $skipRepoUpdate
|
||||
# [[ $0 == "-bash" ]] && return 0 || exit 0
|
||||
#fi
|
||||
|
||||
echo
|
||||
echo "Your $fullme will be set up for A2CLOUD, providing you"
|
||||
echo " with mass storage and online access for your Apple II!"
|
||||
@ -149,15 +138,6 @@ if [[ ! $autoAnswerYes ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
#echo
|
||||
#installAllFeatures=
|
||||
#if [[ ! $autoAnswerYes ]]; then
|
||||
# ### Q: Install all features?
|
||||
# echo
|
||||
# echo -n "Do you want to install all A2CLOUD features? "
|
||||
# read
|
||||
#fi
|
||||
#[[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]] && installAllFeatures=1
|
||||
installAllFeatures=1 # as of 1.9.0
|
||||
|
||||
if [[ $installAllFeatures ]]; then
|
||||
@ -438,30 +418,6 @@ if [[ $installADTPro ]]; then
|
||||
echo "A2CLOUD: can't disable GUI at startup: unrecognized init system."
|
||||
fi
|
||||
|
||||
# ### A2CLOUD: Setup VirtualBox resolution
|
||||
# ### FIXME: This doesn't appear to work in Jessie
|
||||
# if lspci 2> /dev/null | grep -q VirtualBox; then
|
||||
# if ! grep -q default /etc/xdg/lxsession/LXDE/autostart; then
|
||||
# echo "A2CLOUD: Setting desktop to 800x600 in VirtualBox console (no Additions)..."
|
||||
# echo -e "\nxrandr --output default --mode 800x600" | sudo tee -a /etc/xdg/lxsession/LXDE/autostart > /dev/null
|
||||
# else
|
||||
# echo "A2CLOUD: Desktop already set to 800x600 in VirtualBox console (no Additions)."
|
||||
# fi
|
||||
# if ! grep -q VBOX0 /etc/xdg/lxsession/LXDE/autostart; then
|
||||
# echo "A2CLOUD: Setting desktop to 800x600 in VirtualBox console (with Additions)..."
|
||||
# echo -e "\nxrandr --output VBOX0 --mode 800x600" | sudo tee -a /etc/xdg/lxsession/LXDE/autostart > /dev/null
|
||||
# else
|
||||
# echo "A2CLOUD: Desktop already set to 800x600 in VirtualBox console (with Additions)."
|
||||
# fi
|
||||
# echo "A2CLOUD: Disabling screensaver and screen blanking in VirtualBox LXDE..."
|
||||
# sudo sed -i 's/^\(@xscreensaver.*\)$/#\1\n\nxset s noblank\nxset s off\nxset -dpms\n/' /etc/xdg/lxsession/LXDE/autostart
|
||||
# fi
|
||||
# ### A2CLOUD: Clean up after old version on RPi
|
||||
# if [[ $isRpi ]]; then
|
||||
# sudo sed -i 's/^.*VBOX0.*$//' /etc/xdg/lxsession/LXDE/autostart 2> /dev/null
|
||||
# sudo sed -i 's/^.*VBOX0.*$//' /etc/xdg/lxsession/LXDE-pi/autostart 2> /dev/null
|
||||
# fi
|
||||
|
||||
# install or update java
|
||||
javaVersion=$(java -version 2>&1)
|
||||
if [[ ( $? -eq 127 ) || ( $(head -1 <<< "$javaVersion" | cut -f 2 -d '.') -lt 8 ) ]]; then
|
||||
@ -513,7 +469,7 @@ if [[ $installADTPro ]]; then
|
||||
sudo rm /usr/local/adtpro/disks/VDRIVE*.DSK &> /dev/null
|
||||
sudo rm -r /tmp/a2cloud-install/disks &> /dev/null
|
||||
sudo mv /usr/local/adtpro/disks /tmp/a2cloud-install
|
||||
sudo rm -r /usr/local/adtpro/ac.bat \
|
||||
sudo rm -rf /usr/local/adtpro/ac.bat \
|
||||
/usr/local/adtpro/ac.sh \
|
||||
/usr/local/adtpro/adtpro.bat \
|
||||
/usr/local/adtpro/adtpro.cmd \
|
||||
@ -940,12 +896,9 @@ if [[ $installCommTools ]]; then
|
||||
|
||||
### CommTools: Install Oysttyer (formerly TTYtter)
|
||||
# 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
|
||||
perlVersion=$(perl -e 'print $^V' | cut -c 2-)
|
||||
if ! hash ttytter 2> /dev/null || [[ ! -f /usr/local/share/perl/${perlVersion}/Term/ReadLine/TTYtter.pm ]]; then
|
||||
echo "A2CLOUD: Installing Oysttyer..."
|
||||
# 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
|
||||
wget -qO- https://github.com/oysttyer/oysttyer/archive/2.7.2.tar.gz | sudo tar -zxP --transform 's|oysttyer-2.7.2/oysttyer.pl|/usr/local/bin/oysttyer|' oysttyer-2.7.2/oysttyer.pl
|
||||
sudo rm /usr/local/bin/ttytter 2> /dev/null
|
||||
sudo ln -s /usr/local/bin/oysttyer /usr/local/bin/ttytter
|
||||
@ -1128,12 +1081,6 @@ if [[ $installEmulators ]]; then
|
||||
wget -q -O linapple_src-2b.tar.bz2 http://downloads.sourceforge.net/project/linapple/linapple/linapple_2b/linapple_src-2b.tar.bz2
|
||||
tar jxf linapple_src-2b.tar.bz2
|
||||
cd linapple_src-2b/src
|
||||
# doesn't compile with gcc 4.7, so use 4.6 -- needed for linapple 2a
|
||||
#if (( $(g++ --version | head -1 | rev | cut -f 1 -d ' ' | rev | tr -d '.') >= 470 )); then
|
||||
# sudo apt-get -y install g++-4.6
|
||||
# sudo apt-get -y clean
|
||||
# sed -i 's@CXX ?= c++@CXX = /usr/bin/g++-4.6@' Makefile
|
||||
#fi
|
||||
make
|
||||
sudo make install
|
||||
cd /tmp/a2cloud-install
|
||||
|
@ -7,7 +7,6 @@ pkill -f "sleep 86399"
|
||||
|
||||
if [[ $(grep -e '-scanttyUSB' <<< "$*") ]]; then
|
||||
# called with -scantty isntead of device name?
|
||||
# echo "-scantty mode"
|
||||
|
||||
# if upper USB port
|
||||
if [[ -c /dev/ttyUSBupper ]]; then
|
||||
@ -23,17 +22,13 @@ if [[ $(grep -e '-scanttyUSB' <<< "$*") ]]; then
|
||||
|
||||
# no port found eligible for getty
|
||||
else
|
||||
# echo "scantty no devices eligible: sleeping"
|
||||
sleep 86399
|
||||
fi
|
||||
|
||||
# echo "result:$ttyUSB"
|
||||
elif [[ $(grep -o 'ttyUSB[^ ]*' <<< "$*") ]]; then
|
||||
# echo "device specified"
|
||||
# if specified USB device name is found
|
||||
ttyUSB=$(grep -o 'ttyUSB[^ ]*' <<< "$*")
|
||||
else
|
||||
# echo "specified device failed: sleeping"
|
||||
sleep 86399
|
||||
fi
|
||||
|
||||
@ -43,6 +38,5 @@ if [[ -c /dev/$ttyUSB && ! $(ps aux | grep "[g]etty.*$ttyUSB") ]]; then
|
||||
pkill -f "/sbin/getty.*ttyUSB"
|
||||
exec /sbin/getty $(sed "s/-scanttyUSB/$ttyUSB/" <<< "$@");
|
||||
else
|
||||
# echo "getty already running or doesn't exist: sleeping"
|
||||
sleep 86399
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user