mirror of
https://github.com/RasppleII/a2cloud.git
synced 2025-08-07 11:26:59 +00:00
Fix indentation and remove dead code
This commit is contained in:
@@ -27,10 +27,6 @@ helpExit () {
|
|||||||
fi
|
fi
|
||||||
echoerr "-c <filename> <imagename> [[$|0x]<type>] [[$|0x]<auxtype>] synonym for -p"
|
echoerr "-c <filename> <imagename> [[$|0x]<type>] [[$|0x]<auxtype>] synonym for -p"
|
||||||
echoerr " with filename and imagename reversed."
|
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
|
else
|
||||||
cat $acmdStdErr
|
cat $acmdStdErr
|
||||||
fi
|
fi
|
||||||
|
162
setup/cppo.txt
162
setup/cppo.txt
@@ -97,14 +97,12 @@ def pdosDateToUnixDate(arg1):
|
|||||||
day = binToDec(slyce(arg1,11,5))
|
day = binToDec(slyce(arg1,11,5))
|
||||||
hour = binToDec(slyce(arg1,19,5))
|
hour = binToDec(slyce(arg1,19,5))
|
||||||
minute = binToDec(slyce(arg1,26,6))
|
minute = binToDec(slyce(arg1,26,6))
|
||||||
# print(year, month, day, hour, minute)
|
|
||||||
td = (datetime.datetime(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)
|
unixDate_naive = (td.days*24*60*60 + td.seconds)
|
||||||
td2 = (datetime.datetime.fromtimestamp(unixDate_naive) -
|
td2 = (datetime.datetime.fromtimestamp(unixDate_naive) -
|
||||||
datetime.datetime.utcfromtimestamp(unixDate_naive))
|
datetime.datetime.utcfromtimestamp(unixDate_naive))
|
||||||
utcoffset = (td2.days*24*60*60 + td2.seconds)
|
utcoffset = (td2.days*24*60*60 + td2.seconds)
|
||||||
# print(unixDate_naive - utcoffset)
|
|
||||||
return (unixDate_naive - utcoffset) # local time zone with DST
|
return (unixDate_naive - utcoffset) # local time zone with DST
|
||||||
|
|
||||||
def unixDateToADDate(arg1):
|
def unixDateToADDate(arg1):
|
||||||
@@ -115,7 +113,6 @@ def unixDateToADDate(arg1):
|
|||||||
if (adDate < 0 ):
|
if (adDate < 0 ):
|
||||||
adDate += 4294967296 # to get negative hex number
|
adDate += 4294967296 # to get negative hex number
|
||||||
adDateHex = to_hex(adDate).zfill(8).upper()
|
adDateHex = to_hex(adDate).zfill(8).upper()
|
||||||
# print(arg1, adDate, adDateHex)
|
|
||||||
return adDateHex
|
return adDateHex
|
||||||
|
|
||||||
# cppo support functions:
|
# cppo support functions:
|
||||||
@@ -161,7 +158,7 @@ def getFileName(arg1, arg2):
|
|||||||
def getCaseMask(arg1, arg2):
|
def getCaseMask(arg1, arg2):
|
||||||
start = getStartPos(arg1, arg2)
|
start = getStartPos(arg1, arg2)
|
||||||
caseMaskDec = (readcharDec(g.imageData, start+28) +
|
caseMaskDec = (readcharDec(g.imageData, start+28) +
|
||||||
readcharDec(g.imageData, start+29)*256)
|
readcharDec(g.imageData, start+29)*256)
|
||||||
if (caseMaskDec < 32768):
|
if (caseMaskDec < 32768):
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
@@ -189,7 +186,7 @@ def getAuxType(arg1, arg2):
|
|||||||
if (fileType == '06'): # BIN (B)
|
if (fileType == '06'): # BIN (B)
|
||||||
# file address is in first two bytes of file data
|
# file address is in first two bytes of file data
|
||||||
fileTSlist = [readcharDec(g.imageData, start+0),
|
fileTSlist = [readcharDec(g.imageData, start+0),
|
||||||
readcharDec(g.imageData, start+1)]
|
readcharDec(g.imageData, start+1)]
|
||||||
fileStart = [readcharDec(g.imageData, ts(fileTSlist)+12),
|
fileStart = [readcharDec(g.imageData, ts(fileTSlist)+12),
|
||||||
readcharDec(g.imageData, ts(fileTSlist)+13)]
|
readcharDec(g.imageData, ts(fileTSlist)+13)]
|
||||||
return (readcharHex(g.imageData, ts(fileStart)+1) +
|
return (readcharHex(g.imageData, ts(fileStart)+1) +
|
||||||
@@ -218,7 +215,7 @@ def getFileLength(arg1, arg2):
|
|||||||
if g.D33:
|
if g.D33:
|
||||||
fileType = getFileType(arg1, arg2)
|
fileType = getFileType(arg1, arg2)
|
||||||
fileTSlist = [readcharDec(g.imageData, start+0),
|
fileTSlist = [readcharDec(g.imageData, start+0),
|
||||||
readcharDec(g.imageData, start+1)]
|
readcharDec(g.imageData, start+1)]
|
||||||
fileStart = [readcharDec(g.imageData, ts(fileTSlist)+12),
|
fileStart = [readcharDec(g.imageData, ts(fileTSlist)+12),
|
||||||
readcharDec(g.imageData, ts(fileTSlist)+13)]
|
readcharDec(g.imageData, ts(fileTSlist)+13)]
|
||||||
if (fileType == '06'): # BIN (B)
|
if (fileType == '06'): # BIN (B)
|
||||||
@@ -241,10 +238,10 @@ def getFileLength(arg1, arg2):
|
|||||||
pos = ts(nextTSlistSector)
|
pos = ts(nextTSlistSector)
|
||||||
for tsPos in range(12, 256, 2):
|
for tsPos in range(12, 256, 2):
|
||||||
if ts(readcharDec(g.imageData, pos+tsPos+0),
|
if ts(readcharDec(g.imageData, pos+tsPos+0),
|
||||||
readcharDec(g.imageData, pos+tsPos+1)) != 0:
|
readcharDec(g.imageData, pos+tsPos+1)) != 0:
|
||||||
fileSize += 256
|
fileSize += 256
|
||||||
prevTSpair = [readcharDec(g.imageData, (pos+tsPos)+0),
|
prevTSpair = [readcharDec(g.imageData, (pos+tsPos)+0),
|
||||||
readcharDec(g.imageData, (pos+tsPos)+1)]
|
readcharDec(g.imageData, (pos+tsPos)+1)]
|
||||||
else:
|
else:
|
||||||
lastTSpair = prevTSpair
|
lastTSpair = prevTSpair
|
||||||
endFound = True
|
endFound = True
|
||||||
@@ -260,7 +257,6 @@ def getFileLength(arg1, arg2):
|
|||||||
pos = ts(prevTSpair)
|
pos = ts(prevTSpair)
|
||||||
# now find out where the file really ends by finding the last 00
|
# now find out where the file really ends by finding the last 00
|
||||||
for offset in range(255, -1, -1):
|
for offset in range(255, -1, -1):
|
||||||
#print("pos: " + to_hex(pos))
|
|
||||||
if (readcharDec(g.imageData, pos+offset) != 0):
|
if (readcharDec(g.imageData, pos+offset) != 0):
|
||||||
fileSize += (offset + 1)
|
fileSize += (offset + 1)
|
||||||
break
|
break
|
||||||
@@ -297,9 +293,9 @@ def getModifiedDate(arg1, arg2):
|
|||||||
|
|
||||||
if g.SHK:
|
if g.SHK:
|
||||||
modifiedDate = int(time.mktime(
|
modifiedDate = int(time.mktime(
|
||||||
time.strptime(
|
time.strptime(
|
||||||
time.ctime(
|
time.ctime(
|
||||||
os.path.getmtime(os.path.join(arg1, arg2))))))
|
os.path.getmtime(os.path.join(arg1, arg2))))))
|
||||||
rVal = modifiedDate
|
rVal = modifiedDate
|
||||||
elif g.D33:
|
elif g.D33:
|
||||||
rVal = None
|
rVal = None
|
||||||
@@ -327,7 +323,7 @@ def getWorkingDirName(arg1, arg2=None):
|
|||||||
workingDirName = readchars(g.imageData, start+5, nameLength)
|
workingDirName = readchars(g.imageData, start+5, nameLength)
|
||||||
if (entryType == 15): # volume directory, get casemask from header
|
if (entryType == 15): # volume directory, get casemask from header
|
||||||
caseMaskDec = (readcharDec(g.imageData, start+26) +
|
caseMaskDec = (readcharDec(g.imageData, start+26) +
|
||||||
readcharDec(g.imageData, start+27)*256)
|
readcharDec(g.imageData, start+27)*256)
|
||||||
if (caseMaskDec < 32768):
|
if (caseMaskDec < 32768):
|
||||||
caseMask = None
|
caseMask = None
|
||||||
else:
|
else:
|
||||||
@@ -338,15 +334,13 @@ def getWorkingDirName(arg1, arg2=None):
|
|||||||
for i in range(0, len(workingDirName)):
|
for i in range(0, len(workingDirName)):
|
||||||
if (caseMask[i] == "1"):
|
if (caseMask[i] == "1"):
|
||||||
workingDirName = (workingDirName[:i] +
|
workingDirName = (workingDirName[:i] +
|
||||||
workingDirName[i:i+1].lower() +
|
workingDirName[i:i+1].lower() +
|
||||||
workingDirName[i+1:])
|
workingDirName[i+1:])
|
||||||
return workingDirName
|
return workingDirName
|
||||||
|
|
||||||
def getDirEntryCount(arg1):
|
def getDirEntryCount(arg1):
|
||||||
if g.D33:
|
if g.D33:
|
||||||
entryCount = 0
|
entryCount = 0
|
||||||
#nextSector = [readcharDec(g.imageData, ts(arg1)+1),
|
|
||||||
# readcharDec(g.imageData, ts(arg1)+2)]
|
|
||||||
nextSector = arg1
|
nextSector = arg1
|
||||||
while True:
|
while True:
|
||||||
top = ts(nextSector)
|
top = ts(nextSector)
|
||||||
@@ -359,7 +353,7 @@ def getDirEntryCount(arg1):
|
|||||||
entryCount += 1 # increment if not deleted file
|
entryCount += 1 # increment if not deleted file
|
||||||
pos += 35
|
pos += 35
|
||||||
nextSector = [readcharDec(g.imageData, top+1),
|
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
|
if (nextSector[0]+nextSector[1] == 0): # no more catalog sectors
|
||||||
return entryCount
|
return entryCount
|
||||||
else: # ProDOS
|
else: # ProDOS
|
||||||
@@ -438,14 +432,13 @@ def copyFile(arg1, arg2):
|
|||||||
if (getFileType(arg1, arg2) == '06'):
|
if (getFileType(arg1, arg2) == '06'):
|
||||||
g.outFileData = g.outFileData[4:]
|
g.outFileData = g.outFileData[4:]
|
||||||
elif ((getFileType(arg1, arg2) == 'FA') or
|
elif ((getFileType(arg1, arg2) == 'FA') or
|
||||||
getFileType(arg1, arg2) == 'FC'):
|
getFileType(arg1, arg2) == 'FC'):
|
||||||
g.outFileData = g.outFileData[2:]
|
g.outFileData = g.outFileData[2:]
|
||||||
|
|
||||||
def copyBlock(arg1, arg2):
|
def copyBlock(arg1, arg2):
|
||||||
#arg1: block number or [t,s] to copy
|
#arg1: block number or [t,s] to copy
|
||||||
#arg2: bytes to write (should be 256 (DOS 3.3) or 512 (ProDOS),
|
#arg2: bytes to write (should be 256 (DOS 3.3) or 512 (ProDOS),
|
||||||
# unless final block with less)
|
# unless final block with less)
|
||||||
#print(arg1 + " " + arg2 + " " + g.activeFileBytesCopied)
|
|
||||||
if (arg1 == 0):
|
if (arg1 == 0):
|
||||||
outBytes = (b'\x00' * arg2)
|
outBytes = (b'\x00' * arg2)
|
||||||
else:
|
else:
|
||||||
@@ -490,7 +483,7 @@ def processDir(arg1, arg2=None, arg3=None, arg4=None, arg5=None):
|
|||||||
if g.PDOSPATH_INDEX:
|
if g.PDOSPATH_INDEX:
|
||||||
if (g.PDOSPATH_INDEX == 1):
|
if (g.PDOSPATH_INDEX == 1):
|
||||||
if (("/" + g.PDOSPATH_SEGMENT.lower()) !=
|
if (("/" + g.PDOSPATH_SEGMENT.lower()) !=
|
||||||
g.DIRPATH.lower()):
|
g.DIRPATH.lower()):
|
||||||
print("ProDOS volume name does not match disk image.")
|
print("ProDOS volume name does not match disk image.")
|
||||||
quitNow(2)
|
quitNow(2)
|
||||||
else:
|
else:
|
||||||
@@ -498,19 +491,14 @@ def processDir(arg1, arg2=None, arg3=None, arg4=None, arg5=None):
|
|||||||
g.PDOSPATH_SEGMENT = g.PDOSPATH[g.PDOSPATH_INDEX]
|
g.PDOSPATH_SEGMENT = g.PDOSPATH[g.PDOSPATH_INDEX]
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
# print(g.DIRPATH)
|
|
||||||
while (pe < entryCount):
|
while (pe < entryCount):
|
||||||
if (getStorageType(arg1, e) > 0):
|
if (getStorageType(arg1, e) > 0):
|
||||||
#print(pe, e, entryCount)
|
|
||||||
processEntry(arg1, e)
|
processEntry(arg1, e)
|
||||||
pe += 1
|
pe += 1
|
||||||
e += 1
|
e += 1
|
||||||
if not ((e + (0 if g.D33 else (e>11)) ) % (7 if g.D33 else 13)):
|
if not ((e + (0 if g.D33 else (e>11)) ) % (7 if g.D33 else 13)):
|
||||||
processDir(getDirNextChunkPointer(arg1),
|
processDir(getDirNextChunkPointer(arg1),
|
||||||
entryCount,
|
entryCount, e, workingDirName, pe)
|
||||||
e,
|
|
||||||
workingDirName,
|
|
||||||
pe)
|
|
||||||
break
|
break
|
||||||
|
|
||||||
def processEntry(arg1, arg2):
|
def processEntry(arg1, arg2):
|
||||||
@@ -519,9 +507,9 @@ def processEntry(arg1, arg2):
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
print(getFileName(arg1, arg2), getStorageType(arg1, arg2),
|
print(getFileName(arg1, arg2), getStorageType(arg1, arg2),
|
||||||
getFileType(arg1, arg2), getKeyPointer(arg1, arg2),
|
getFileType(arg1, arg2), getKeyPointer(arg1, arg2),
|
||||||
getFileLength(arg1, arg2), getAuxType(arg1, arg2),
|
getFileLength(arg1, arg2), getAuxType(arg1, arg2),
|
||||||
getCreationDate(arg1, arg2), getModifiedDate(arg1, arg2))
|
getCreationDate(arg1, arg2), getModifiedDate(arg1, arg2))
|
||||||
'''
|
'''
|
||||||
|
|
||||||
eTargetName = None
|
eTargetName = None
|
||||||
@@ -568,16 +556,16 @@ def processEntry(arg1, arg2):
|
|||||||
if ("/".join(dirName.split('/')[3:])):
|
if ("/".join(dirName.split('/')[3:])):
|
||||||
dirPrint = ("/".join(dirName.split('/')[3:]) + "/")
|
dirPrint = ("/".join(dirName.split('/')[3:]) + "/")
|
||||||
if (not g.extractFile or
|
if (not g.extractFile or
|
||||||
(os.path.basename(g.extractFile.lower()) ==
|
(os.path.basename(g.extractFile.lower()) ==
|
||||||
origFileName.split('#')[0].lower())):
|
origFileName.split('#')[0].lower())):
|
||||||
filePrint = g.activeFileName.split("#")[0]
|
filePrint = g.activeFileName.split("#")[0]
|
||||||
print(dirPrint + filePrint +
|
print(dirPrint + filePrint +
|
||||||
("+" if (g.shk_hasrf or
|
("+" if (g.shk_hasrf or
|
||||||
(not g.SHK and getStorageType(arg1, arg2) == 5))
|
(not g.SHK and getStorageType(arg1, arg2) == 5))
|
||||||
else "") +
|
else "") +
|
||||||
((" [" + origFileName + "] ")
|
((" [" + origFileName + "] ")
|
||||||
if (g.PNAME and (origFileName != g.activeFileName))
|
if (g.PNAME and (origFileName != g.activeFileName))
|
||||||
else ""))
|
else ""))
|
||||||
if g.CAT:
|
if g.CAT:
|
||||||
return
|
return
|
||||||
if not g.targetName:
|
if not g.targetName:
|
||||||
@@ -587,14 +575,13 @@ def processEntry(arg1, arg2):
|
|||||||
eTargetName = arg2
|
eTargetName = arg2
|
||||||
else: # ProDOS image
|
else: # ProDOS image
|
||||||
eTargetName = (g.targetName + "#" +
|
eTargetName = (g.targetName + "#" +
|
||||||
getFileType(arg1, arg2).lower() +
|
getFileType(arg1, arg2).lower() +
|
||||||
getAuxType(arg1, arg2).lower())
|
getAuxType(arg1, arg2).lower())
|
||||||
# touch(g.targetDir + "/" + g.targetName)
|
|
||||||
if g.AD:
|
if g.AD:
|
||||||
makeADfile()
|
makeADfile()
|
||||||
copyFile(arg1, arg2)
|
copyFile(arg1, arg2)
|
||||||
saveName = (g.targetDir + "/" +
|
saveName = (g.targetDir + "/" +
|
||||||
(eTargetName if eTargetName else g.targetName))
|
(eTargetName if eTargetName else g.targetName))
|
||||||
saveFile(saveName, g.outFileData)
|
saveFile(saveName, g.outFileData)
|
||||||
creationDate = getCreationDate(arg1, arg2)
|
creationDate = getCreationDate(arg1, arg2)
|
||||||
modifiedDate = getModifiedDate(arg1, arg2)
|
modifiedDate = getModifiedDate(arg1, arg2)
|
||||||
@@ -609,18 +596,16 @@ def processEntry(arg1, arg2):
|
|||||||
if g.AD: # AppleDouble
|
if g.AD: # AppleDouble
|
||||||
# set dates
|
# set dates
|
||||||
ADfilePath = (g.ADdir + "/" + g.targetName)
|
ADfilePath = (g.ADdir + "/" + g.targetName)
|
||||||
writecharsHex(g.exFileData,
|
writecharsHex(g.exFileData, 637,
|
||||||
637,
|
(unixDateToADDate(creationDate) +
|
||||||
(unixDateToADDate(creationDate) +
|
unixDateToADDate(modifiedDate)))
|
||||||
unixDateToADDate(modifiedDate)))
|
|
||||||
writecharHex(g.exFileData, 645, "80")
|
writecharHex(g.exFileData, 645, "80")
|
||||||
writecharHex(g.exFileData, 649, "80")
|
writecharHex(g.exFileData, 649, "80")
|
||||||
#set type/creator
|
#set type/creator
|
||||||
writechars(g.exFileData, 653, b'p')
|
writechars(g.exFileData, 653, b'p')
|
||||||
writecharsHex(g.exFileData,
|
writecharsHex(g.exFileData, 654,
|
||||||
654,
|
getFileType(arg1, arg2) +
|
||||||
getFileType(arg1, arg2) +
|
getAuxType(arg1, arg2))
|
||||||
getAuxType(arg1, arg2))
|
|
||||||
writechars(g.exFileData, 657, b'pdos')
|
writechars(g.exFileData, 657, b'pdos')
|
||||||
saveFile(ADfilePath, g.exFileData)
|
saveFile(ADfilePath, g.exFileData)
|
||||||
touch(saveName, modifiedDate)
|
touch(saveName, modifiedDate)
|
||||||
@@ -629,12 +614,10 @@ def processEntry(arg1, arg2):
|
|||||||
saveFile((saveName + "r"), g.exFileData)
|
saveFile((saveName + "r"), g.exFileData)
|
||||||
touch((saveName + "r"), modifiedDate)
|
touch((saveName + "r"), modifiedDate)
|
||||||
if (g.PDOSPATH_SEGMENT or
|
if (g.PDOSPATH_SEGMENT or
|
||||||
(g.extractFile and
|
(g.extractFile and
|
||||||
(g.extractFile.lower() == origFileName.lower()))):
|
(g.extractFile.lower() == origFileName.lower()))):
|
||||||
quitNow(0)
|
quitNow(0)
|
||||||
g.targetName = None
|
g.targetName = None
|
||||||
#else:
|
|
||||||
#print(g.activeFileName + " doesn't match " + g.PDOSPATH_SEGMENT)
|
|
||||||
|
|
||||||
def processForkedFile(arg1):
|
def processForkedFile(arg1):
|
||||||
# finder info except type/creator
|
# finder info except type/creator
|
||||||
@@ -653,19 +636,17 @@ def processForkedFile(arg1):
|
|||||||
g.resourceFork = f
|
g.resourceFork = f
|
||||||
g.activeFileBytesCopied = 0
|
g.activeFileBytesCopied = 0
|
||||||
forkStart = (arg1 * 512) # start of Forked File key block
|
forkStart = (arg1 * 512) # start of Forked File key block
|
||||||
# print("--" + forkStart)
|
|
||||||
forkStorageType = readcharDec(g.imageData, forkStart+f+0)
|
forkStorageType = readcharDec(g.imageData, forkStart+f+0)
|
||||||
forkKeyPointer = (readcharDec(g.imageData, forkStart+f+1) +
|
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) +
|
forkFileLen = (readcharDec(g.imageData, forkStart+f+5) +
|
||||||
readcharDec(g.imageData, forkStart+f+6)*256 +
|
readcharDec(g.imageData, forkStart+f+6)*256 +
|
||||||
readcharDec(g.imageData, forkStart+f+7)*256*256)
|
readcharDec(g.imageData, forkStart+f+7)*256*256)
|
||||||
g.activeFileSize = forkFileLen
|
g.activeFileSize = forkFileLen
|
||||||
if (g.resourceFork > 0):
|
if (g.resourceFork > 0):
|
||||||
rsrcForkLenHex = (readcharHex(g.imageData, forkStart+f+7) +
|
rsrcForkLenHex = (readcharHex(g.imageData, forkStart+f+7) +
|
||||||
readcharHex(g.imageData, forkStart+f+6) +
|
readcharHex(g.imageData, forkStart+f+6) +
|
||||||
readcharHex(g.imageData, forkStart+f+5))
|
readcharHex(g.imageData, forkStart+f+5))
|
||||||
# print(">>>" + rsrcForkLenHex)
|
|
||||||
if (g.AD or g.EX):
|
if (g.AD or g.EX):
|
||||||
print(" [resource fork]")
|
print(" [resource fork]")
|
||||||
if g.AD:
|
if g.AD:
|
||||||
@@ -678,7 +659,6 @@ def processForkedFile(arg1):
|
|||||||
processIndexBlock(forkKeyPointer)
|
processIndexBlock(forkKeyPointer)
|
||||||
elif (forkStorageType == 3): #tree
|
elif (forkStorageType == 3): #tree
|
||||||
processMasterIndexBlock(forkKeyPointer)
|
processMasterIndexBlock(forkKeyPointer)
|
||||||
# print()
|
|
||||||
g.resourceFork = 0
|
g.resourceFork = 0
|
||||||
|
|
||||||
def processMasterIndexBlock(arg1):
|
def processMasterIndexBlock(arg1):
|
||||||
@@ -693,7 +673,6 @@ def processIndexBlock(arg1, arg2=False):
|
|||||||
if g.D33:
|
if g.D33:
|
||||||
targetTS = [readcharDec(g.imageData, ts(arg1)+pos+0),
|
targetTS = [readcharDec(g.imageData, ts(arg1)+pos+0),
|
||||||
readcharDec(g.imageData, ts(arg1)+pos+1)]
|
readcharDec(g.imageData, ts(arg1)+pos+1)]
|
||||||
#print(to_hex(targetTS[0]),to_hex(targetTS[1]))
|
|
||||||
bytesRemaining = (g.activeFileSize - g.activeFileBytesCopied)
|
bytesRemaining = (g.activeFileSize - g.activeFileBytesCopied)
|
||||||
bs = (bytesRemaining if (bytesRemaining < 256) else 256)
|
bs = (bytesRemaining if (bytesRemaining < 256) else 256)
|
||||||
copyBlock(targetTS, bs)
|
copyBlock(targetTS, bs)
|
||||||
@@ -701,10 +680,10 @@ def processIndexBlock(arg1, arg2=False):
|
|||||||
if (pos > 255):
|
if (pos > 255):
|
||||||
# continue with next T/S list sector
|
# continue with next T/S list sector
|
||||||
processIndexBlock([readcharDec(g.imageData, ts(arg1)+1),
|
processIndexBlock([readcharDec(g.imageData, ts(arg1)+1),
|
||||||
readcharDec(g.imageData, ts(arg1)+2)])
|
readcharDec(g.imageData, ts(arg1)+2)])
|
||||||
else: # ProDOS
|
else: # ProDOS
|
||||||
targetBlock = (readcharDec(g.imageData, arg1*512+pos) +
|
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:
|
if arg2:
|
||||||
processIndexBlock(targetBlock)
|
processIndexBlock(targetBlock)
|
||||||
else:
|
else:
|
||||||
@@ -747,7 +726,7 @@ def quitNow(exitCode=0):
|
|||||||
if (exitCode == 0 and not g.nomsg and
|
if (exitCode == 0 and not g.nomsg and
|
||||||
g.AD and os.path.isdir("/usr/local/etc/netatalk")):
|
g.AD and os.path.isdir("/usr/local/etc/netatalk")):
|
||||||
print("File(s) have been copied to the target directory. " +
|
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.")
|
print("is shared by Netatalk, please type 'afpsync' now.")
|
||||||
if g.SHK: # clean up
|
if g.SHK: # clean up
|
||||||
for file in os.listdir('/tmp'):
|
for file in os.listdir('/tmp'):
|
||||||
@@ -993,7 +972,7 @@ def to_bytes(val):
|
|||||||
return val
|
return val
|
||||||
else:
|
else:
|
||||||
raise Exception(
|
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):
|
def shift(items):
|
||||||
"""Shift list items to left, losing the first item.
|
"""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):
|
def touch(filePath, modTime=None):
|
||||||
# http://stackoverflow.com/questions/1158076/implement-touch-using-python
|
# http://stackoverflow.com/questions/1158076/implement-touch-using-python
|
||||||
# print(filePath)
|
|
||||||
import os
|
import os
|
||||||
if (os.name == "nt"):
|
if (os.name == "nt"):
|
||||||
if filePath[-1] == ".": filePath += "-"
|
if filePath[-1] == ".": filePath += "-"
|
||||||
@@ -1199,15 +1177,14 @@ if g.SHK:
|
|||||||
unshkdir = ('/tmp' + "/cppo-" + str(uuid.uuid4()))
|
unshkdir = ('/tmp' + "/cppo-" + str(uuid.uuid4()))
|
||||||
makedirs(unshkdir)
|
makedirs(unshkdir)
|
||||||
result = os.system("/bin/bash -c 'cd " + unshkdir + "; " +
|
result = os.system("/bin/bash -c 'cd " + unshkdir + "; " +
|
||||||
"result=$(nulib2 -xse " + os.path.abspath(g.imageFile) +
|
"result=$(nulib2 -xse " + os.path.abspath(g.imageFile) +
|
||||||
((" " + args[2].replace('/', ':'))
|
((" " + args[2].replace('/', ':'))
|
||||||
if g.extractFile else "") + " 2> /dev/null); " +
|
if g.extractFile else "") + " 2> /dev/null); " +
|
||||||
"if [[ $result == \"Failed.\" ]]; then exit 3; " +
|
"if [[ $result == \"Failed.\" ]]; then exit 3; " +
|
||||||
"else if grep -q \"no records match\" <<< \"$result\"" +
|
"else if grep -q \"no records match\" <<< \"$result\"" +
|
||||||
" > /dev/null; then exit 2; else exit 0; fi; fi'")
|
" > /dev/null; then exit 2; else exit 0; fi; fi'")
|
||||||
if (result == 512):
|
if (result == 512):
|
||||||
print(
|
print("File not found in ShrinkIt archive. Try cppo -cat to get the path,")
|
||||||
"File not found in ShrinkIt archive. Try cppo -cat to get the path,")
|
|
||||||
print(" and omit any leading slash or colon.")
|
print(" and omit any leading slash or colon.")
|
||||||
quitNow(1)
|
quitNow(1)
|
||||||
elif (result != 0):
|
elif (result != 0):
|
||||||
@@ -1230,11 +1207,11 @@ if g.SHK:
|
|||||||
if g.nodir: # extract in place from "-n"
|
if g.nodir: # extract in place from "-n"
|
||||||
curDir = True
|
curDir = True
|
||||||
elif (len(fileNames) == 1 and
|
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
|
curDir = True # only one folder at top level, so extract in place
|
||||||
volumeName = toProdosName(fileNames[0])
|
volumeName = toProdosName(fileNames[0])
|
||||||
elif (len(fileNames) == 1 and # disk image, so extract in place
|
elif (len(fileNames) == 1 and # disk image, so extract in place
|
||||||
fileNames[0][-1:] == "i"):
|
fileNames[0][-1:] == "i"):
|
||||||
curDir = True
|
curDir = True
|
||||||
volumeName = toProdosName(fileNames[0].split("#")[0])
|
volumeName = toProdosName(fileNames[0].split("#")[0])
|
||||||
else: # extract in folder based on disk image name
|
else: # extract in folder based on disk image name
|
||||||
@@ -1251,8 +1228,8 @@ if g.SHK:
|
|||||||
subdirList.sort()
|
subdirList.sort()
|
||||||
if not g.CAT:
|
if not g.CAT:
|
||||||
g.targetDir = (targetDir + ("" if curDir else ("/" + volumeName)) +
|
g.targetDir = (targetDir + ("" if curDir else ("/" + volumeName)) +
|
||||||
("/" if (dirName.count('/') > 2) else "") +
|
("/" if (dirName.count('/') > 2) else "") +
|
||||||
("/".join(dirName.split('/')[3:]))) # chop tempdir
|
("/".join(dirName.split('/')[3:]))) # chop tempdir
|
||||||
if g.extractFile: # solo item, so don't put it in the tree
|
if g.extractFile: # solo item, so don't put it in the tree
|
||||||
g.targetDir = targetDir
|
g.targetDir = targetDir
|
||||||
if g.UC:
|
if g.UC:
|
||||||
@@ -1266,9 +1243,9 @@ if g.SHK:
|
|||||||
# disk image; rename to include suffix and correct type/auxtype
|
# disk image; rename to include suffix and correct type/auxtype
|
||||||
imagePath = os.path.join(dirName, fname).split("#")[0]
|
imagePath = os.path.join(dirName, fname).split("#")[0]
|
||||||
new_name = (imagePath +
|
new_name = (imagePath +
|
||||||
("" if (imagePath.lower().endswith(".po") or
|
("" if (imagePath.lower().endswith(".po") or
|
||||||
imagePath.lower().endswith(".hdv"))
|
imagePath.lower().endswith(".hdv"))
|
||||||
else ".PO") + "#e00005")
|
else ".PO") + "#e00005")
|
||||||
os.rename(os.path.join(dirName, fname), new_name)
|
os.rename(os.path.join(dirName, fname), new_name)
|
||||||
fname = os.path.basename(new_name)
|
fname = os.path.basename(new_name)
|
||||||
g.shk_hasrf = False
|
g.shk_hasrf = False
|
||||||
@@ -1294,44 +1271,31 @@ if (g.imageFile.lower().endswith(".2mg") or
|
|||||||
|
|
||||||
# handle 140K disk image
|
# handle 140K disk image
|
||||||
if (len(g.imageData) == 143360):
|
if (len(g.imageData) == 143360):
|
||||||
#print("140K disk")
|
|
||||||
prodosDisk = 0
|
prodosDisk = 0
|
||||||
fixOrder = 0
|
fixOrder = 0
|
||||||
# is it ProDOS?
|
# is it ProDOS?
|
||||||
if (to_hex(readchars(g.imageData, ts(0,0)+0, 4)) == '0138b003'):
|
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'):
|
if (readchars(g.imageData, ts(0,1)+3, 6) == b'PRODOS'):
|
||||||
prodosDisk = 1
|
prodosDisk = 1
|
||||||
#print("order OK (PO)")
|
|
||||||
elif (readchars(g.imageData, ts(0,14)+3, 6) == b'PRODOS'):
|
elif (readchars(g.imageData, ts(0,14)+3, 6) == b'PRODOS'):
|
||||||
#print("order needs fixing (DO)")
|
|
||||||
prodosDisk = 1
|
prodosDisk = 1
|
||||||
fixOrder = 1
|
fixOrder = 1
|
||||||
# is it DOS 3.3?
|
# is it DOS 3.3?
|
||||||
else:
|
else:
|
||||||
#print("it's not ProDOS")
|
|
||||||
if (readcharDec(g.imageData, ts(17,0)+3) == 3):
|
if (readcharDec(g.imageData, ts(17,0)+3) == 3):
|
||||||
vtocT = readcharDec(g.imageData, ts(17,0)+1)
|
vtocT = readcharDec(g.imageData, ts(17,0)+1)
|
||||||
vtocS = readcharDec(g.imageData, ts(17,0)+2)
|
vtocS = readcharDec(g.imageData, ts(17,0)+2)
|
||||||
if (vtocT<35 and vtocS<16):
|
if (vtocT<35 and vtocS<16):
|
||||||
#print("it's DOS 3.3")
|
|
||||||
g.D33 = 1
|
g.D33 = 1
|
||||||
# it's DOS 3.3; check sector order next
|
# it's DOS 3.3; check sector order next
|
||||||
if (readcharDec(g.imageData, ts(17,14)+2) != 13):
|
if (readcharDec(g.imageData, ts(17,14)+2) != 13):
|
||||||
#print("order needs fixing (PO)")
|
|
||||||
fixOrder = 1
|
fixOrder = 1
|
||||||
#else: # remove this
|
|
||||||
# print("order OK (DO)")
|
|
||||||
# pass
|
|
||||||
# fall back on disk extension if weird boot block (e.g. AppleCommander)
|
# fall back on disk extension if weird boot block (e.g. AppleCommander)
|
||||||
if not prodosDisk and not g.D33:
|
if not prodosDisk and not g.D33:
|
||||||
#print("format and ordering unknown, checking extension")
|
|
||||||
if (g.imageFile.lower().endswith(".dsk") or
|
if (g.imageFile.lower().endswith(".dsk") or
|
||||||
g.imageFile.lower().endswith(".do")):
|
g.imageFile.lower().endswith(".do")):
|
||||||
fixOrder = 1
|
fixOrder = 1
|
||||||
# print("extension indicates DO, changing to PO")
|
|
||||||
if fixOrder:
|
if fixOrder:
|
||||||
#print("fixing order")
|
|
||||||
# for each track,
|
# for each track,
|
||||||
# read each sector in the right sequence to make
|
# read each sector in the right sequence to make
|
||||||
# valid ProDOS blocks (sector pairs)
|
# valid ProDOS blocks (sector pairs)
|
||||||
@@ -1339,12 +1303,9 @@ if (len(g.imageData) == 143360):
|
|||||||
for t in range(0, 35):
|
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]:
|
for s in [0, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 15]:
|
||||||
writechars(imageDataFixed,
|
writechars(imageDataFixed,
|
||||||
ts(t,((15-s) if (s%15) else s)),
|
ts(t,((15-s) if (s%15) else s)),
|
||||||
readchars(g.imageData, ts(t,s), 256))
|
readchars(g.imageData, ts(t,s), 256))
|
||||||
g.imageData = bytes(imageDataFixed)
|
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:
|
if not prodosDisk and not g.D33:
|
||||||
print("Warning: Unable to determine disk format, assuming ProDOS.")
|
print("Warning: Unable to determine disk format, assuming ProDOS.")
|
||||||
@@ -1367,7 +1328,7 @@ if g.D33:
|
|||||||
diskName = toProdosName(diskName)
|
diskName = toProdosName(diskName)
|
||||||
if not g.CAT:
|
if not g.CAT:
|
||||||
g.targetDir = (args[3] if g.extractFile
|
g.targetDir = (args[3] if g.extractFile
|
||||||
else (args[2] + "/" + diskName))
|
else (args[2] + "/" + diskName))
|
||||||
g.ADdir = (g.targetDir + "/.AppleDouble")
|
g.ADdir = (g.targetDir + "/.AppleDouble")
|
||||||
makedirs(g.targetDir)
|
makedirs(g.targetDir)
|
||||||
if g.AD:
|
if g.AD:
|
||||||
@@ -1404,7 +1365,6 @@ if g.extractFile:
|
|||||||
quitNow(2)
|
quitNow(2)
|
||||||
else:
|
else:
|
||||||
if not g.CAT:
|
if not g.CAT:
|
||||||
# print(args[0], args[1], args[2])
|
|
||||||
g.targetDir = (args[2] + "/" + getVolumeName().decode("L1"))
|
g.targetDir = (args[2] + "/" + getVolumeName().decode("L1"))
|
||||||
g.ADdir = (g.targetDir + "/.AppleDouble")
|
g.ADdir = (g.targetDir + "/.AppleDouble")
|
||||||
if not os.path.isdir(g.targetDir):
|
if not os.path.isdir(g.targetDir):
|
||||||
|
@@ -452,18 +452,6 @@ if [[ ! -f $imagesDir/INSTALL.HDV ]] \
|
|||||||
|| [[ ! -f $imagesDir/"$gsosHD" ]] \
|
|| [[ ! -f $imagesDir/"$gsosHD" ]] \
|
||||||
|| [[ ! $kegs && ! -f $imagesDir/spectrum.hdv ]]; then
|
|| [[ ! $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"
|
REPLY="y"
|
||||||
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
|
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
|
||||||
|
|
||||||
@@ -513,7 +501,6 @@ if [[ ! -f $imagesDir/INSTALL.HDV ]] \
|
|||||||
|
|
||||||
echo "Copying ProDOS..."
|
echo "Copying ProDOS..."
|
||||||
acmd -g "$imagesDir/INSTALL.HDV" PRODOS "PRODOS#ff0000"
|
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
|
wget -qO- ${binaryURL}${emulatorName}SPLASH.SYS | dd of="PRODOS#ff0000" conv=notrunc &> /dev/null
|
||||||
echo "Copying Teach..."
|
echo "Copying Teach..."
|
||||||
cppo -uc -e $imagesDir/SYSTEMTOOLS2.HDV /SYSTEMTOOLS2/TEACH . &> /dev/null
|
cppo -uc -e $imagesDir/SYSTEMTOOLS2.HDV /SYSTEMTOOLS2/TEACH . &> /dev/null
|
||||||
@@ -524,13 +511,11 @@ if [[ ! -f $imagesDir/INSTALL.HDV ]] \
|
|||||||
echo 2
|
echo 2
|
||||||
acmd -convert $gsosHD.shk $imagesDir/"$gsosHD" 65535
|
acmd -convert $gsosHD.shk $imagesDir/"$gsosHD" 65535
|
||||||
echo 3
|
echo 3
|
||||||
rm "PRODOS#"* "GSHK#"* "TEACH#"* $gsosHD.shk &> /dev/null
|
rm "PRODOS#"* "GSHK#"* "TEACH#"* $gsosHD.shk &> /dev/null
|
||||||
|
|
||||||
acmd -n $imagesDir/"$gsosHD" $gsosHDvolName
|
acmd -n $imagesDir/"$gsosHD" $gsosHDvolName
|
||||||
dd bs=512 count=1 conv=notrunc if="$imagesDir/INSTALL.HDV" of="$imagesDir/$gsosHD" 2> /dev/null
|
dd bs=512 count=1 conv=notrunc if="$imagesDir/INSTALL.HDV" of="$imagesDir/$gsosHD" 2> /dev/null
|
||||||
sudo chmod ugo+rw $imagesDir/"$gsosHD"
|
sudo chmod ugo+rw $imagesDir/"$gsosHD"
|
||||||
#acmd -p "$imagesDir/$gsosHD" PRODOS SYS < $tempDir/PRODOS
|
|
||||||
#rm $tempDir/PRODOS
|
|
||||||
fi
|
fi
|
||||||
echo 4
|
echo 4
|
||||||
if [[ $(grep ^s7d1 /usr/local/lib/$configFileName) ]]; then
|
if [[ $(grep ^s7d1 /usr/local/lib/$configFileName) ]]; then
|
||||||
|
@@ -95,9 +95,6 @@ while [[ $1 ]]; do
|
|||||||
elif [[ $1 == "-6" ]]; then
|
elif [[ $1 == "-6" ]]; then
|
||||||
shift
|
shift
|
||||||
slot6=1
|
slot6=1
|
||||||
# elif [[ $1 == "-os" || $1 == "os" ]]; then
|
|
||||||
# shift
|
|
||||||
# updateRasppleII=1
|
|
||||||
elif [[ $1 == "-v" ]]; then
|
elif [[ $1 == "-v" ]]; then
|
||||||
shift
|
shift
|
||||||
# Version was already printed
|
# Version was already printed
|
||||||
@@ -121,14 +118,6 @@ while [[ $1 ]]; do
|
|||||||
fi
|
fi
|
||||||
done
|
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
|
||||||
echo "Your $fullme will be set up for A2CLOUD, providing you"
|
echo "Your $fullme will be set up for A2CLOUD, providing you"
|
||||||
echo " with mass storage and online access for your Apple II!"
|
echo " with mass storage and online access for your Apple II!"
|
||||||
@@ -149,15 +138,6 @@ if [[ ! $autoAnswerYes ]]; then
|
|||||||
fi
|
fi
|
||||||
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
|
installAllFeatures=1 # as of 1.9.0
|
||||||
|
|
||||||
if [[ $installAllFeatures ]]; then
|
if [[ $installAllFeatures ]]; then
|
||||||
@@ -438,30 +418,6 @@ if [[ $installADTPro ]]; then
|
|||||||
echo "A2CLOUD: can't disable GUI at startup: unrecognized init system."
|
echo "A2CLOUD: can't disable GUI at startup: unrecognized init system."
|
||||||
fi
|
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
|
# install or update java
|
||||||
javaVersion=$(java -version 2>&1)
|
javaVersion=$(java -version 2>&1)
|
||||||
if [[ ( $? -eq 127 ) || ( $(head -1 <<< "$javaVersion" | cut -f 2 -d '.') -lt 8 ) ]]; then
|
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 /usr/local/adtpro/disks/VDRIVE*.DSK &> /dev/null
|
||||||
sudo rm -r /tmp/a2cloud-install/disks &> /dev/null
|
sudo rm -r /tmp/a2cloud-install/disks &> /dev/null
|
||||||
sudo mv /usr/local/adtpro/disks /tmp/a2cloud-install
|
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/ac.sh \
|
||||||
/usr/local/adtpro/adtpro.bat \
|
/usr/local/adtpro/adtpro.bat \
|
||||||
/usr/local/adtpro/adtpro.cmd \
|
/usr/local/adtpro/adtpro.cmd \
|
||||||
/usr/local/adtpro/ADTPro.html \
|
/usr/local/adtpro/ADTPro.html \
|
||||||
/usr/local/adtpro/adtpro.sh \
|
/usr/local/adtpro/adtpro.sh \
|
||||||
/usr/local/adtpro/lib \
|
/usr/local/adtpro/lib \
|
||||||
/usr/local/adtpro/LICENSE \
|
/usr/local/adtpro/LICENSE \
|
||||||
/usr/local/adtpro/README \
|
/usr/local/adtpro/README \
|
||||||
&> /dev/null
|
&>/dev/null
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "A2CLOUD: ADTPro server does not need updating."
|
echo "A2CLOUD: ADTPro server does not need updating."
|
||||||
@@ -792,10 +748,10 @@ if [[ $setupSerialPortLogin ]]; then
|
|||||||
pwd=$PWD
|
pwd=$PWD
|
||||||
cd /etc/systemd/system/getty.target.wants
|
cd /etc/systemd/system/getty.target.wants
|
||||||
grep -o 'SYMLINK+="ttyUSB.*,' /etc/udev/rules.d/50-usb.rules | cut -d '"' -f 2 | \
|
grep -o 'SYMLINK+="ttyUSB.*,' /etc/udev/rules.d/50-usb.rules | cut -d '"' -f 2 | \
|
||||||
while read ttyUSB; do
|
while read ttyUSB; do
|
||||||
sudo rm usbgetty@${ttyUSB}.service 2> /dev/null
|
sudo rm usbgetty@${ttyUSB}.service 2> /dev/null
|
||||||
sudo ln -s usbgetty@.service usbgetty@${ttyUSB}.service
|
sudo ln -s usbgetty@.service usbgetty@${ttyUSB}.service
|
||||||
done
|
done
|
||||||
cd "$pwd"
|
cd "$pwd"
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
elif [[ -n "$isSysVInit" ]]; then
|
elif [[ -n "$isSysVInit" ]]; then
|
||||||
@@ -940,12 +896,9 @@ if [[ $installCommTools ]]; then
|
|||||||
|
|
||||||
### CommTools: Install Oysttyer (formerly TTYtter)
|
### CommTools: Install Oysttyer (formerly TTYtter)
|
||||||
# Do we need to check for the readline module here as well?
|
# 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-)
|
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
|
if ! hash ttytter 2> /dev/null || [[ ! -f /usr/local/share/perl/${perlVersion}/Term/ReadLine/TTYtter.pm ]]; then
|
||||||
echo "A2CLOUD: Installing Oysttyer..."
|
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
|
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 rm /usr/local/bin/ttytter 2> /dev/null
|
||||||
sudo ln -s /usr/local/bin/oysttyer /usr/local/bin/ttytter
|
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
|
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
|
tar jxf linapple_src-2b.tar.bz2
|
||||||
cd linapple_src-2b/src
|
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
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
cd /tmp/a2cloud-install
|
cd /tmp/a2cloud-install
|
||||||
|
@@ -28,9 +28,9 @@ elif [[ $1 == "add" ]]; then
|
|||||||
[[ $2 == "ttyUSBlower" ]] && sleep 1.5
|
[[ $2 == "ttyUSBlower" ]] && sleep 1.5
|
||||||
[[ ${#2} -gt 11 ]] && sleep "${2:15:2}"
|
[[ ${#2} -gt 11 ]] && sleep "${2:15:2}"
|
||||||
if [[ $2 == "ttyUSBlower" || \
|
if [[ $2 == "ttyUSBlower" || \
|
||||||
$2 == $(ls -1 /dev/ttyUSBlower_hub* 2> /dev/null | head -1 | cut -c 6-) || \
|
$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-) ) \
|
( ${2:0:12} == "ttyUSBlower_" && $2 != $(ls -1 /dev/ttyUSBupper_hub* 2> /dev/null | tail -1 | cut -c 6-) ) \
|
||||||
]]; then
|
]]; then
|
||||||
rm /tmp/udev-ttyUSBlower-added &> /dev/null
|
rm /tmp/udev-ttyUSBlower-added &> /dev/null
|
||||||
touch /tmp/udev-ttyUSBlower-added
|
touch /tmp/udev-ttyUSBlower-added
|
||||||
pkill -f "[A]DTPro"
|
pkill -f "[A]DTPro"
|
||||||
|
@@ -1,42 +1,42 @@
|
|||||||
# This file is part of systemd.
|
# This file is part of systemd.
|
||||||
#
|
#
|
||||||
# systemd is free software; you can redistribute it and/or modify it
|
# 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
|
# 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
|
# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
# This file is adapted for A2CLOUD. It to be called usbgetty@.service
|
# This file is adapted for A2CLOUD. It to be called usbgetty@.service
|
||||||
# and needs to be placed in /etc/systemd/system/getty.target.wants/
|
# 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
|
# Symlinks pointing to it need to be in place for every serial port
|
||||||
# defined in /etc/udev/rules.d/50-usb.rules, e.g.
|
# defined in /etc/udev/rules.d/50-usb.rules, e.g.
|
||||||
# usbgetty@ttyUSBupper.service -> usbgetty@.service
|
# usbgetty@ttyUSBupper.service -> usbgetty@.service
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Serial Getty on %I
|
Description=Serial Getty on %I
|
||||||
Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
||||||
Documentation=http://0pointer.de/blog/projects/serial-console.html
|
Documentation=http://0pointer.de/blog/projects/serial-console.html
|
||||||
BindsTo=dev-%i.device
|
BindsTo=dev-%i.device
|
||||||
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
|
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
|
||||||
After=rc-local.service
|
After=rc-local.service
|
||||||
|
|
||||||
# If additional gettys are spawned during boot then we should make
|
# If additional gettys are spawned during boot then we should make
|
||||||
# sure that this is synchronized before getty.target, even though
|
# sure that this is synchronized before getty.target, even though
|
||||||
# getty.target didn't actually pull it in.
|
# getty.target didn't actually pull it in.
|
||||||
Before=getty.target
|
Before=getty.target
|
||||||
IgnoreOnIsolate=yes
|
IgnoreOnIsolate=yes
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
#ExecStart=-/sbin/agetty %I 4800 $TERM
|
#ExecStart=-/sbin/agetty %I 4800 $TERM
|
||||||
ExecStart=-/usr/local/sbin/usbgetty -h -L -scanttyUSB 4800 vt100
|
ExecStart=-/usr/local/sbin/usbgetty -h -L -scanttyUSB 4800 vt100
|
||||||
Type=idle
|
Type=idle
|
||||||
Restart=always
|
Restart=always
|
||||||
UtmpIdentifier=%I
|
UtmpIdentifier=%I
|
||||||
TTYPath=/dev/%I
|
TTYPath=/dev/%I
|
||||||
TTYReset=yes
|
TTYReset=yes
|
||||||
TTYVHangup=yes
|
TTYVHangup=yes
|
||||||
KillMode=process
|
KillMode=process
|
||||||
IgnoreSIGPIPE=no
|
IgnoreSIGPIPE=no
|
||||||
SendSIGHUP=yes
|
SendSIGHUP=yes
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=getty.target
|
WantedBy=getty.target
|
||||||
|
@@ -7,7 +7,6 @@ pkill -f "sleep 86399"
|
|||||||
|
|
||||||
if [[ $(grep -e '-scanttyUSB' <<< "$*") ]]; then
|
if [[ $(grep -e '-scanttyUSB' <<< "$*") ]]; then
|
||||||
# called with -scantty isntead of device name?
|
# called with -scantty isntead of device name?
|
||||||
# echo "-scantty mode"
|
|
||||||
|
|
||||||
# if upper USB port
|
# if upper USB port
|
||||||
if [[ -c /dev/ttyUSBupper ]]; then
|
if [[ -c /dev/ttyUSBupper ]]; then
|
||||||
@@ -23,17 +22,13 @@ if [[ $(grep -e '-scanttyUSB' <<< "$*") ]]; then
|
|||||||
|
|
||||||
# no port found eligible for getty
|
# no port found eligible for getty
|
||||||
else
|
else
|
||||||
# echo "scantty no devices eligible: sleeping"
|
|
||||||
sleep 86399
|
sleep 86399
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# echo "result:$ttyUSB"
|
|
||||||
elif [[ $(grep -o 'ttyUSB[^ ]*' <<< "$*") ]]; then
|
elif [[ $(grep -o 'ttyUSB[^ ]*' <<< "$*") ]]; then
|
||||||
# echo "device specified"
|
|
||||||
# if specified USB device name is found
|
# if specified USB device name is found
|
||||||
ttyUSB=$(grep -o 'ttyUSB[^ ]*' <<< "$*")
|
ttyUSB=$(grep -o 'ttyUSB[^ ]*' <<< "$*")
|
||||||
else
|
else
|
||||||
# echo "specified device failed: sleeping"
|
|
||||||
sleep 86399
|
sleep 86399
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -43,6 +38,5 @@ if [[ -c /dev/$ttyUSB && ! $(ps aux | grep "[g]etty.*$ttyUSB") ]]; then
|
|||||||
pkill -f "/sbin/getty.*ttyUSB"
|
pkill -f "/sbin/getty.*ttyUSB"
|
||||||
exec /sbin/getty $(sed "s/-scanttyUSB/$ttyUSB/" <<< "$@");
|
exec /sbin/getty $(sed "s/-scanttyUSB/$ttyUSB/" <<< "$@");
|
||||||
else
|
else
|
||||||
# echo "getty already running or doesn't exist: sleeping"
|
|
||||||
sleep 86399
|
sleep 86399
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user