2020-11-20 10:33:40 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2023-10-26 03:22:56 +02:00
|
|
|
if [ "$(dirname "$(realpath "$0")")" != "$(realpath "$PWD")" ]; then
|
2021-06-02 10:58:35 +02:00
|
|
|
echo "Please run from the folder install.sh is in."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-11-20 10:33:40 +01:00
|
|
|
if [ "$PREFIX" = "" ]; then
|
|
|
|
PREFIX=/usr/local
|
|
|
|
fi
|
|
|
|
|
2021-09-23 03:20:53 +02:00
|
|
|
rm -rf "$PREFIX"/share/anki "$PREFIX"/bin/anki
|
|
|
|
mkdir -p "$PREFIX"/share/anki
|
2023-10-26 03:22:56 +02:00
|
|
|
cp -av --no-preserve=owner,context -- * "$PREFIX"/share/anki/
|
2021-09-23 03:20:53 +02:00
|
|
|
mkdir -p "$PREFIX"/bin
|
2021-10-29 11:26:35 +02:00
|
|
|
ln -sf "$PREFIX"/share/anki/anki "$PREFIX"/bin/anki
|
2020-11-20 10:33:40 +01:00
|
|
|
# fix a previous packaging issue where we created this as a file
|
2021-09-23 03:20:53 +02:00
|
|
|
(test -f "$PREFIX"/share/applications && rm "$PREFIX"/share/applications)||true
|
|
|
|
mkdir -p "$PREFIX"/share/pixmaps
|
|
|
|
mkdir -p "$PREFIX"/share/applications
|
|
|
|
mkdir -p "$PREFIX"/share/man/man1
|
|
|
|
cd "$PREFIX"/share/anki && (\
|
2021-11-22 01:26:55 +01:00
|
|
|
mv -Z anki.xpm anki.png "$PREFIX"/share/pixmaps/;\
|
|
|
|
mv -Z anki.desktop "$PREFIX"/share/applications/;\
|
|
|
|
mv -Z anki.1 "$PREFIX"/share/man/man1/)
|
2020-11-20 10:33:40 +01:00
|
|
|
|
|
|
|
xdg-mime install anki.xml --novendor
|
|
|
|
xdg-mime default anki.desktop application/x-colpkg
|
|
|
|
xdg-mime default anki.desktop application/x-apkg
|
|
|
|
xdg-mime default anki.desktop application/x-ankiaddon
|
|
|
|
|
2021-10-29 11:26:35 +02:00
|
|
|
rm install.sh
|
|
|
|
|
2020-11-20 10:33:40 +01:00
|
|
|
echo "Install complete. Type 'anki' to run."
|