This repository has been archived by the owner on May 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
zotero_installer.sh
executable file
·141 lines (125 loc) · 3.59 KB
/
zotero_installer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
#
# Zotero installer
# Copyright 2011-2013 Sebastiaan Mathot
# <http://www.cogsci.nl/>
#
# This file is part of qnotero.
#
# qnotero is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qnotero is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qnotero. If not, see <http://www.gnu.org/licenses/>.
VERSION="5.0.60"
if [ `uname -m` == "x86_64" ]; then
ARCH="x86_64"
else
ARCH="i686"
fi
TMP="/tmp/zotero.tar.bz2"
DEST_FOLDER=zotero
EXEC=zotero
echo ">>> This script will download and install Zotero standalone on your system."
echo ">>> Do you want to continue?"
echo ">>> y/n (default=y)"
read INPUT
if [ "$INPUT" = "n" ]; then
echo ">>> Aborting installation"
exit 0
fi
echo ">>> Do you want to install Zotero globally (g) or locally (l)."
echo ">>> Root access is required for a global installation."
echo ">>> g/l (default=l)"
read INPUT
if [ "$INPUT" != "g" ]; then
echo ">>> Installing locally"
DEST="$HOME"
MENU_PATH="$HOME/.local/share/applications/zotero.desktop"
MENU_DIR="$HOME/.local/share/applications"
else
echo ">>> Installing globally"
DEST="/opt"
MENU_PATH="/usr/share/applications/zotero.desktop"
MENU_DIR="/usr/share/applications"
fi
echo ">>> Please input the version of Zotero."
echo ">>> (default=$VERSION)"
read INPUT
if [ "$INPUT" != "" ]; then
VERSION=$INPUT
fi
echo ">>> Please input your systems architecture (i686 or x86_64)."
echo ">>> (default=$ARCH)"
read INPUT
if [ "$INPUT" != "" ]; then
ARCH=$INPUT
fi
URL="https://download.zotero.org/client/release/${VERSION}/Zotero-${VERSION}_linux-${ARCH}.tar.bz2"
echo ">>> Downloading Zotero standalone $VERSION for $ARCH"
echo ">>> URL: $URL"
wget $URL -O $TMP
if [ $? -ne 0 ]; then
echo ">>> Failed to download Zotero"
echo ">>> Aborting installation, sorry!"
exit 1
fi
if [ -d $DEST/$DEST_FOLDER ]; then
echo ">>> The destination folder ($DEST/$DEST_FOLDER) exists. Do you want to remove it?"
echo ">>> y/n (default=n)"
read INPUT
if [ "$INPUT" = "y" ]; then
echo ">>> Removing old Zotero installation"
rm -Rf $DEST/$DEST_FOLDER
if [ $? -ne 0 ]; then
echo ">>> Failed to remove old Zotero installation"
echo ">>> Aborting installation, sorry!"
exit 1
fi
else
echo ">>> Aborting installation"
exit 0
fi
fi
echo ">>> Extracting Zotero"
echo ">>> Target folder: $DEST/$DEST_FOLDER"
tar -xpf $TMP -C $DEST
if [ $? -ne 0 ]; then
echo ">>> Failed to extract Zotero"
echo ">>> Aborting installation, sorry!"
exit 1
fi
mv $DEST/Zotero_linux-$ARCH $DEST/$DEST_FOLDER
if [ $? -ne 0 ]; then
echo ">>> Failed to move Zotero to $DEST/$DEST_FOLDER"
echo ">>> Aborting installation, sorry!"
exit 1
fi
if [ -f $MENU_DIR ]; then
echo ">>> Creating $MENU_DIR"
mkdir $MENU_DIR
fi
echo ">>> Creating menu entry"
echo "[Desktop Entry]
Name=Zotero
Comment=Open-source reference manager (standalone version)
Exec=$DEST/$DEST_FOLDER/zotero
Icon=$DEST/$DEST_FOLDER/chrome/icons/default/default48.png
Type=Application
StartupNotify=true" > $MENU_PATH
if [ $? -ne 0 ]; then
echo ">>> Failed to create menu entry"
echo ">>> Aborting installation, sorry!"
exit 1
fi
echo ">>> Done!"
echo
echo ">>> Don't forget to check out Qnotero, the Zotero sidekick!"
echo ">>> URL: http://www.cogsci.nl/qnotero"