calibre/setup
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
..
__init__.py Switch to using msgfmt to check for format errors in translated strings 2017-06-18 10:26:24 +05:30
browser_data.py A larger pool of random UAs 2017-02-28 21:20:21 +05:30
build.py Try to get unicode_names compiling on ancient compilers 2018-05-01 11:31:21 +05:30
build_environment.py DRYer 2018-03-10 09:07:38 +05:30
check.py Switch to using msgfmt to check for format errors in translated strings 2017-06-18 10:26:24 +05:30
commands.py Create a setup.py command: man_pages to generate man pages in all languages 2017-07-04 12:28:59 +05:30
extensions.json Try to get unicode_names compiling on ancient compilers 2018-05-01 11:31:21 +05:30
file-hosting-bw.py Change all shebangs to use python2 2015-01-23 19:08:21 +05:30
git_post_checkout_hook.py Migrate git hooks to py3 2018-06-12 18:01:55 +05:30
git_post_rewrite_hook.py Migrate git hooks to py3 2018-06-12 18:01:55 +05:30
git_pre_commit_hook.py Ignore 404s on private bugs 2018-06-18 13:24:33 +05:30
gui.py Remove orphaned compiled forms when switching branches 2017-06-09 00:21:10 +05:30
hosting.py A favicon for the download server 2016-08-31 11:32:41 +05:30
install.py Add man pages to the source tarball 2017-07-04 13:06:33 +05:30
installers.py Ensure multitail building does not assume tty 2017-05-21 13:39:32 +05:30
iso3166.xml Add ISO 3166 country codes 2014-04-17 07:12:29 +05:30
iso_639_3.xml Pushto -> Pashto 2016-12-22 14:13:02 +05:30
lc_data.py Ensure that the rendered dates are always in the same language as the calibre interface, regardless of system language setting 2014-04-06 13:28:32 +05:30
linux-installer.py Exclude execute from umask 2018-06-22 10:49:26 -07:00
linux-installer.sh Exclude execute from umask 2018-06-22 10:49:26 -07:00
mathjax.py Use curl to download mathjax as well so that it works in Travis on OS X 2016-12-09 10:41:39 +05:30
multitail.py ... 2015-04-03 09:38:54 +05:30
parallel_build.py ... 2016-07-20 12:01:58 +05:30
plugins_mirror.py More robust timeout retry handling 2018-02-02 15:43:55 +05:30
publish.py Ensure build is run before publish proceeds 2017-08-04 08:57:08 +05:30
pypi.py Convert more URLs to use https 2016-06-17 10:26:44 +05:30
resources.py A larger pool of random UAs 2017-02-28 21:20:21 +05:30
run-calibre-worker.py ... 2017-05-21 13:39:26 +05:30
test.py Move the search query parser tests into their own module and integrate with the calibre testing system 2018-01-18 10:03:30 +05:30
translations.py Content server: When updating interface data do not transmit translations if they have not been changed. Saves ~30-60KB bandwidth when using non-English interface language. 2018-03-24 10:50:24 +05:30
unix-ci.py Dont mute curl on the unix ci server 2017-07-02 10:17:46 +05:30
upload.py Ensure no spaces around fosshub API key 2018-03-09 16:41:00 +05:30
vcvars.py Build 32bit calibre 2017-05-21 13:39:07 +05:30
win-ci.py Try using node+rapydscript on appveyor as well 2017-06-10 11:22:17 +05:30