summarylogtreecommitdiffstats
path: root/funkwhale_manage
blob: f043c80276bad8b3bb12b46802e05be8a2e181f5 (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
#!/usr/bin/bash

VENV_BIN=/usr/share/webapps/funkwhale/virtualenv/bin

if [[ ! -n "$FUNKWHALE_PATH" ]]; then
    FUNKWHALE_PATH="${VENV_BIN}"/funkwhale-manage
fi

if [[ ! -f "$FUNKWHALE_PATH" ]]; then
    echo "funkwhale-manage executable is not installed in $FUNKWHALE_PATH. Please pass the installation path."
    exit 1
fi

sudo -H -u funkwhale bash -c : && RUNAS="sudo -H -u funkwhale"

# change user -> funkwhale
$RUNAS /bin/bash << EOF
    # export environment variables
    set -a; source /srv/funkwhale/config/env; set +a

    # enter virtualenv
    source "${VENV_BIN}"/activate
    "${FUNKWHALE_PATH}" $@
    deactivate
EOF