summaryrefslogtreecommitdiff
path: root/pcr/zeronet-git/zeronet.install
blob: 659e8e0c62d1249278ad0edd9604fbdd86d753b6 (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
post_install() {
    getent passwd zeronet &>/dev/null || {
        echo -n ">>> Creating zeronet user... "
        useradd --system --user-group --home /var/lib/zeronet zeronet
        echo "done"
    } # NOTE: we do not autoremove user due to security concerns (Arch policy)
    post_upgrade
    # Don't run thesre operations automatically, because they are security-sensitive
    echo ">>> Default mode is clearnet+Tor. Give zeronet permissions to configure hidden service:"
    echo ">>>   sudo usermod -a -G tor zeronet"
    echo ">>>   sudo mkdir -m 750 /var/lib/tor-auth && sudo chown tor:tor /var/lib/tor-auth"
    echo ">>> Add/edit the following options in /etc/tor/torrc:"
    echo ">>>   ControlPort 9051"
    echo ">>>   CookieAuthentication 1"
    echo ">>>   CookieAuthFileGroupReadable 1"
    echo ">>>   CookieAuthFile /var/lib/tor-auth/control_auth_cookie"
    echo ">>> Restart tor (reload not enough):"
    echo ">>>   sudo systemctl restart tor"
    echo ">>> Run daemon and check status and view log:"
    echo ">>>   sudo systemctl start zeronet"
    echo ">>>   sudo systemctl status zeronet"
    echo ">>>   sudo journalctl -u zeronet"
    echo ">>> NOTE: all operations including editing zerosite files,"
    echo ">>>       should be done as user zeronet and config must be passed"
    echo ">>>       for data directory to be selected to /var/lib/zeronet: "
    echo ">>>   sudo -u zeronet python2 zeronet.py --config_file /etc/zeronet.conf ..."
    echo ">>>      OR"
    echo ">>>   sudo su - zeronet"
    echo ">>>   cd /opt/zeronet"
    echo ">>>   python2 zeronet.py --config_file /etc/zeronet.conf ..."
}

post_upgrade() {
    chown -R zeronet:zeronet /opt/zeronet
    chown zeronet:zeronet /var/lib/zeronet
    chown zeronet:zeronet /var/log/zeronet
}