Author: | Francesco Poli |
---|---|
Contact: | invernomuto@paranoici.org |
Version: | 0.56 |
Copyright: | Expat license |
Notice: | Copyright (c) 2008-2024 Francesco Poli Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
About this document | |
---|---|
Web form | HyperText Markup Language |
Source form | reStructuredText |
Web stylesheet | Cascading StyleSheets |
Build directives | Makefile |
In another document (HTML, reST) you saw how to install and configure some image and video-related software on our example Debian testing workstation/desktop box. Now it's time to start preparing textual documents and performing other "office automation" tasks.
Install a PostScript and PDF viewer:
# aptitude install gv
Install a PDF viewer (with plugins for other document formats):
# aptitude install zathura # aptitude install zathura-ps zathura-djvu zathura-cb
configure it for your regular user:
$ cat ~/.config/zathura/zathurarc set guioptions "" set window-height 780 set window-width 600 set adjust-open "best-fit" set advance-pages-per-row true set render-loading false set scroll-full-overlap 0.10 set scroll-page-aware true set window-title-page true set zoom-max 1600 set zoom-min 1 set database "sqlite"
and make it the default PostScript and PDF viewer for your regular user:
$ xdg-mime default org.pwmt.zathura.desktop \ application/pdf application/ps application/postscript
You may also install another PDF viewer (with plugins):
# aptitude install qpdfview
and configure it for your regular user:
$ qpdfview
Select Settings... from the Edit menu. In the "Behavior" tab, uncheck "Open URL", check "Auto-refresh", uncheck "Track recently used", "Keep recently closed", "Restore tabs", "Restore bookmarks", "Restore per-file settings"; choose "5 min" Save database interval; uncheck "Synchronize presentation"; choose "Default" Presentation screen; uncheck "Synchronize outline view"; choose "1.10" Zoom factor, "5000 ms" Highlight duration, "#ffff00" Highlight color, "#ffff00" Annotation color and leave the Source editor field blank. In the "Graphics" tab, "General" subtab, check "Use tiling"; uncheck "Keep obsolete pixmaps"; check "Use device pixel ratio"; uncheck "Trim margins"; check "Decorate pages", "Decorate links", and "Decorate form fields"; choose "#808080" Background color, "#ffffff" Paper color, "#000000" Presentation background color, "2" Pages per row, "5.00 px" Page spacing, "3.00 px" Thumbnail spacing, "150.00 px" Thumbnail size, "32 MB" Cache size; check "Prefetch" and choose "2" Prefetch distance. In the "PDF" subtab, check "Antialiasing", "Text antialiasing"; choose "None" Text hinting; uncheck "Overprint preview"; choose "None" Thin line mode, "Splash" Backend. In the "PS" subtab, choose "4" Graphics antialias bits and "2" Text antialias bits. In the "Interface" tab, choose "Top" Tab position, "As needed" Tab visibility; uncheck "Spread tabs"; check "New tab next to current tab"; choose "10" Recently used count, "5" Recently closed count; uncheck "Toggle tool and menu bars with fullscreen"; choose "openInNewTab,refresh,saveCopy,print" File tool bar, "firstPage,previousPage,currentPage,nextPage,lastPage,search,separator,copyToClipboardMode,addAnnotationMode" Edit tool bar, "zoomIn,scaleFactor,zoomOut,separator,continuousMode,twoPagesMode,separator,rotateLeft,rotateRight,separator,fullscreen,presentation" View tool bar; check "Use page label", "Document title as tab title", "Current page in window title"; uncheck "Instance name in window title"; check "Highlight current thumbnail", "Limite thumbnails to results"; uncheck "Annotation overlay"; check "Form field overlay". In the "Shortcuts" tab, leave the default key sequences untouched. In the "Modifiers" tab, choose "Ctrl" Zoom, "Shift and Alt" Rotate, "Alt" Scroll, "Shift" Copy to clipboard, and "Shift and Ctrl" Add annotation.
Install some very useful command-line tools:
# aptitude install poppler-utils
Install a PDF viewer which is especially useful for presentations:
# aptitude install pdf-presenter-console
This viewer (pdfpc) is also somewhat capable of playing back videos embedded in the pages of a PDF document. This capability is enhanced by installing some additional packages (if they are not already present):
# aptitude install gstreamer1.0-plugins-bad gstreamer1.0-gtk3
For video playback debug purposes, you may also want to install the following packages:
# aptitude install gstreamer1.0-tools gstreamer1.0-plugins-base-apps
A useful tool for searching strings in PDF files is provided by the following package:
# aptitude install pdfgrep
A useful program for comparing PDF files:
# aptitude install diffpdf
Another tool that may be useful while doing (or attending!) presentations is included in the following package:
# aptitude install sm
Install an e-book reader:
# aptitude install fbreader
and configure it for your regular user:
$ mkdir ~/FBooks ~/Books $ fbreader
Click on the Show Preferences Dialog button and change the options as you like (I am personally fine with the default values).
You also may need to create documents...
Install the TeX Live distribution:
# aptitude install texlive-latex-extra
Then, install some language packages:
# aptitude install texlive-lang-english texlive-lang-italian \ texlive-lang-german \ texlive-lang-european texlive-lang-greek texlive-lang-cyrillic
some extra packages:
# aptitude install texlive-bibtex-extra texlive-fonts-extra \ texlive-formats-extra texlive-plain-generic
and some special-purpose packages:
# aptitude install texlive-games texlive-music texlive-publishers \ texlive-science
Also, install some auxiliary programs:
# aptitude install texlive-extra-utils
If you need to typeset in non-latin alphabets, you may want to install the following font package:
# aptitude install cm-super
In order to conveniently manage bibliographies, BibTeX can be used: it is included in texlive-binaries; check that this package is already installed:
$ aptitude search texlive-binaries i A texlive-binaries - Binaries for TeX Live
An alternative you may want to consider is Biber, which is designed to work with the BibLaTeX package:
# aptitude install biber
Finally you may want to prepare presentations with LaTeX: Beamer is included in texlive-latex-recommended; check that this package is already installed:
$ aptitude search texlive-latex-recommended i A texlive-latex-recommended - TeX Live: LaTeX recommended packages i A texlive-latex-recommended-doc - TeX Live: Documentation files for texlive-
Install a PDF manipulator:
# aptitude install qpdf
Then, install a converter for a horrid proprietary textual document format:
# aptitude install antiword
Install a well-known office automation package:
# aptitude install libreoffice libreoffice-sdbc-firebird_ libsane_
Then, install some language packages:
# aptitude install libreoffice-l10n-it libreoffice-l10n-de \ hyphen-en-us mythes-en-us hunspell-en-us hunspell-en-gb \ hyphen-it mythes-it hunspell-it \ hyphen-de mythes-de hunspell-de-de hunspell-de-at hunspell-de-ch
You may need to prepare documents to be published on the web. First of all, install an (X)HTML syntax checker and reformatter:
# aptitude install tidy
and configure it for your regular user:
$ cat ~/.tidyrc decorate-inferred-ul: no doctype: auto drop-empty-paras: yes drop-proprietary-attributes: yes enclose-text: yes hide-comments: no logical-emphasis: yes lower-literals: yes merge-divs: no merge-spans: no numeric-entities: no output-xhtml: yes add-xml-decl: yes quote-ampersand: yes quote-marks: yes quote-nbsp: yes show-body-only: auto accessibility-check: 0 indent: auto indent-attributes: no indent-spaces: 2 markup: yes wrap: 72 wrap-attributes: no vertical-space: yes input-encoding: utf8 output-encoding: utf8 quiet: no write-back: no
You may also want to install the following static web photo gallery generator:
# aptitude install lazygal
Then, install a command-line WebDAV client:
# aptitude install cadaver
and a package to mount WebDAV server directories as if they were filesystems:
# aptitude install davfs2
You'll be asked whether you want to allow unprivileged users to mount WebDAV resources: you may answer "Yes". Add the users who must be allowed to mount WebDAV resources to the davfs2 group (substitute $REGULARUSER with each appropriate username):
# adduser $REGULARUSER davfs2
Then create a mount point for each WebDAV resource (substitute $SITE with each appropriate site short name):
# mkdir -p /media/webdav/$SITE
and add corresponding entries to /etc/fstab:
# grep davfs /etc/fstab https://mywebsite.example.org/dav/myuser/html-site/ /media/webdav/$SITE davfs user,noauto,noexec 0 0
Copy the following website update script for the regular user who maintains one website:
$ mkdir -p ~/bin $ cat ~/bin/siteupdate #!/bin/sh # SiteUpdate - simple static website update script using rsync and davfs2 VERSION="0.4" # # Copyright (c) 2017-2018 Francesco Poli <invernomuto@paranoici.org> # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # define configuration file CONFFILE="${HOME}/.config/siteupdate.ini" # define bit bucket DEVNULL="/dev/null" # define commands CONFGET="/usr/bin/confget" MOUNT="/bin/mount" UMOUNT="/bin/umount" MDAVFS="/usr/sbin/mount.davfs" UMDAVFS="/usr/sbin/umount.davfs" VIEW="/usr/bin/view" RSYNC="/usr/bin/rsync" ALLCOMMANDS="$CONFGET $MOUNT $UMOUNT $MDAVFS $UMDAVFS $VIEW $RSYNC" usage() { NAME=`basename $0` printf 'usage: %s SITENAME\n' "$NAME" 1>&2 } printf 'SiteUpdate version %s\n\n' "$VERSION" for COMMAND in $ALLCOMMANDS do if test ! -x $COMMAND then printf '%s is not present or not executable\n' "$COMMAND" 1>&2 exit 1 fi done if test ! -r $CONFFILE then printf '%s is not present or not readable\n' "$CONFFILE" 1>&2 exit 2 fi SITE=$1 if test "x$SITE" = "x" then printf 'missing argument\n' 1>&2 usage exit 3 fi # get configuration for the site eval `$CONFGET -f "$CONFFILE" -s "$SITE" -S -l` if test "x$MountPoint" = "x" then printf 'no MountPoint found for site %s\n' "$SITE" 1>&2 exit 4 fi if test "x$LocalDir" = "x" then printf 'no LocalDir found for site %s\n' "$SITE" 1>&2 exit 5 fi if test "x$LocalPathInsideHome" = "xtrue" then LocalDir="${HOME}/$LocalDir" fi $MOUNT $MountPoint/ FSPROPS=`$MOUNT | grep $MountPoint` if printf '%s' "$FSPROPS" | grep rw > $DEVNULL then printf 'Successfully mounted remote WebDAV resource\n' printf 'WebDAV filesystem properties:\n%s\n' "$FSPROPS" else printf 'Failed to mount remote WebDAV resource\n' 1>&2 printf 'WebDAV filesystem properties:\n%s\n' "$FSPROPS" 1>&2 exit 6 fi ANS="r" while test "x$ANS" = "xr" do diff -ruN $MountPoint/ $LocalDir/ | $VIEW -n - $RSYNC -rctOLv --delete --exclude="lost+found" \ $LocalDir/ $MountPoint/ --dry-run printf '\nContent of %s\n' "$MountPoint/lost+found/" ls -altrF $MountPoint/lost+found/ printf '\n' read -p "Do you want to update the website? [y/n/r] " ANS if test "x$ANS" = "xy" then $RSYNC -rctOLv --delete --exclude="lost+found" \ $LocalDir/ $MountPoint/ fi done printf '\n' if $UMOUNT $MountPoint/ then printf 'Successfully unmounted remote WebDAV resource\n' else printf 'Failed to unmount remote WebDAV resource\n' 1>&2 exit 7 fi
For each website that the regular user maintains, add the following stanza to the configuration file ~/.config/siteupdate.ini:
$ cat ~/.config/siteupdate.ini [$SITENAME] MountPoint=/media/webdav/$SITE LocalDir=my/website/localroot LocalPathInsideHome=true
where $SITENAME should be substituted by an appropriate identifier for the website, $SITE by the above described short name for the site, and my/website/localroot by the path for the local master copy of the website. When the regular user wants to update the website, he/she should modify the local master copy first, and then issue the following command:
$ siteupdate $SITENAME
If the website update fails with rsync getting input/output errors when trying to rename temporary hidden files to their final destinations, the issue may be due to the WebDAV server incorrectly claiming to support locks, but actually not supporting them. You may work around this issue by disabling the use of locks:
$ mkdir -p ~/.davfs2 $ echo 'use_locks 0' > ~/.davfs2/davfs2.conf
Now that you're ready to write all sorts of textual documents, you may want to install some scientific packages. More details in a separate document (HTML, reST).