blob: db813648680041d2d0117216063098ab1736b28b (
plain)
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
|
post_install() {
# create user and set ownership
useradd -d /opt/anki-sync-server -r -s /sbin/nologin anki-sync-server
chown -R anki-sync-server /opt/anki-sync-server
chgrp -R anki-sync-server /opt/anki-sync-server
# link systemd service file
ln -s /opt/anki-sync-server/plugins/systemd/anki-sync-server.service /etc/systemd/system/
systemctl enable anki-sync-server
systemctl start anki-sync-server
# install prerequisites as stated on the website
echo "installing python packages as anki-sync-server user..."
sudo -u anki-sync-server pip install webob --user
sudo -u anki-sync-server pip install decorator --user
# post installation instructions
cat << EOF
=======================================================================
------------------
Post Installation:
------------------
You'll need to go to:
/opt/anki-sync-server
and run:
sudo -u anki-sync-server ./ankisyncctl.py adduser <username>
to add a new user to the anki database.
--------------------
Plugin Installation:
--------------------
To have anki interface with the server, you'll need to copy the plugin
from /opt/anki-sync-server/plugins to the relevant directory.
Anki 2.1: ~/.local/share/Anki2/addons21/
ln -s /opt/anki-sync-server/plugins/anki2.1/ankisyncd \\
~/.local/share/Anki2/addons21/
Anki 2.0: ~/Anki/addons
ln -s /opt/anki-sync-server/plugins/anki2.0/anki-sync-server.py \\
~/Anki/addons
or your OS equivalent.
---------------
Run The Server:
---------------
To just run the server, go to:
/opt/anki-sync-server/
then run:
sudo -u anki-sync-server python -m ankisyncd
if you run it as another user you may have to install some dependencies again:
sudo pacman -S python2-webob python2-decorator
or:
pip install --user webob decorator
=== (be aware you may have trouble with permissions on your auth.db if you run as different users!) ===
The server is set to auto start via systemctl.
See:
systemctl status anki-sync-server
for details.
------------------------
Run Bundled Anki Client:
------------------------
If you want to run the supplied anki client execute:
/opt/anki-sync-server/anki-bundled/runanki
You'll need to install the listed requirements to get it running first:
cd /opt/anki-sync-server
sudo -u anki-sync-server git submodule update --init anki-bundled
cd anki-bundled
sudo -u anki-sync-server bash tools/build_ui.sh #for aqt dependency
sudo pacman -S python-beautifulsoup4 python-send2trash \
python-pyaudio python-requests python-decorator \
python-psutil python-distro python-markdown \
python-pyqt5 python-pyqtwebengine mpv
=======================================================================
EOF
}
post_remove(){
# stop service (and remove systemd files)
systemctl stop anki-sync-server
systemctl disable anki-sync-server
echo "Executing systemctl daemon-reload"
systemctl daemon-reload
# remove user (& group)
getent passwd anki-sync-server &>/dev/null && userdel anki-sync-server || true
getent group anki-sync-server &>/dev/null && groupdel anki-sync-server || true
echo "==================================================================="
echo "rm -rf /opt/anki-sync-server to remove the database and cache files"
echo "==================================================================="
}
post_upgrade(){
chown -R anki-sync-server /opt/anki-sync-server
chgrp -R anki-sync-server /opt/anki-sync-server
}
|