Ubuntu Pastebin

Paste from ubuntu at Fri, 26 Aug 2016 18:46:42 +0000

Download as text
 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
#!/bin/bash
set -e
set -o pipefail

LOG="$PWD/my.log"
cleanup() {
   network_up
}

network_up() {
    sudo ifup eth0
}

network_down() {
    sudo ifdown eth0
}

msg() { echo "$@" >> "$LOG"; echo "$@" 1>&2; }
run() {
    local envcmd="" n=$SECONDS
    msg "[start]" "${@}"
    "$@"
    r=$?
    msg "[finished ret=$r took=$(($SECONDS-n))]" "$@"
    return $r
}

trap cleanup EXIT

npm_install=( npm --cache-min=Infinity install azure-cli )

# do it as would be in the pull section
network_up
rm -Rf pull
mkdir pull
msg pull network-up
( cd pull && run "${npm_install[@]}" ) 2>&1 | tee pull.log

msg build network-down
network_down
rm -Rf build
mkdir build
( cd build && run "${npm_install[@]}" ) 2>&1 | tee build.log
Download as text