Download Fails Even When URL Correct
Closed this issue · 4 comments
I'm having problems executing the script (up to date Mountain Lion) because the new version of calibre fails to download. Upon running the bash script independently, I get the output pasted below. The error is strange, because I can manually download the grepped URL with no issues - I can even seem to run the script's curl command in terminal with no issue.
Output:
Logging output to /Users/chase/Library/Logs/calibre-installer.log...
Downloading the calibre release feed from http://code.google.com/feeds/p/calibre-ebook/downloads/basic...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 11704 0 11704 0 0 94853 0 --:--:-- --:--:-- --:--:-- 122k
Downloading calibre image from http://calibre-ebook.googlecode.com/files/calibre-0.9.35.dmg
http://calibre-ebook.googlecode.com/files/calibre-0.9.35.dmg...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 80.0M 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0Warning: Failed to create the file
Warning: http://calibre-ebook.googlecode.com/files/calibre-0.9.35.dmg: No such
Warning: file or directory
0 80.0M 0 1418 0 0 920 0 25:21:07 0:00:01 25:21:06 942
curl: (23) Failed writing body (0 != 1418)
Mounting /tmp/calibre-0.9.35.dmg to /Volumes/calibre-0.9.35...
hdiutil: attach failed - No such file or directory
Calibre install error: "calibre.app" could not be found in the downloaded .dmg
You can manually download and install calibre from http://calibre-ebook.com/download_osx
See the log file for more information: /Users/chase/Library/Logs/calibre-installer.log
I have a feeling this may have something to do with OS X sandboxing. Can you try running the script directly from the console?
I get the same error when I run from Terminal, which is the only way I can get the output to stay up long enough for me to take a look at it. The script doesn't appear to be writing to error logs either.
EDIT: I've also got the "Allow Applications Installed from: Anywhere" option checked in the Security tab.
I ended up fixing this by putting double quotes around the $calibre_download_url variable in line 73. Will make a pull request.
grep
found two matches which caused the error.
calibre_download_url=`cat /tmp/calibre-feed | grep -o "http://calibre-ebook\.googlecode\.com/files/calibre.*\.dmg"`
# => http://calibre-ebook.googlecode.com/files/calibre-0.9.35.dmg\nhttp://calibre-ebook.googlecode.com/files/calibre-0.9.35.dmg
Simply fixed by grep -m 1
.
Also, the latest build will prevent the download window from closing automatically.