mirror of
https://github.com/RasppleII/a2cloud.git
synced 2025-03-10 15:30:08 +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
|
||||
|
162
setup/cppo.txt
162
setup/cppo.txt
@ -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))
|
||||
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))
|
||||
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:
|
||||
@ -161,7 +158,7 @@ def getFileName(arg1, arg2):
|
||||
def getCaseMask(arg1, arg2):
|
||||
start = getStartPos(arg1, arg2)
|
||||
caseMaskDec = (readcharDec(g.imageData, start+28) +
|
||||
readcharDec(g.imageData, start+29)*256)
|
||||
readcharDec(g.imageData, start+29)*256)
|
||||
if (caseMaskDec < 32768):
|
||||
return None
|
||||
else:
|
||||
@ -189,7 +186,7 @@ def getAuxType(arg1, arg2):
|
||||
if (fileType == '06'): # BIN (B)
|
||||
# file address is in first two bytes of file data
|
||||
fileTSlist = [readcharDec(g.imageData, start+0),
|
||||
readcharDec(g.imageData, start+1)]
|
||||
readcharDec(g.imageData, start+1)]
|
||||
fileStart = [readcharDec(g.imageData, ts(fileTSlist)+12),
|
||||
readcharDec(g.imageData, ts(fileTSlist)+13)]
|
||||
return (readcharHex(g.imageData, ts(fileStart)+1) +
|
||||
@ -218,7 +215,7 @@ def getFileLength(arg1, arg2):
|
||||
if g.D33:
|
||||
fileType = getFileType(arg1, arg2)
|
||||
fileTSlist = [readcharDec(g.imageData, start+0),
|
||||
readcharDec(g.imageData, start+1)]
|
||||
readcharDec(g.imageData, start+1)]
|
||||
fileStart = [readcharDec(g.imageData, ts(fileTSlist)+12),
|
||||
readcharDec(g.imageData, ts(fileTSlist)+13)]
|
||||
if (fileType == '06'): # BIN (B)
|
||||
@ -241,10 +238,10 @@ def getFileLength(arg1, arg2):
|
||||
pos = ts(nextTSlistSector)
|
||||
for tsPos in range(12, 256, 2):
|
||||
if ts(readcharDec(g.imageData, pos+tsPos+0),
|
||||
readcharDec(g.imageData, pos+tsPos+1)) != 0:
|
||||
readcharDec(g.imageData, pos+tsPos+1)) != 0:
|
||||
fileSize += 256
|
||||
prevTSpair = [readcharDec(g.imageData, (pos+tsPos)+0),
|
||||
readcharDec(g.imageData, (pos+tsPos)+1)]
|
||||
readcharDec(g.imageData, (pos+tsPos)+1)]
|
||||
else:
|
||||
lastTSpair = prevTSpair
|
||||
endFound = True
|
||||
@ -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
|
||||
@ -297,9 +293,9 @@ def getModifiedDate(arg1, arg2):
|
||||
|
||||
if g.SHK:
|
||||
modifiedDate = int(time.mktime(
|
||||
time.strptime(
|
||||
time.ctime(
|
||||
os.path.getmtime(os.path.join(arg1, arg2))))))
|
||||
time.strptime(
|
||||
time.ctime(
|
||||
os.path.getmtime(os.path.join(arg1, arg2))))))
|
||||
rVal = modifiedDate
|
||||
elif g.D33:
|
||||
rVal = None
|
||||
@ -327,7 +323,7 @@ def getWorkingDirName(arg1, arg2=None):
|
||||
workingDirName = readchars(g.imageData, start+5, nameLength)
|
||||
if (entryType == 15): # volume directory, get casemask from header
|
||||
caseMaskDec = (readcharDec(g.imageData, start+26) +
|
||||
readcharDec(g.imageData, start+27)*256)
|
||||
readcharDec(g.imageData, start+27)*256)
|
||||
if (caseMaskDec < 32768):
|
||||
caseMask = None
|
||||
else:
|
||||
@ -338,15 +334,13 @@ def getWorkingDirName(arg1, arg2=None):
|
||||
for i in range(0, len(workingDirName)):
|
||||
if (caseMask[i] == "1"):
|
||||
workingDirName = (workingDirName[:i] +
|
||||
workingDirName[i:i+1].lower() +
|
||||
workingDirName[i+1:])
|
||||
workingDirName[i:i+1].lower() +
|
||||
workingDirName[i+1:])
|
||||
return workingDirName
|
||||
|
||||
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)
|
||||
@ -359,7 +353,7 @@ def getDirEntryCount(arg1):
|
||||
entryCount += 1 # increment if not deleted file
|
||||
pos += 35
|
||||
nextSector = [readcharDec(g.imageData, top+1),
|
||||
readcharDec(g.imageData, top+2)]
|
||||
readcharDec(g.imageData, top+2)]
|
||||
if (nextSector[0]+nextSector[1] == 0): # no more catalog sectors
|
||||
return entryCount
|
||||
else: # ProDOS
|
||||
@ -438,14 +432,13 @@ def copyFile(arg1, arg2):
|
||||
if (getFileType(arg1, arg2) == '06'):
|
||||
g.outFileData = g.outFileData[4:]
|
||||
elif ((getFileType(arg1, arg2) == 'FA') or
|
||||
getFileType(arg1, arg2) == 'FC'):
|
||||
getFileType(arg1, arg2) == 'FC'):
|
||||
g.outFileData = g.outFileData[2:]
|
||||
|
||||
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:
|
||||
@ -490,7 +483,7 @@ def processDir(arg1, arg2=None, arg3=None, arg4=None, arg5=None):
|
||||
if g.PDOSPATH_INDEX:
|
||||
if (g.PDOSPATH_INDEX == 1):
|
||||
if (("/" + g.PDOSPATH_SEGMENT.lower()) !=
|
||||
g.DIRPATH.lower()):
|
||||
g.DIRPATH.lower()):
|
||||
print("ProDOS volume name does not match disk image.")
|
||||
quitNow(2)
|
||||
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):
|
||||
@ -519,9 +507,9 @@ def processEntry(arg1, arg2):
|
||||
|
||||
'''
|
||||
print(getFileName(arg1, arg2), getStorageType(arg1, arg2),
|
||||
getFileType(arg1, arg2), getKeyPointer(arg1, arg2),
|
||||
getFileLength(arg1, arg2), getAuxType(arg1, arg2),
|
||||
getCreationDate(arg1, arg2), getModifiedDate(arg1, arg2))
|
||||
getFileType(arg1, arg2), getKeyPointer(arg1, arg2),
|
||||
getFileLength(arg1, arg2), getAuxType(arg1, arg2),
|
||||
getCreationDate(arg1, arg2), getModifiedDate(arg1, arg2))
|
||||
'''
|
||||
|
||||
eTargetName = None
|
||||
@ -568,16 +556,16 @@ def processEntry(arg1, arg2):
|
||||
if ("/".join(dirName.split('/')[3:])):
|
||||
dirPrint = ("/".join(dirName.split('/')[3:]) + "/")
|
||||
if (not g.extractFile or
|
||||
(os.path.basename(g.extractFile.lower()) ==
|
||||
(os.path.basename(g.extractFile.lower()) ==
|
||||
origFileName.split('#')[0].lower())):
|
||||
filePrint = g.activeFileName.split("#")[0]
|
||||
print(dirPrint + filePrint +
|
||||
("+" if (g.shk_hasrf or
|
||||
(not g.SHK and getStorageType(arg1, arg2) == 5))
|
||||
else "") +
|
||||
else "") +
|
||||
((" [" + origFileName + "] ")
|
||||
if (g.PNAME and (origFileName != g.activeFileName))
|
||||
else ""))
|
||||
if (g.PNAME and (origFileName != g.activeFileName))
|
||||
else ""))
|
||||
if g.CAT:
|
||||
return
|
||||
if not g.targetName:
|
||||
@ -587,14 +575,13 @@ def processEntry(arg1, arg2):
|
||||
eTargetName = arg2
|
||||
else: # ProDOS image
|
||||
eTargetName = (g.targetName + "#" +
|
||||
getFileType(arg1, arg2).lower() +
|
||||
getAuxType(arg1, arg2).lower())
|
||||
# touch(g.targetDir + "/" + g.targetName)
|
||||
getFileType(arg1, arg2).lower() +
|
||||
getAuxType(arg1, arg2).lower())
|
||||
if g.AD:
|
||||
makeADfile()
|
||||
copyFile(arg1, arg2)
|
||||
saveName = (g.targetDir + "/" +
|
||||
(eTargetName if eTargetName else g.targetName))
|
||||
(eTargetName if eTargetName else g.targetName))
|
||||
saveFile(saveName, g.outFileData)
|
||||
creationDate = getCreationDate(arg1, arg2)
|
||||
modifiedDate = getModifiedDate(arg1, arg2)
|
||||
@ -609,18 +596,16 @@ def processEntry(arg1, arg2):
|
||||
if g.AD: # AppleDouble
|
||||
# set dates
|
||||
ADfilePath = (g.ADdir + "/" + g.targetName)
|
||||
writecharsHex(g.exFileData,
|
||||
637,
|
||||
(unixDateToADDate(creationDate) +
|
||||
unixDateToADDate(modifiedDate)))
|
||||
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,
|
||||
getFileType(arg1, arg2) +
|
||||
getAuxType(arg1, arg2))
|
||||
writecharsHex(g.exFileData, 654,
|
||||
getFileType(arg1, arg2) +
|
||||
getAuxType(arg1, arg2))
|
||||
writechars(g.exFileData, 657, b'pdos')
|
||||
saveFile(ADfilePath, g.exFileData)
|
||||
touch(saveName, modifiedDate)
|
||||
@ -629,12 +614,10 @@ def processEntry(arg1, arg2):
|
||||
saveFile((saveName + "r"), g.exFileData)
|
||||
touch((saveName + "r"), modifiedDate)
|
||||
if (g.PDOSPATH_SEGMENT or
|
||||
(g.extractFile and
|
||||
(g.extractFile.lower() == origFileName.lower()))):
|
||||
(g.extractFile and
|
||||
(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,19 +636,17 @@ 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)
|
||||
readcharDec(g.imageData, forkStart+f+2)*256)
|
||||
forkFileLen = (readcharDec(g.imageData, forkStart+f+5) +
|
||||
readcharDec(g.imageData, forkStart+f+6)*256 +
|
||||
readcharDec(g.imageData, forkStart+f+7)*256*256)
|
||||
readcharDec(g.imageData, forkStart+f+6)*256 +
|
||||
readcharDec(g.imageData, forkStart+f+7)*256*256)
|
||||
g.activeFileSize = forkFileLen
|
||||
if (g.resourceFork > 0):
|
||||
rsrcForkLenHex = (readcharHex(g.imageData, forkStart+f+7) +
|
||||
readcharHex(g.imageData, forkStart+f+6) +
|
||||
readcharHex(g.imageData, forkStart+f+5))
|
||||
# print(">>>" + rsrcForkLenHex)
|
||||
readcharHex(g.imageData, forkStart+f+6) +
|
||||
readcharHex(g.imageData, forkStart+f+5))
|
||||
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)
|
||||
@ -701,10 +680,10 @@ def processIndexBlock(arg1, arg2=False):
|
||||
if (pos > 255):
|
||||
# continue with next T/S list sector
|
||||
processIndexBlock([readcharDec(g.imageData, ts(arg1)+1),
|
||||
readcharDec(g.imageData, ts(arg1)+2)])
|
||||
readcharDec(g.imageData, ts(arg1)+2)])
|
||||
else: # ProDOS
|
||||
targetBlock = (readcharDec(g.imageData, arg1*512+pos) +
|
||||
readcharDec(g.imageData, arg1*512+(pos+256))*256)
|
||||
readcharDec(g.imageData, arg1*512+(pos+256))*256)
|
||||
if arg2:
|
||||
processIndexBlock(targetBlock)
|
||||
else:
|
||||
@ -747,7 +726,7 @@ def quitNow(exitCode=0):
|
||||
if (exitCode == 0 and not g.nomsg and
|
||||
g.AD and os.path.isdir("/usr/local/etc/netatalk")):
|
||||
print("File(s) have been copied to the target directory. " +
|
||||
"If the directory")
|
||||
"If the directory")
|
||||
print("is shared by Netatalk, please type 'afpsync' now.")
|
||||
if g.SHK: # clean up
|
||||
for file in os.listdir('/tmp'):
|
||||
@ -993,7 +972,7 @@ def to_bytes(val):
|
||||
return val
|
||||
else:
|
||||
raise Exception(
|
||||
"to_bytes() requires hex-ustr, int/long, or [bin-ustr]")
|
||||
"to_bytes() requires hex-ustr, int/long, or [bin-ustr]")
|
||||
|
||||
def shift(items):
|
||||
"""Shift list items to left, losing the first item.
|
||||
@ -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 += "-"
|
||||
@ -1199,15 +1177,14 @@ if g.SHK:
|
||||
unshkdir = ('/tmp' + "/cppo-" + str(uuid.uuid4()))
|
||||
makedirs(unshkdir)
|
||||
result = os.system("/bin/bash -c 'cd " + unshkdir + "; " +
|
||||
"result=$(nulib2 -xse " + os.path.abspath(g.imageFile) +
|
||||
((" " + args[2].replace('/', ':'))
|
||||
if g.extractFile else "") + " 2> /dev/null); " +
|
||||
"if [[ $result == \"Failed.\" ]]; then exit 3; " +
|
||||
"else if grep -q \"no records match\" <<< \"$result\"" +
|
||||
" > /dev/null; then exit 2; else exit 0; fi; fi'")
|
||||
"result=$(nulib2 -xse " + os.path.abspath(g.imageFile) +
|
||||
((" " + args[2].replace('/', ':'))
|
||||
if g.extractFile else "") + " 2> /dev/null); " +
|
||||
"if [[ $result == \"Failed.\" ]]; then exit 3; " +
|
||||
"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):
|
||||
@ -1230,11 +1207,11 @@ if g.SHK:
|
||||
if g.nodir: # extract in place from "-n"
|
||||
curDir = True
|
||||
elif (len(fileNames) == 1 and
|
||||
os.path.isdir(unshkdir + "/" + fileNames[0])):
|
||||
os.path.isdir(unshkdir + "/" + fileNames[0])):
|
||||
curDir = True # only one folder at top level, so extract in place
|
||||
volumeName = toProdosName(fileNames[0])
|
||||
elif (len(fileNames) == 1 and # disk image, so extract in place
|
||||
fileNames[0][-1:] == "i"):
|
||||
fileNames[0][-1:] == "i"):
|
||||
curDir = True
|
||||
volumeName = toProdosName(fileNames[0].split("#")[0])
|
||||
else: # extract in folder based on disk image name
|
||||
@ -1251,8 +1228,8 @@ if g.SHK:
|
||||
subdirList.sort()
|
||||
if not g.CAT:
|
||||
g.targetDir = (targetDir + ("" if curDir else ("/" + volumeName)) +
|
||||
("/" if (dirName.count('/') > 2) else "") +
|
||||
("/".join(dirName.split('/')[3:]))) # chop tempdir
|
||||
("/" if (dirName.count('/') > 2) else "") +
|
||||
("/".join(dirName.split('/')[3:]))) # chop tempdir
|
||||
if g.extractFile: # solo item, so don't put it in the tree
|
||||
g.targetDir = targetDir
|
||||
if g.UC:
|
||||
@ -1266,9 +1243,9 @@ if g.SHK:
|
||||
# disk image; rename to include suffix and correct type/auxtype
|
||||
imagePath = os.path.join(dirName, fname).split("#")[0]
|
||||
new_name = (imagePath +
|
||||
("" if (imagePath.lower().endswith(".po") or
|
||||
imagePath.lower().endswith(".hdv"))
|
||||
else ".PO") + "#e00005")
|
||||
("" if (imagePath.lower().endswith(".po") or
|
||||
imagePath.lower().endswith(".hdv"))
|
||||
else ".PO") + "#e00005")
|
||||
os.rename(os.path.join(dirName, fname), new_name)
|
||||
fname = os.path.basename(new_name)
|
||||
g.shk_hasrf = False
|
||||
@ -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)
|
||||
@ -1339,12 +1303,9 @@ if (len(g.imageData) == 143360):
|
||||
for t in range(0, 35):
|
||||
for s in [0, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 15]:
|
||||
writechars(imageDataFixed,
|
||||
ts(t,((15-s) if (s%15) else s)),
|
||||
readchars(g.imageData, ts(t,s), 256))
|
||||
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.")
|
||||
@ -1367,7 +1328,7 @@ if g.D33:
|
||||
diskName = toProdosName(diskName)
|
||||
if not g.CAT:
|
||||
g.targetDir = (args[3] if g.extractFile
|
||||
else (args[2] + "/" + diskName))
|
||||
else (args[2] + "/" + diskName))
|
||||
g.ADdir = (g.targetDir + "/.AppleDouble")
|
||||
makedirs(g.targetDir)
|
||||
if g.AD:
|
||||
@ -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
|
||||
@ -524,13 +511,11 @@ if [[ ! -f $imagesDir/INSTALL.HDV ]] \
|
||||
echo 2
|
||||
acmd -convert $gsosHD.shk $imagesDir/"$gsosHD" 65535
|
||||
echo 3
|
||||
rm "PRODOS#"* "GSHK#"* "TEACH#"* $gsosHD.shk &> /dev/null
|
||||
rm "PRODOS#"* "GSHK#"* "TEACH#"* $gsosHD.shk &> /dev/null
|
||||
|
||||
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,16 +469,16 @@ 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 \
|
||||
/usr/local/adtpro/ac.sh \
|
||||
/usr/local/adtpro/adtpro.bat \
|
||||
/usr/local/adtpro/adtpro.cmd \
|
||||
/usr/local/adtpro/ADTPro.html \
|
||||
/usr/local/adtpro/adtpro.sh \
|
||||
/usr/local/adtpro/lib \
|
||||
/usr/local/adtpro/LICENSE \
|
||||
/usr/local/adtpro/README \
|
||||
&> /dev/null
|
||||
sudo rm -rf /usr/local/adtpro/ac.bat \
|
||||
/usr/local/adtpro/ac.sh \
|
||||
/usr/local/adtpro/adtpro.bat \
|
||||
/usr/local/adtpro/adtpro.cmd \
|
||||
/usr/local/adtpro/ADTPro.html \
|
||||
/usr/local/adtpro/adtpro.sh \
|
||||
/usr/local/adtpro/lib \
|
||||
/usr/local/adtpro/LICENSE \
|
||||
/usr/local/adtpro/README \
|
||||
&>/dev/null
|
||||
fi
|
||||
else
|
||||
echo "A2CLOUD: ADTPro server does not need updating."
|
||||
@ -792,10 +748,10 @@ if [[ $setupSerialPortLogin ]]; then
|
||||
pwd=$PWD
|
||||
cd /etc/systemd/system/getty.target.wants
|
||||
grep -o 'SYMLINK+="ttyUSB.*,' /etc/udev/rules.d/50-usb.rules | cut -d '"' -f 2 | \
|
||||
while read ttyUSB; do
|
||||
sudo rm usbgetty@${ttyUSB}.service 2> /dev/null
|
||||
sudo ln -s usbgetty@.service usbgetty@${ttyUSB}.service
|
||||
done
|
||||
while read ttyUSB; do
|
||||
sudo rm usbgetty@${ttyUSB}.service 2> /dev/null
|
||||
sudo ln -s usbgetty@.service usbgetty@${ttyUSB}.service
|
||||
done
|
||||
cd "$pwd"
|
||||
sudo systemctl daemon-reload
|
||||
elif [[ -n "$isSysVInit" ]]; then
|
||||
@ -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
|
||||
|
@ -28,9 +28,9 @@ elif [[ $1 == "add" ]]; then
|
||||
[[ $2 == "ttyUSBlower" ]] && sleep 1.5
|
||||
[[ ${#2} -gt 11 ]] && sleep "${2:15:2}"
|
||||
if [[ $2 == "ttyUSBlower" || \
|
||||
$2 == $(ls -1 /dev/ttyUSBlower_hub* 2> /dev/null | head -1 | cut -c 6-) || \
|
||||
( ${2:0:12} == "ttyUSBlower_" && $2 != $(ls -1 /dev/ttyUSBupper_hub* 2> /dev/null | tail -1 | cut -c 6-) ) \
|
||||
]]; then
|
||||
$2 == $(ls -1 /dev/ttyUSBlower_hub* 2> /dev/null | head -1 | cut -c 6-) || \
|
||||
( ${2:0:12} == "ttyUSBlower_" && $2 != $(ls -1 /dev/ttyUSBupper_hub* 2> /dev/null | tail -1 | cut -c 6-) ) \
|
||||
]]; then
|
||||
rm /tmp/udev-ttyUSBlower-added &> /dev/null
|
||||
touch /tmp/udev-ttyUSBlower-added
|
||||
pkill -f "[A]DTPro"
|
||||
|
@ -1,42 +1,42 @@
|
||||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This file is adapted for A2CLOUD. It to be called usbgetty@.service
|
||||
# and needs to be placed in /etc/systemd/system/getty.target.wants/
|
||||
# Symlinks pointing to it need to be in place for every serial port
|
||||
# defined in /etc/udev/rules.d/50-usb.rules, e.g.
|
||||
# usbgetty@ttyUSBupper.service -> usbgetty@.service
|
||||
|
||||
[Unit]
|
||||
Description=Serial Getty on %I
|
||||
Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
||||
Documentation=http://0pointer.de/blog/projects/serial-console.html
|
||||
BindsTo=dev-%i.device
|
||||
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
|
||||
After=rc-local.service
|
||||
|
||||
# If additional gettys are spawned during boot then we should make
|
||||
# sure that this is synchronized before getty.target, even though
|
||||
# getty.target didn't actually pull it in.
|
||||
Before=getty.target
|
||||
IgnoreOnIsolate=yes
|
||||
|
||||
[Service]
|
||||
#ExecStart=-/sbin/agetty %I 4800 $TERM
|
||||
ExecStart=-/usr/local/sbin/usbgetty -h -L -scanttyUSB 4800 vt100
|
||||
Type=idle
|
||||
Restart=always
|
||||
UtmpIdentifier=%I
|
||||
TTYPath=/dev/%I
|
||||
TTYReset=yes
|
||||
TTYVHangup=yes
|
||||
KillMode=process
|
||||
IgnoreSIGPIPE=no
|
||||
SendSIGHUP=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=getty.target
|
||||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This file is adapted for A2CLOUD. It to be called usbgetty@.service
|
||||
# and needs to be placed in /etc/systemd/system/getty.target.wants/
|
||||
# Symlinks pointing to it need to be in place for every serial port
|
||||
# defined in /etc/udev/rules.d/50-usb.rules, e.g.
|
||||
# usbgetty@ttyUSBupper.service -> usbgetty@.service
|
||||
|
||||
[Unit]
|
||||
Description=Serial Getty on %I
|
||||
Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
||||
Documentation=http://0pointer.de/blog/projects/serial-console.html
|
||||
BindsTo=dev-%i.device
|
||||
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
|
||||
After=rc-local.service
|
||||
|
||||
# If additional gettys are spawned during boot then we should make
|
||||
# sure that this is synchronized before getty.target, even though
|
||||
# getty.target didn't actually pull it in.
|
||||
Before=getty.target
|
||||
IgnoreOnIsolate=yes
|
||||
|
||||
[Service]
|
||||
#ExecStart=-/sbin/agetty %I 4800 $TERM
|
||||
ExecStart=-/usr/local/sbin/usbgetty -h -L -scanttyUSB 4800 vt100
|
||||
Type=idle
|
||||
Restart=always
|
||||
UtmpIdentifier=%I
|
||||
TTYPath=/dev/%I
|
||||
TTYReset=yes
|
||||
TTYVHangup=yes
|
||||
KillMode=process
|
||||
IgnoreSIGPIPE=no
|
||||
SendSIGHUP=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=getty.target
|
||||
|
@ -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