Welcome to mirror list, hosted at ThFree Co, Russian Federation.

pdfannotate.sh « apps - github.com/nextcloud/vm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 520f971d4d55b825f9e6a130ed2124c22d69f723 (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
#!/bin/bash

# T&M Hansson IT AB © - 2022, https://www.hanssonit.se/
# Copyright © 2021 Simon Lindner (https://github.com/szaimen)

true
SCRIPT_NAME="PDF Annotations"
SCRIPT_EXPLAINER="This script allows to easily install PDF Annotations, \
a tool to annotate any PDF document inside Nextcloud."
# shellcheck source=lib.sh
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)

# Check for errors + debug code and abort if something isn't right
# 1 = ON
# 0 = OFF
DEBUG=0
debug_mode

# Check if root
root_check

# Check if pdfannotate is already installed
if ! is_app_installed pdfannotate
then
    # Ask for installing
    install_popup "$SCRIPT_NAME"
else
    # Ask for removal or reinstallation
    reinstall_remove_menu "$SCRIPT_NAME"
    # Removal
    pip3 uninstall svglib -y &>/dev/null
    for packet in pdftk ghostscript
    do
        if is_this_installed "$packet"
        then
            apt purge "$packet" -y
        fi
    done
    apt autoremove -y
    nextcloud_occ app:remove pdfannotate
    # Show successful uninstall if applicable
    removal_popup "$SCRIPT_NAME"
fi

# Install all needed dependencies
install_if_not ghostscript
install_if_not pdftk
install_if_not python3-pip
pip3 install svglib

# Get the app
check_command cd "$NC_APPS_PATH"
rm -rf pdfannotate
check_command git clone https://gitlab.com/nextcloud-other/nextcloud-annotate pdfannotate
chown -R www-data:www-data pdfannotate
chmod -R 770 pdfannotate

# Install the app
install_and_enable_app pdfannotate
if ! is_app_enabled pdfannotate
then
    msg_box "Could not install $SCRIPT_NAME!"
else
    msg_box "$SCRIPT_NAME was successfully installed!"
fi