summarylogtreecommitdiffstats
path: root/freenet.install
blob: be2f4903d55e4c2d49c6b05abf5cde9ce66e5823 (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
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 /run/freenet
    echo
    echo "Freenet will be slow at 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 will be located at http://127.0.0.1:8888/ "
    echo " https://freenetproject.org/faq.html"
    echo
}

post_upgrade() {
    chown -R freenet:freenet /opt/freenet /run/freenet

    ## 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
    }

    echo
}

pre_remove() {
    getent passwd freenet &>/dev/null && {
        echo -n ">>> Removing freenet system user... "
        userdel freenet
        echo "ok"
        echo
    }
}