aboutsummarylogtreecommitdiffstats
path: root/overgrive.install
blob: 4b54581c8fa4abd9f39f6219470cb3e26ac036cf (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
post_install() {
    python3 -m venv --system-site-packages /opt/thefanclub/overgrive/venv
    
    # Install Google API Client for Python3 (for the virtualenv)
    /opt/thefanclub/overgrive/venv/bin/pip3 install --upgrade google-api-python-client

    # Recomplie Schemas for good measure
    if [ -f /usr/bin/glib-compile-schemas ]
    then
        /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas/
    fi

    # Choose cpython interpreter for overgrive and copy correct compiled version and remove folder
    if [ -d /opt/thefanclub/overgrive/__pycache__ ]
    then
        cp /opt/thefanclub/overgrive/__pycache__/$(ls /opt/thefanclub/overgrive/__pycache__ |  grep $(python3 -V | cut -d' ' -f2 | cut -d'.' -f1-2 | sed 's/\.//g')) /opt/thefanclub/overgrive/overgrive
        rm -R /opt/thefanclub/overgrive/__pycache__
        chmod 0755 /opt/thefanclub/overgrive/overgrive
    fi
}

post_upgrade() {
	post_install
}

post_remove() {
    sudo rm -rf /opt/thefanclub/overgrive/
    if [ -z "$(ls -A /opt/thefanclub/)" ]
    then
        sudo rmdir /opt/thefanclub/
    fi
}