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

3
4
5
6
7
8
9
10
11
12
# Retrieve arguments
domain=$1
path=$2

# Check domain/path availability
sudo yunohost app checkurl $domain$path -a neutrinet
if [[ ! $? -eq 0 ]]; then
    exit 1
fi

13
source ./commons
Laurent Peuch's avatar
Laurent Peuch committed
14

Laurent Peuch's avatar
init  
Laurent Peuch committed
15
16
17
install_renew_cert() {
    set -e

Laurent Peuch's avatar
Laurent Peuch committed
18
19
    install_dir=$(pwd)

20
    if [ -e $RENEW_CERT_PATH ]; then
Laurent Peuch's avatar
Laurent Peuch committed
21
        sudo rm -rf $RENEW_CERT_PATH
22
23
    fi

24
    sudo apt-get update
Laurent Peuch's avatar
init  
Laurent Peuch committed
25
26
    sudo apt-get install -y python-virtualenv

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

Laurent Peuch's avatar
Laurent Peuch committed
29
    cd $RENEW_CERT_PATH
Laurent Peuch's avatar
init  
Laurent Peuch committed
30

Laurent Peuch's avatar
Laurent Peuch committed
31
    sudo git checkout ccc5b6b58010bb4166c2ae1a72df340395827f99 || echo ""
32

Laurent Peuch's avatar
init  
Laurent Peuch committed
33
34
35
36
37
38
39
40
    # 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
41
42
43
44
45
    set -e

    install_dir=$(pwd)

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

Laurent Peuch's avatar
Laurent Peuch committed
48
49
    cd $install_dir
}
Laurent Peuch's avatar
init  
Laurent Peuch committed
50

51
sudo yunohost app setting neutrinet version -v "0.1.1"
Laurent Peuch's avatar
init  
Laurent Peuch committed
52

53
sudo yunohost app fetchlist -n neutrinet -u https://neutrinet.be/apps.json
54
sudo yunohost app fetchlist -n labriqueinternet -u https://labriqueinter.net/apps/labriqueinternet.json
55

Laurent Peuch's avatar
init  
Laurent Peuch committed
56
57
58
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
59
if [ ! "$(grep '^port 1195' /etc/openvpn/client.conf)" ]; then
Laurent Peuch's avatar
init  
Laurent Peuch committed
60
61
    renew_cert
fi