9 Commits

Author SHA1 Message Date
Eli Schwartz
45ca4c7934
py3: merge multiline __future__ imports to not confuse 2to3 2019-05-27 00:41:14 -04:00
Kovid Goyal
1c22094803
Cleanup urllib imports 2019-05-02 07:25:03 +05:30
Kovid Goyal
d6402a0fdd
Use a non-deprecated technique for resuming partial downloads in the Linux installer. Fixes #1827289 [Deprecation warning in installation script.](https://bugs.launchpad.net/calibre/+bug/1827289) 2019-05-02 07:17:44 +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
f04b5eea20
Remove use of command -v from linux-installer.sh 2018-04-30 08:29:59 +05:30
Kovid Goyal
7a150c065e
Add a shebang for linux-installer.sh 2018-04-29 15:11:46 +05:30
Kovid Goyal
54c81eec15
Simplify passing arguments to linux-installer.py 2018-04-29 14:57:59 +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