Created
May 26, 2017 08:10
-
-
Save uwabami/47e72a9baaa07cf8be6c57494753803f to your computer and use it in GitHub Desktop.
Debian で zotero 用に pdftotext と pdfinfo を使う準備をするスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "### Setup pdfinfo and pdftext for Debian ###" | |
| echo "- see https://bugs.debian.org/cgi-bin/bugreport.cgi?att=2;bug=781009" | |
| echo -n "poppler-utils version: " | |
| version=$(dpkg-query -W -f='${Version}' poppler-utils || echo "please_install_poppler-utils") | |
| echo "${version}" | |
| ARCH=`dpkg-architecture -qDEB_HOST_GNU_CPU` | |
| binary_suffix="Linux-${ARCH}" | |
| echo "binary_suffix: $binary_suffix" | |
| totextbinary="pdftotext-${binary_suffix}" | |
| echo "pdftotext: $totextbinary" | |
| infobinary="pdfinfo-${binary_suffix}" | |
| echo "pdfinfo: $infobinary" | |
| infohack='pdfinfo.sh' | |
| echo -n "Find zotero installed directory, create symlink..." | |
| for zoteropath in $(find $HOME/.zotero $HOME/.mozilla -name zotero.sqlite -exec dirname {} \;) | |
| do | |
| echo $version > $zoteropath/"$totextbinary.version" | |
| echo $version > $zoteropath/"$infobinary.version" | |
| ln -sf /usr/bin/pdftotext "$zoteropath/$totextbinary" | |
| ln -sf /usr/bin/pdfinfo "$zoteropath/$infobinary" | |
| cat > $zoteropath/$infohack << EOF | |
| #!/bin/sh | |
| if [ -z "\$1" ] || [ -z "\$2" ] || [ -z "\$3" ]; then | |
| echo "Usage: $0 cmd source output.txt" | |
| exit 1 | |
| fi | |
| "\$1" "\$2" > "\$3" | |
| EOF | |
| chmod +x $zoteropath/$infohack | |
| done | |
| echo "finished!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment