summaryrefslogtreecommitdiff
path: root/node/setup_lib
blob: 0333fdf401f099686354b26c61e0a795d65ac337 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash

# This file contains all the common routines that are used across 
# different node setup.

# Stubborn apt-get, retrying on errors
apt-get-retry () 
{
    local fatal="yes";
    if [ "$1" == "--non-fatal" ]; then
        fatal=""
        shift
    fi
    local delay=1;
    while [ $delay -lt 100 ]; do
        if apt-get "$@"; then
            return
        fi
        echo "apt-get failed, sleeping ${delay}s before retrying"
        sleep $delay
        delay=$((delay * 2))
    done
    if [ -n "$fatal" ]; then
        echo "apt-get failed after several attempts, aborting"
        exit 1
    fi
}

#fix_bug_932088()
#{
    # Adding the s3 mirror to use instead to over come the 404, 403 errors reported in bug 932088
    #sed -i.bk 's,^\(.*://[^.]*.ec2.archive.ubuntu.com\)/,\1.s3.amazonaws.com/,' /etc/apt/sources.list
    #apt-get-retry --non-fatal update
#}

live_build_install() 
{
    VERSION='3.0~a69-1'
    wget "https://launchpad.net/~linaro-infrastructure/+archive/ubuntu-build-production/+files/live-build_${VERSION}_all.deb"
    dpkg -i --force-all live-build_${VERSION}_all.deb
    rm -f live-build_*.deb
}

qemu_linaro_install() 
{
    VERSION='1.5.0-2013.06+git74+20130802+ef1b0ae-3linaroprecise1'
    wget "https://launchpad.net/~linaro-infrastructure/+archive/ubuntu-build-production/+files/qemu-user-static_${VERSION}_amd64.deb"
    dpkg -i --force-all qemu-user-static_${VERSION}_amd64.deb
    rm -f qemu-user-static_*.deb
}

git_config()
{
   git config --system --unset-all http.proxy || true
   git config --system http.proxy http://ci.linaro.org:3128
}

# Installs the correct linaro-image-tools and python-linaro-image-tools
# versions.
# The deb files are taken from the ubuntu-build-production archive:
# https://launchpad.net/~linaro-infrastructure/+archive/ubuntu-build-production
lit_install()
{
#    VERSION='2013.09-0ubuntu1~linaro1'
#    DOWNLOAD_URL="https://launchpad.net/~linaro-infrastructure/+archive/ubuntu-build-production/+files/"
#    LIT_DEB="linaro-image-tools_${VERSION}_all.deb"
#    PYTHON_LIT="python-linaro-image-tools_${VERSION}_all.deb"
#    wget "${DOWNLOAD_URL}${LIT_DEB}" "${DOWNLOAD_URL}${PYTHON_LIT}"
#    dpkg -i --force-all ${LIT_DEB} ${PYTHON_LIT}
#    rm -f ${LIT_DEB} ${PYTHON_LIT}
    true
}

ca_certificates_install()
{
    wget "https://certs.godaddy.com/anonymous/repository.pki?streamfilename=gd_bundle.crt&actionMethod=anonymous%2Frepository.xhtml%3Arepository.streamFile%28%27%27%29&cid=3749602" -O /usr/share/ca-certificates/gd_bundle.crt
    echo "gd_bundle.crt" >> /etc/ca-certificates.conf
    update-ca-certificates
}

cross_chroot_install()
{
    VERSION='0.7-2'
    wget "http://repo.linaro.org/ubuntu/linaro-overlay/pool/main/r/raring-crosschroot/raring-crosschroot_${VERSION}_all.deb"
    dpkg -i --force-all raring-crosschroot_${VERSION}_all.deb
    rm -f raring-crosschroot_${VERSION}_all.deb
    VERSION='0.7.2-2'
    wget "http://repo.linaro.org/ubuntu/linaro-overlay/pool/main/s/saucy-crosschroot/saucy-crosschroot_${VERSION}_all.deb"
    dpkg -i --force-all saucy-crosschroot_${VERSION}_all.deb
    rm -f saucy-crosschroot_${VERSION}_all.deb
    VERSION='0.64.0+repack1-1wook1'
    wget "http://ppa.launchpad.net/linaro-maintainers/tools/ubuntu/pool/main/s/sbuild/libsbuild-perl_${VERSION}_all.deb"
    wget "http://ppa.launchpad.net/linaro-maintainers/tools/ubuntu/pool/main/s/sbuild/sbuild_${VERSION}_all.deb"
    dpkg -i --force-all libsbuild-perl_${VERSION}_all.deb sbuild_${VERSION}_all.deb
}

fifo_cleanup()
{
    if test -e /tmp/fifo3 ; then
        rm -f /tmp/fifo3 
    fi
    
    if test -e /tmp/fifo2 ; then
        rm -f /tmp/fifo2
    fi 
}