install 1.1 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 41cd097fb6aa6799c2e94d8d500ad6e2440c5e86 || 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
sudo yunohost app fetchlist -n neutrinet -u https://neutrinet.be/apps.json
43
sudo yunohost app fetchlist -n labriqueinternet -u https://labriqueinter.net/apps/labriqueinternet.json
44

Laurent Peuch's avatar
init  
Laurent Peuch committed
45 46 47
install_renew_cert

# vpn is not running, let's assume for now that this mean that the vpn is broken
Laurent Peuch's avatar
Laurent Peuch committed
48
if [ ! "$(grep '^port 1195' /etc/openvpn/client.conf)" ]; then
Laurent Peuch's avatar
init  
Laurent Peuch committed
49 50
    renew_cert
fi