summarylogtreecommitdiffstats
path: root/freenet.install
blob: 85369d20b86b9e47e3979bc9df5bcde255467760 (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
post_install() {
    getent passwd freenet &>/dev/null || {
        echo -n "==> Creating freenet system user... "
        useradd --system \
                --user-group \
                --home /opt/freenet \
                freenet &&
        echo "ok" || echo "fail"
    }
    chown -R freenet:freenet /opt/freenet
    echo "==> Freenet will be slow during first startup while it discovers the network."
    echo "==> You may see 'Data Not Found' or 'Route Not Found' errors, this is normal."
    echo "==> For best performance Freenet should be run 24/7 as much as possible."
    echo "==> Your node's configuration WebUI is located at http://127.0.0.1:8888/ "
}

post_upgrade() {
    ## remove me at a later date
    [[ -d /opt/freenet/conf/node ]] && {
        sed -i /opt/freenet/conf/freenet.ini \
            -e "s:node.install.nodeDir=/opt/freenet/conf/node:node.install.nodeDir=/opt/freenet/noderef:" \
            -e "s:JSTUN;::"
        mv /opt/freenet/conf/node /opt/freenet/noderef
    } || true
    chown -R freenet:freenet /opt/freenet
}

pre_remove() {
    getent passwd freenet &>/dev/null && {
        echo -n "==> Removing freenet system user... "
        userdel freenet &&
        echo "ok" || echo "fail"
    }
    echo "==> Delete /opt/freenet if you wish to completely remove everything"
}