mirror of
https://github.com/RasppleII/a2cloud.git
synced 2025-02-12 12:30:52 +00:00
*.txt: Trailing whitespace removal
This commit is contained in:
parent
40b55a599e
commit
78d247a0ef
@ -218,7 +218,7 @@ if [[ ( $arg1 == "-p" || $arg1 == "-c" || $arg1 == "-g" || $arg1 == "-e" ) && $2
|
||||
[[ $3 && $3 != "-" ]] && outFile="$3"
|
||||
[[ ! $3 ]] && outFile="${2##*/}"
|
||||
$ac $getArg "$imageArg" "$fileArg" $outFile 2> $acmdStdErr
|
||||
|
||||
|
||||
else # put file
|
||||
|
||||
# test ProDOS name validity
|
||||
@ -256,7 +256,7 @@ if [[ ( $arg1 == "-p" || $arg1 == "-c" || $arg1 == "-g" || $arg1 == "-e" ) && $2
|
||||
else
|
||||
ft="$ftArg"
|
||||
fi
|
||||
|
||||
|
||||
# set auxtype to $0801 for Applesoft programs if not specified
|
||||
[[ $ft == "BAS" && ! $auxType ]] && auxType="\$0801"
|
||||
|
||||
@ -268,9 +268,9 @@ if [[ ( $arg1 == "-p" || $arg1 == "-c" || $arg1 == "-g" || $arg1 == "-e" ) && $2
|
||||
else
|
||||
$ac -d "$imageArg" $prodosPath &> /dev/null
|
||||
$ac -p "$imageArg" $prodosPath $ft $auxType 2> $acmdStdErr
|
||||
fi
|
||||
fi
|
||||
else # AppleDouble or nulib extended, get resource fork and file metadata from header file
|
||||
|
||||
|
||||
[[ ! -f $prodosArg ]] && { echoerr "$prodosArg not found."; exit 1; }
|
||||
[[ $AD && ! -f $rFile ]] && { echoerr "Not an AppleDouble file: $rFile"; exit 1; }
|
||||
|
||||
@ -372,20 +372,20 @@ if [[ ( $arg1 == "-p" || $arg1 == "-c" || $arg1 == "-g" || $arg1 == "-e" ) && $2
|
||||
| dd of="$imageArg" conv=notrunc bs=1 seek=$((parentDirKeyBlockOffset+4+33)) 2> /dev/null
|
||||
|
||||
# update extended file metadata
|
||||
|
||||
|
||||
# storage type (5), name length, name
|
||||
name="${prodosPath##*/}"
|
||||
nameLen=${#name}
|
||||
nameHeader=$(printf %02X $((nameLen + 80)) )
|
||||
nameField=$(echo -n $name | xxd -p | tr -d '\n' | sed -e :a -e 's/^.\{1,29\}$/&00/;ta')
|
||||
|
||||
|
||||
# blocks used
|
||||
blocksUsed=$(( dfBlocksUsed + rfBlocksUsed + 1 ))
|
||||
|
||||
|
||||
# store updated metadata
|
||||
fileEntry=${nameHeader}${nameField}${fileEntry:32}
|
||||
fi
|
||||
|
||||
|
||||
# put creation and modified date in file entry
|
||||
fileEntry=${fileEntry:0:48}${cDateTimeHex}${fileEntry:56:10}${mDateTimeHex}${fileEntry:74:4}
|
||||
|
||||
|
@ -13,7 +13,7 @@ options:
|
||||
-e : Nulib2-compatible filenames with type/auxtype and resource forks.
|
||||
-uc : Copy GS/OS mixed case filenames as uppercase.
|
||||
-pro: Adapt DOS 3.3 names to ProDOS and remove addr/len from file data.
|
||||
|
||||
|
||||
/extract/path examples:
|
||||
/FULL/PRODOS/PATH (ProDOS image source)
|
||||
"MY FILENAME" (DOS 3.3 image source)
|
||||
@ -125,7 +125,7 @@ def unixDateToADDate(arg1):
|
||||
# returns byte position in disk image file
|
||||
def getStartPos(arg1, arg2):
|
||||
if g.D33:
|
||||
return (ts(arg1) + (35 * (arg2 % 7)) + 11)
|
||||
return (ts(arg1) + (35 * (arg2 % 7)) + 11)
|
||||
else: # ProDOS
|
||||
return ( (arg1 * 512) +
|
||||
(39 * ((arg2 + (arg2 > 11)) % 13)) +
|
||||
@ -154,7 +154,7 @@ def getFileName(arg1, arg2):
|
||||
for i in range(0, len(fileName)):
|
||||
if (caseMask[i] == "1"):
|
||||
fileName = (fileName[:i] +
|
||||
fileName[i:i+1].lower() +
|
||||
fileName[i:i+1].lower() +
|
||||
fileName[i+1:])
|
||||
return fileName
|
||||
|
||||
@ -208,7 +208,7 @@ def getKeyPointer(arg1, arg2):
|
||||
start = getStartPos(arg1, arg2)
|
||||
if g.D33:
|
||||
return [readcharDec(g.imageData, start+0),
|
||||
readcharDec(g.imageData, start+1)]
|
||||
readcharDec(g.imageData, start+1)]
|
||||
else: # ProDOS
|
||||
return (readcharDec(g.imageData, start+17) +
|
||||
readcharDec(g.imageData, start+18)*256)
|
||||
@ -228,7 +228,7 @@ def getFileLength(arg1, arg2):
|
||||
elif (fileType == 'FC' or fileType == 'FA'): # BAS (A) or INT (I)
|
||||
# file length is in first two bytes of file data
|
||||
return ((readcharDec(g.imageData, ts(fileStart)+0) +
|
||||
readcharDec(g.imageData, ts(fileStart)+1)*256) + 2)
|
||||
readcharDec(g.imageData, ts(fileStart)+1)*256) + 2)
|
||||
else: # TXT (T) or other
|
||||
# sadly, we have to walk the whole file
|
||||
# length is determined by sectors in TSlist, minus wherever
|
||||
@ -338,7 +338,7 @@ 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:i+1].lower() +
|
||||
workingDirName[i+1:])
|
||||
return workingDirName
|
||||
|
||||
@ -399,7 +399,7 @@ def ts(track, sector=None):
|
||||
if isinstance(sector, type("".encode("L1").decode("L1"))): # hex-ustr
|
||||
sector = int(sector, 16)
|
||||
return (track*16*256)+(sector*256)
|
||||
|
||||
|
||||
# --- main logic functions
|
||||
|
||||
def copyFile(arg1, arg2):
|
||||
@ -409,7 +409,7 @@ def copyFile(arg1, arg2):
|
||||
# ShrinkIt: directory path / file name
|
||||
# copies file or dfork to g.outFileData, rfork if any to g.exFileData
|
||||
g.activeFileBytesCopied = 0
|
||||
|
||||
|
||||
if g.SHK:
|
||||
with open(os.path.join(arg1, arg2), 'rb') as infile:
|
||||
g.outFileData += infile.read()
|
||||
@ -523,7 +523,7 @@ def processEntry(arg1, arg2):
|
||||
getFileLength(arg1, arg2), getAuxType(arg1, arg2),
|
||||
getCreationDate(arg1, arg2), getModifiedDate(arg1, arg2))
|
||||
'''
|
||||
|
||||
|
||||
eTargetName = None
|
||||
g.exFileData = None
|
||||
g.outFileData = bytearray(b'')
|
||||
@ -541,7 +541,7 @@ def processEntry(arg1, arg2):
|
||||
|
||||
if (not g.PDOSPATH_INDEX or
|
||||
g.activeFileName.upper() == g.PDOSPATH_SEGMENT.upper()):
|
||||
|
||||
|
||||
# if ProDOS directory, not file
|
||||
if (not g.SHK and getStorageType(arg1, arg2) == 13):
|
||||
if not g.PDOSPATH_INDEX:
|
||||
@ -620,7 +620,7 @@ def processEntry(arg1, arg2):
|
||||
writecharsHex(g.exFileData,
|
||||
654,
|
||||
getFileType(arg1, arg2) +
|
||||
getAuxType(arg1, arg2))
|
||||
getAuxType(arg1, arg2))
|
||||
writechars(g.exFileData, 657, b'pdos')
|
||||
saveFile(ADfilePath, g.exFileData)
|
||||
touch(saveName, modifiedDate)
|
||||
@ -632,7 +632,7 @@ def processEntry(arg1, arg2):
|
||||
(g.extractFile and
|
||||
(g.extractFile.lower() == origFileName.lower()))):
|
||||
quitNow(0)
|
||||
g.targetName = None
|
||||
g.targetName = None
|
||||
#else:
|
||||
#print(g.activeFileName + " doesn't match " + g.PDOSPATH_SEGMENT)
|
||||
|
||||
@ -791,7 +791,7 @@ def binToDec(arg1):
|
||||
# arg: binary string up to 8 bits
|
||||
# out: decimal value
|
||||
return to_dec([arg1])
|
||||
|
||||
|
||||
def binToHex(arg1):
|
||||
# converts single-byte binary string (8 bits) value to hex
|
||||
# warning: no error checking
|
||||
@ -994,10 +994,10 @@ def to_bytes(val):
|
||||
else:
|
||||
raise Exception(
|
||||
"to_bytes() requires hex-ustr, int/long, or [bin-ustr]")
|
||||
|
||||
|
||||
def shift(items):
|
||||
"""Shift list items to left, losing the first item.
|
||||
|
||||
|
||||
in : list
|
||||
out: list
|
||||
"""
|
||||
@ -1005,7 +1005,7 @@ def shift(items):
|
||||
items[i] = items[i+1]
|
||||
del items[-1]
|
||||
return items
|
||||
|
||||
|
||||
def s(string):
|
||||
"""Perform local variable substution, e.g. 'total: {num} items'"""
|
||||
# http://stackoverflow.com/questions/2960772/
|
||||
@ -1101,14 +1101,14 @@ while True: # breaks when there are no more arguments starting with dash
|
||||
|
||||
if (len(args) == 1):
|
||||
usage()
|
||||
|
||||
|
||||
if (slyce(args[1],0,1) != "-"):
|
||||
break
|
||||
|
||||
if (args[1] == "-s"):
|
||||
g.nomsg = 1
|
||||
args = args[1:] #shift
|
||||
|
||||
|
||||
elif (args[1] == "-n"):
|
||||
g.nodir = 1
|
||||
args = args[1:] #shift
|
||||
@ -1121,7 +1121,7 @@ while True: # breaks when there are no more arguments starting with dash
|
||||
g.AD = 1
|
||||
g.PNAME = 1
|
||||
args = args[1:] #shift
|
||||
|
||||
|
||||
elif (args[1] == "-shk"):
|
||||
g.SHK = 1
|
||||
args = args[1:] #shift
|
||||
@ -1191,7 +1191,7 @@ else:
|
||||
if not os.path.isdir(args[2]):
|
||||
print("Target directory not found.")
|
||||
quitNow(2)
|
||||
|
||||
|
||||
if g.SHK:
|
||||
g.PNAME = 0
|
||||
if not g.CAT:
|
||||
@ -1284,7 +1284,7 @@ if g.SHK:
|
||||
quitNow(0)
|
||||
|
||||
# end script if SHK
|
||||
|
||||
|
||||
g.imageData = loadFile(g.imageFile)
|
||||
|
||||
# detect if image is 2mg and remove 64-byte header if so
|
||||
@ -1345,7 +1345,7 @@ if (len(g.imageData) == 143360):
|
||||
#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.")
|
||||
|
||||
|
@ -387,7 +387,7 @@ fi
|
||||
|
||||
if [[ $slot6 ]]; then
|
||||
echo "Putting blank disks in slot 6..."
|
||||
sudo sed -i 's@^s6d1.*$@s6d1 = $imagesDir/slot6drive1.po@' /usr/local/lib/$configFileName
|
||||
sudo sed -i 's@^s6d1.*$@s6d1 = $imagesDir/slot6drive1.po@' /usr/local/lib/$configFileName
|
||||
sudo sed -i 's@^s6d2.*$@s6d2 = $imagesDir/slot6drive2.po@' /usr/local/lib/$configFileName
|
||||
if [[ ! -f $imagesDir/slot6drive1.po || ! -f $imagesDir/slot6drive2.po ]]; then
|
||||
wget -qO- ${binaryURL}slot6.tgz | sudo tar Pzx 2> /dev/null
|
||||
@ -467,7 +467,7 @@ if [[ ! -f $imagesDir/INSTALL.HDV ]] \
|
||||
REPLY="y"
|
||||
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
|
||||
|
||||
echo
|
||||
echo
|
||||
activeDisk=0
|
||||
for diskname in Install System.Disk SystemTools1 SystemTools2 Fonts synthLAB; do
|
||||
(( activeDisk++ ))
|
||||
@ -497,7 +497,7 @@ if [[ ! -f $imagesDir/INSTALL.HDV ]] \
|
||||
fi
|
||||
done
|
||||
rm *.sea* &> /dev/null
|
||||
|
||||
|
||||
if [[ ! -f $imagesDir/"$gsosHD" ]]; then
|
||||
echo "Creating 32 MB blank image at $imagesDir/$gsosHD..."
|
||||
if [[ -f /usr/local/bin/acmd ]]; then
|
||||
@ -525,7 +525,7 @@ if [[ ! -f $imagesDir/INSTALL.HDV ]] \
|
||||
acmd -convert $gsosHD.shk $imagesDir/"$gsosHD" 65535
|
||||
echo 3
|
||||
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"
|
||||
@ -539,7 +539,7 @@ if [[ ! -f $imagesDir/INSTALL.HDV ]] \
|
||||
echo "s7d1 = $imagesDir/$gsosHD" | tee -a /usr/local/lib/$configFileName > /dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [[ $(grep ^g_limit_speed /usr/local/lib/$configFileName) ]]; then
|
||||
sudo sed -i "s:^g_limit_speed.*$:g_limit_speed = 0:" /usr/local/lib/$configFileName
|
||||
else
|
||||
@ -551,26 +551,26 @@ if [[ ! -f $imagesDir/INSTALL.HDV ]] \
|
||||
echo "Downloading GS-ShrinkIt..."
|
||||
wget -qO- http://web.archive.org/web/20131031160750/http://nulib.com/library/gshk11.sea | acmd -p $imagesDir/$gsosHD GS.SHRINKIT.SEA S16
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
# Spectrum starts here
|
||||
|
||||
|
||||
if [[ ! $kegs ]]; then
|
||||
|
||||
|
||||
mkdir -p $tempDir/spectrum
|
||||
cd $tempDir/spectrum
|
||||
|
||||
|
||||
imageName="$tempDir/spectrum/spectrum.dmg"
|
||||
hfsName="$tempDir/spectrum/spectrumH.dmg"
|
||||
ullName="$tempDir/spectrum/uthernet.bxy"
|
||||
|
||||
|
||||
if [[ ! -f /usr/bin/hcopy || ! -f /usr/bin/macsave ]]; then
|
||||
echo "Installing HFS utilities..."
|
||||
sudo apt-get -y install hfsutils macutils &> /dev/null
|
||||
else
|
||||
echo "HFS utilities are already installed."
|
||||
fi
|
||||
|
||||
|
||||
if [[ ! -f /usr/local/adtpro/lib/AppleCommander/AppleCommander-1.3.5.13id-ac.jar ]]; then
|
||||
echo "Installing AppleCommander..."
|
||||
sudo mkdir -p /usr/local/adtpro/lib/AppleCommander
|
||||
@ -578,21 +578,21 @@ if [[ ! -f $imagesDir/INSTALL.HDV ]] \
|
||||
rm /usr/local/adtpro/lib/AppleCommander/AppleCommander-ac.jar &> /dev/null
|
||||
ln -s AppleCommander-1.3.5.13id-ac.jar /usr/local/adtpro/lib/AppleCommander/AppleCommander-ac.jar
|
||||
fi
|
||||
|
||||
|
||||
if [[ ! -f "$imageName" ]]; then
|
||||
echo "Downloading Spectrum Deluxe..."
|
||||
wget -qO spectrum.dmg http://www.wannop.info/speccie/software/spectrum_2.5.3_deluxe.dmg
|
||||
else
|
||||
echo "Spectrum Deluxe has already been downloaded."
|
||||
fi
|
||||
|
||||
|
||||
mkdir -p mnt
|
||||
mkdir -p extract
|
||||
mkdir -p shkstage
|
||||
cp "$imageName" "$hfsName"
|
||||
sudo mount -r -t hfs "$imageName" mnt
|
||||
hmount "$hfsName"
|
||||
|
||||
|
||||
IFS=''
|
||||
cd $tempDir/spectrum/mnt
|
||||
find Spectrum.2.5.3 -type d | while read thisDirPath; do
|
||||
@ -639,30 +639,30 @@ if [[ ! -f $imagesDir/INSTALL.HDV ]] \
|
||||
done
|
||||
cd $tempDir/spectrum/mnt
|
||||
done
|
||||
|
||||
|
||||
cd $tempDir/spectrum/shkstage/Spectrum*
|
||||
humount
|
||||
sudo umount $tempDir/spectrum/mnt
|
||||
|
||||
|
||||
mkdir -p Marinetti/Uthernet
|
||||
cp SAFE2.Archive/Link.Layers/"Uthernet#bc4083" Marinetti/Uthernet
|
||||
echo -n "After installing Marinetti, put Uthernet in the TCPIP folder of your System folder, and restart GS/OS. Then open Control Panels, choose TCP/IP, and choose Setup Connection. Choose Uthernet for the link layer. Under Primary Domain Name Server, enter 8.8.8.8, then click Configure and select Slot 3 and DHCP. Then click Save." > Marinetti/Uthernet/"Uthernet.README#040000"
|
||||
|
||||
|
||||
echo "Making archive for conversion to disk image..."
|
||||
rm $tempDir/spectrum/spectrum.shk 2> /dev/null
|
||||
nulib2 -a -r -0 -e $tempDir/spectrum/spectrum.shk * &> /dev/null
|
||||
echo "Converting archive to disk image..."
|
||||
acmd -convert $tempDir/spectrum/spectrum.shk $imagesDir/spectrum.hdv 20480
|
||||
acmd -n $imagesDir/spectrum.hdv SPECTRUM.DELUXE
|
||||
|
||||
|
||||
if [[ $(grep ^s7d7 /usr/local/lib/$configFileName) ]]; then
|
||||
sudo sed -i "s:^s7d7.*$:s7d7 = $imagesDir/spectrum.hdv:" /usr/local/lib/$configFileName
|
||||
else
|
||||
echo "s7d7 = $imagesDir/spectrum.hdv" | tee -a /usr/local/lib/$configFileName > /dev/null
|
||||
fi
|
||||
|
||||
|
||||
cd $tempDir
|
||||
|
||||
|
||||
rm -rf $tempDir/spectrum/extract $tempDir/spectrum/shkstage $tempDir/spectrum/spectrum.shk $tempDir/spectrum/mnt &> /dev/null
|
||||
fi
|
||||
# Spectrum ends here
|
||||
@ -698,7 +698,7 @@ fi
|
||||
echo "When it's done, reboot."
|
||||
echo "(Use Shut Down, ctrl-F12, or ctrl-solidapple-equals.)"
|
||||
if [[ -f "$imagesDir/spectrum.hdv" ]]; then
|
||||
echo
|
||||
echo
|
||||
echo "Then on the Spectrum disk, optionally install:"
|
||||
echo "Marinetti (plus update): TCP/IP driver for GS/OS"
|
||||
echo "Uthernet: Ethernet driver for Marinetti"
|
||||
|
@ -563,7 +563,7 @@ if [[ $installADTPro ]]; then
|
||||
wget -qO /usr/local/adtpro/adtpro.sh "${scriptURL}setup/adtpro.sh.txt"
|
||||
sudo chmod ugo+rwx /usr/local/adtpro/adtpro.sh
|
||||
|
||||
### ADTPro: Replace A2CLOUD's disks with the ones ...
|
||||
### ADTPro: Replace A2CLOUD's disks with the ones ...
|
||||
### FIXME: where are these created/downloaded to move?
|
||||
if [[ $updateADTPro ]]; then
|
||||
echo "A2CLOUD: Replacing disks folder..."
|
||||
@ -597,7 +597,7 @@ if [[ $installADTPro ]]; then
|
||||
else
|
||||
sharePath=/media/A2SHARED
|
||||
fi
|
||||
|
||||
|
||||
if [[ ! -d ${sharePath}/ADTDISKS || ! $(grep ADTDISKS /usr/local/etc/netatalk/AppleVolumes.default) ]]; then
|
||||
echo "A2CLOUD: Setting up /usr/local/adtpro/disks for Apple file sharing..."
|
||||
if [[ ! -d ${sharePath}/ADTDISKS ]]; then
|
||||
@ -1288,7 +1288,7 @@ if [[ -f /usr/bin/X ]]; then
|
||||
fi
|
||||
if [[ ! -f /usr/local/share/gsport32.ico ]]; then
|
||||
sudo wget -qO /usr/local/share/gsport32.ico ${binaryURL}gsport32.ico
|
||||
fi
|
||||
fi
|
||||
# LinApple:
|
||||
if [[ -f /usr/local/bin/linapple ]]; then
|
||||
echo -e "[Desktop Entry]\nName=LinApple\nComment=Apple IIe Emulator\nExec=lxterminal -e /usr/local/bin/linapple\nIcon=/usr/local/linapple/icon.bmp\nTerminal=false\nType=Application\nCategories=AppleII\n" | sudo tee /usr/share/raspi-ui-overrides/linapple.desktop > ~/Desktop/linapple.desktop
|
||||
|
Loading…
x
Reference in New Issue
Block a user