I was trying to install a Kindle application, KNotes. I downloaded the zip file to my PW2 using curl. I then tried running the command kpm -U knotes.zip, but received this output:
Copying knotes.zip -> /mnt/us/kpm/packages/knotes
Extracting ZIP...
Archive: /mnt/us/kpm/packages/knotes
unzip: short read
unzip failed with exit code 1
Perusing the source code, and testing by manually duplicating the unzip command on my device, the error seems to be a result of the fact that outpath and pkgdir have the same value, the zip file is being copied into outpath instead of INSTALL_DIR (where the zips downloaded when running kpm -S package_name appear to go), and then the "archive" specified to unzip (and tar seems to be treated the same) is actually the name of the directory the zip file is thrown into, outpath, instead of the path of the zip file itself.
I believe the fix is as simple as making outpath be INSTALL_DIR/package.zip (or w/e the correct file extension is) instead of INSTALL_DIR/package
if I have time later I may try to create a pull request to fix this since it looks pretty straight-forward, but I haven't actually set up a dev environment for kindle apps yet :p
Side note, it occurs to me that kpm probably can't install the application I was trying to in the method I was attempting to since it doesn't have its own install.kpm, but given the error occurred before reaching this point, I believe the error still would have occurred even if it did. I do wonder if there's a way this could be made to work, tho.
I was trying to install a Kindle application, KNotes. I downloaded the zip file to my PW2 using curl. I then tried running the command
kpm -U knotes.zip, but received this output:Perusing the source code, and testing by manually duplicating the unzip command on my device, the error seems to be a result of the fact that
outpathandpkgdirhave the same value, the zip file is being copied intooutpathinstead ofINSTALL_DIR(where the zips downloaded when runningkpm -S package_nameappear to go), and then the "archive" specified tounzip(andtarseems to be treated the same) is actually the name of the directory the zip file is thrown into,outpath, instead of the path of the zip file itself.I believe the fix is as simple as making
outpathbeINSTALL_DIR/package.zip(or w/e the correct file extension is) instead ofINSTALL_DIR/packageif I have time later I may try to create a pull request to fix this since it looks pretty straight-forward, but I haven't actually set up a dev environment for kindle apps yet :p
Side note, it occurs to me that kpm probably can't install the application I was trying to in the method I was attempting to since it doesn't have its own
install.kpm, but given the error occurred before reaching this point, I believe the error still would have occurred even if it did. I do wonder if there's a way this could be made to work, tho.