48 Commits

Author SHA1 Message Date
Flaviu Tamas
0889ee85ec
Fix syntax errors
Command used:

futurize --no-diffs -f libfuturize.fixes.fix_print_with_import -f lib2to3.fixes.fix_throw -f lib2to3.fixes.fix_numliterals -f lib2to3.fixes.fix_except -f lib2to3.fixes.fix_exec -f lib2to3.fixes.fix_raise -f lib2to3.fixes.fix_tuple_params -f lib2to3.fixes.fix_ne -j20 -w -n setup recipes src manual setup.py recipes/*.recipe

And manual adjustments of print((...)) -> print(...)
2018-09-10 12:11:28 +05:30
Joel Goguen
1c25ba0042 Exclude execute from umask
If the umask is set up to exlude execute, the installer will set up
calibre to be unreadable by any user other than the installing user.
When installing as `root`, a starting umask of `0o077` results in the
installer choosing a new umask of `0o033`, which means the calibre
install directory (and child directories) are installed with permissions
`0o744`, so only the installing user can actually use the resulting
calibre install.

To test, start with a system umask of `0o077` and run the installer
script as root:

```
% sudo sh ./setup/linux-installer.sh
Using python executable: /usr/bin/python3
WARNING: Your current umask disallows reading of files by some users, this can cause system breakage when running the installer because of bugs in common system utilities.
Should the installer (f)ix the umask, (i)gnore it or (a)bort [f/i/a Default is abort]: f
umask changed to: 022
Installing to /opt/calibre
Downloading tarball signature securely...
Using previously downloaded calibre-3.26.1-x86_64.txz
Extracting files to /opt/calibre ...
Extracting application files...
Creating symlinks...
	Symlinking /opt/calibre/ebook-edit to /usr/bin/ebook-edit
	Symlinking /opt/calibre/calibre-debug to /usr/bin/calibre-debug
	Symlinking /opt/calibre/web2disk to /usr/bin/web2disk
	Symlinking /opt/calibre/calibre-parallel to /usr/bin/calibre-parallel
	Symlinking /opt/calibre/calibredb to /usr/bin/calibredb
	Symlinking /opt/calibre/lrs2lrf to /usr/bin/lrs2lrf
	Symlinking /opt/calibre/calibre to /usr/bin/calibre
	Symlinking /opt/calibre/ebook-convert to /usr/bin/ebook-convert
	Symlinking /opt/calibre/calibre-server to /usr/bin/calibre-server
	Symlinking /opt/calibre/ebook-viewer to /usr/bin/ebook-viewer
	Symlinking /opt/calibre/calibre-smtp to /usr/bin/calibre-smtp
	Symlinking /opt/calibre/ebook-meta to /usr/bin/ebook-meta
	Symlinking /opt/calibre/ebook-device to /usr/bin/ebook-device
	Symlinking /opt/calibre/fetch-ebook-metadata to /usr/bin/fetch-ebook-metadata
	Symlinking /opt/calibre/ebook-polish to /usr/bin/ebook-polish
	Symlinking /opt/calibre/lrfviewer to /usr/bin/lrfviewer
	Symlinking /opt/calibre/calibre-customize to /usr/bin/calibre-customize
	Symlinking /opt/calibre/lrf2lrs to /usr/bin/lrf2lrs
	Symlinking /opt/calibre/markdown-calibre to /usr/bin/markdown-calibre
Setting up command-line completion...
Installing zsh completion to: /usr/share/zsh/site-functions/_calibre
Installing bash completion to: /usr/share/bash-completion/completions/calibre
Setting up desktop integration...
Creating un-installer: /usr/bin/calibre-uninstall
Run "calibre" to start calibre
```

And the resulting directory:
```
% ls -ld /opt/calibre
drwxr-xr-x. 5 root root 4.0K Jun 22 10:53 /opt/calibre/
```

Also verify the Python version, starting with no `/opt/calibre` and a system umask of `0o077`:
```
% sudo python3 ./setup/linux-installer.py
WARNING: Your current umask disallows reading of files by some users, this can cause system breakage when running the installer because of bugs in common system utilities.
Should the installer (f)ix the umask, (i)gnore it or (a)bort [f/i/a Default is abort]: f
umask changed to: 022
Installing to /opt/calibre
Downloading tarball signature securely...
Using previously downloaded calibre-3.26.1-x86_64.txz
Extracting files to /opt/calibre ...
Extracting application files...
Creating symlinks...
	Symlinking /opt/calibre/calibre-customize to /usr/bin/calibre-customize
	Symlinking /opt/calibre/calibre-smtp to /usr/bin/calibre-smtp
	Symlinking /opt/calibre/calibredb to /usr/bin/calibredb
	Symlinking /opt/calibre/calibre to /usr/bin/calibre
	Symlinking /opt/calibre/ebook-polish to /usr/bin/ebook-polish
	Symlinking /opt/calibre/ebook-meta to /usr/bin/ebook-meta
	Symlinking /opt/calibre/calibre-server to /usr/bin/calibre-server
	Symlinking /opt/calibre/markdown-calibre to /usr/bin/markdown-calibre
	Symlinking /opt/calibre/fetch-ebook-metadata to /usr/bin/fetch-ebook-metadata
	Symlinking /opt/calibre/lrf2lrs to /usr/bin/lrf2lrs
	Symlinking /opt/calibre/calibre-parallel to /usr/bin/calibre-parallel
	Symlinking /opt/calibre/ebook-convert to /usr/bin/ebook-convert
	Symlinking /opt/calibre/ebook-viewer to /usr/bin/ebook-viewer
	Symlinking /opt/calibre/web2disk to /usr/bin/web2disk
	Symlinking /opt/calibre/calibre-debug to /usr/bin/calibre-debug
	Symlinking /opt/calibre/ebook-device to /usr/bin/ebook-device
	Symlinking /opt/calibre/lrfviewer to /usr/bin/lrfviewer
	Symlinking /opt/calibre/ebook-edit to /usr/bin/ebook-edit
	Symlinking /opt/calibre/lrs2lrf to /usr/bin/lrs2lrf
Setting up command-line completion...
Installing zsh completion to: /usr/share/zsh/site-functions/_calibre
Installing bash completion to: /usr/share/bash-completion/completions/calibre
Setting up desktop integration...
Creating un-installer: /usr/bin/calibre-uninstall
Run "calibre" to start calibre

% ls -ld /opt/calibre
drwxr-xr-x. 5 root root 4.0K Jun 22 10:55 /opt/calibre/
```

After each, verify calibre starts as a non-root user.
2018-06-22 10:49:26 -07:00
Kovid Goyal
73029303d6
Dont use a set literal in the installer since there are apparently people still running linux installations with python 2.6 2018-06-09 07:05:03 +05:30
Kovid Goyal
db936049cd
Add a shell script wrapper for the linux installer
Needed because Ubuntu 18.04 has decided, in its infinite wisdom to
have no default python executable, which makes it impossible to run
polyglot python scripts.
2018-04-28 10:05:18 +05:30
Kovid Goyal
9679a1c4f3
pep8 2018-04-28 08:52:46 +05:30
Kovid Goyal
2373a38005
Linux installer: Fix umask question not working with the recommended install command because stdin is a pipe 2018-04-14 15:44:02 +05:30
Kovid Goyal
631ca6393e
Linux installer: A nicer error message if the user tries to run the installer on an ARM machine 2017-12-04 12:32:36 +05:30
Kovid Goyal
3e2276db36 Do not check umask for isolated installs 2017-02-27 01:32:34 +05:30
Kovid Goyal
abbf258cfa Linux installer: Check that the umask is suitable before running the installer.
This prevents system breakage because of bugs in xdg-mime when the user
has set their umask to prevent reading of files by other users on the
system. See https://www.mobileread.com/forums/showthread.php?t=277803
2017-02-27 01:30:29 +05:30
Kovid Goyal
b4abd1f1b3 pep8 2017-02-27 01:23:28 +05:30
Kovid Goyal
9b41e0c98f Reduce number of Downloading prints when the installer output is redirected to a file 2016-03-29 21:08:02 +05:30
Kovid Goyal
3eaf62de5b Yet another fix for python ssl distro compatibility
Apparently CentOS 7 just decided to backport the SSL patches from 2.7.9
to 2.7.5! Sigh.

I have no idea if this change will cause installation to stop working on
old Debian/Ubuntu. I love linux.

Fixes #1551800 [Automatic Linux install fails with SSL error](https://bugs.launchpad.net/calibre/+bug/1551800)
2016-03-01 22:22:58 +05:30
Kovid Goyal
e71c1a4888 Change to using main server download URL for the linux installer 2016-01-09 10:53:50 +05:30
Kovid Goyal
5e8402c5ef Allow the linux installer to work even if the installation location is a symlink 2016-01-03 14:33:27 +05:30
Kovid Goyal
2b3a1ea10c Update CA root certificate to use a SHA256 signature 2015-12-23 11:29:43 +05:30
Kovid Goyal
b44951a46c Do not run the post-installer through a shell 2015-11-22 07:31:02 +05:30
Kovid Goyal
27e4bd5b81 Simplify the main() function 2015-11-22 07:25:27 +05:30
Kovid Goyal
4abd16a4a5 Fix #396 (Fix UnicodeDecodeError in linux installer script) 2015-05-05 17:52:36 +05:30
Kovid Goyal
2d768e9f4e Remove no longer needed branches from the linux installer 2015-03-24 13:38:54 +05:30
Kovid Goyal
ef09e886b3 Change all shebangs to use python2 2015-01-23 19:08:21 +05:30
Kovid Goyal
25b973ee2e Change server the linux installer uses to avoid extra redirect 2015-01-17 12:34:03 +05:30
Kovid Goyal
1a8c28ecb9 Switch version check to new server 2015-01-12 11:40:39 +05:30
Kovid Goyal
0149c98092 Change signature downloads to new server 2015-01-12 04:14:12 +05:30
Kovid Goyal
03f3eb931d Use create_default_context rather than manually creating the context 2015-01-07 11:53:53 +05:30
Kovid Goyal
d102bc256c Workaround for Ubuntu/Debian's brilliant decision to partially backport patches from python 2.7.9 to 2.7.8 2014-12-18 17:33:52 +05:30
Kovid Goyal
b5849698c0 Use a functionality check on the SSL module instead of checking version numbers, since there are distros out there that backport patches without changing version numbers 2014-12-16 09:30:01 +05:30
Kovid Goyal
6a349b9c30 Use TLS 1.2 when available for https 2014-12-16 09:00:50 +05:30
Kovid Goyal
4f6ca8d7d2 When downloading https resources with a self-signed certificate, handle python 2.7.9's API breakage
See #1402579 (Can't install calibre due "ssl.SSLError: [SSL] PEM lib (_ssl.c:2525)")
2014-12-15 22:45:02 +05:30
Kovid Goyal
4e04a1a104 More robust tarball compression type detection in the linux installer 2014-08-08 18:31:14 +05:30
Kovid Goyal
8f9fa74586 Use LZMA insteap of BZIP2 to compress the linux binary tarball, for a large size reduction (~30%) 2014-08-08 18:31:11 +05:30
Kovid Goyal
88f19064dc ... 2014-03-25 16:44:49 +05:30
Kovid Goyal
f5e1a13ac6 Updated expired CA certificate 2014-03-25 16:39:08 +05:30
Kovid Goyal
87fedb8a6d I love linux distros 2014-03-10 11:53:50 +05:30
Kovid Goyal
1ee24745ee ... 2014-03-10 08:16:01 +05:30
Kovid Goyal
290462909f Linux binary install script: Fix error on linux systems where the system python has an encoding of None set on stdout. Assume encoding is utf-8 in this case. 2014-03-07 21:51:00 +05:30
Kovid Goyal
9a3e3ad146 ... 2014-03-04 07:41:45 +05:30
Kovid Goyal
10dfa877d2 linux installer script: Do not use the filesystem to pass the downloaded tarball to tar as it is possible for malicuous code running on the users computer to alter the download file between signature verification and calling tar to extract the files. 2014-03-04 07:35:48 +05:30
Kovid Goyal
d0bb89c740 Linux installer: Allow using ~ when specifying the installation directory 2014-03-02 11:52:08 +05:30
Kovid Goyal
ffc4cadf39 Linux binary installer: Fix an error when using proxies and python 3
Fixes #1286274 [Binary linux installer fails because of bug in proxy debugging output](https://bugs.launchpad.net/calibre/+bug/1286274)
2014-03-01 07:55:37 +05:30
Kovid Goyal
45e6468b01 Make the linux installer script compatible with python 2.6. Fixes #1286011 [Linux installer for calibre 1.26 does not work on CentOS 6.5](https://bugs.launchpad.net/calibre/+bug/1286011) 2014-02-28 13:58:06 +05:30
Kovid Goyal
c758c5be30 ... 2014-02-26 12:19:27 +05:30
Kovid Goyal
552738a436 py3 compat 2014-02-24 14:30:01 +05:30
Kovid Goyal
6dc9091911 ... 2014-02-24 13:46:47 +05:30
Kovid Goyal
5807e56bde ... 2014-02-24 13:45:18 +05:30
Kovid Goyal
a004fca78e Nicer error message on failure 2014-02-24 10:06:15 +05:30
Kovid Goyal
0ff4a12538 ... 2014-02-24 09:49:14 +05:30
Kovid Goyal
6ad895cd72 Make the installer run non-interactively with installation dir specified via environment variable 2014-02-24 08:07:39 +05:30
Kovid Goyal
ac35a5bddc Move the linux installer download script into the calibre source tree 2014-02-23 18:58:03 +05:30