install 1.02 KB
Newer Older
Laurent Peuch's avatar
init  
Laurent Peuch committed
1 2
set -e

3
source ./commons
Laurent Peuch's avatar
Laurent Peuch committed
4

Laurent Peuch's avatar
init  
Laurent Peuch committed
5 6 7
install_renew_cert() {
    set -e

Laurent Peuch's avatar
Laurent Peuch committed
8 9
    install_dir=$(pwd)

10
    if [ -e $RENEW_CERT_PATH ]; then
Laurent Peuch's avatar
Laurent Peuch committed
11
        sudo rm -rf $RENEW_CERT_PATH
12 13
    fi

Laurent Peuch's avatar
init  
Laurent Peuch committed
14 15
    sudo apt-get install -y python-virtualenv

Laurent Peuch's avatar
Laurent Peuch committed
16
    sudo git clone https://github.com/neutrinet/renew_cert $RENEW_CERT_PATH
Laurent Peuch's avatar
init  
Laurent Peuch committed
17

Laurent Peuch's avatar
Laurent Peuch committed
18
    cd $RENEW_CERT_PATH
Laurent Peuch's avatar
init  
Laurent Peuch committed
19

Laurent Peuch's avatar
Laurent Peuch committed
20
    sudo git checkout d4f6781377143c230dc139d2613b6c6468233507 || echo ""
21

Laurent Peuch's avatar
init  
Laurent Peuch committed
22 23 24 25 26 27 28 29
    # I need system site packages otherwise moulinette is broken
    sudo virtualenv ve --system-site-packages
    sudo ve/bin/pip install -r requirements.txt

    cd $install_dir
}

renew_cert() {
Laurent Peuch's avatar
Laurent Peuch committed
30 31 32 33 34
    set -e

    install_dir=$(pwd)

    cd $RENEW_CERT_PATH
Laurent Peuch's avatar
init  
Laurent Peuch committed
35 36
    sudo ve/bin/python renew_from_cube.py

Laurent Peuch's avatar
Laurent Peuch committed
37 38
    cd $install_dir
}
Laurent Peuch's avatar
init  
Laurent Peuch committed
39 40 41

sudo yunohost app setting neutrinet version -v "0.1"

42 43
sudo yunohost app fetchlist -n neutrinet -u https://neutrinet.be/apps.json

Laurent Peuch's avatar
init  
Laurent Peuch committed
44 45 46 47 48 49
install_renew_cert

# vpn is not running, let's assume for now that this mean that the vpn is broken
if [ ! "$((ip -4 addr show tun0 | grep 'inet 80.67.181.') || echo '')" ]; then
    renew_cert
fi