-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
73 lines (61 loc) · 1.5 KB
/
install.sh
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
#!/bin/sh
fail () {
echo "$@"
exit 1
}
cd `dirname $0`
TOP=`pwd`
TOOLS="$TOP/tools"
mkdir -p $TOOLS
if [ -z "$TOOLSCRIPT" ]; then
TOOLSCRIPT=$TOOLS/install.log
exec script -a $TOOLSCRIPT env "TOOLSCRIPT=$TOOLSCRIPT" /bin/sh install.sh "$@"
fi
echo "Current directory is $TOP"
echo "Downloading submodules (if needed) ... "
git submodule update --init --recursive
PYTHON=python
VERS=`$PYTHON --version 2>&1 | awk '{print $2}'`
case "$VERS" in
3*)
echo "Using $PYTHON version $VERS"
;;
*)
echo "$PYTHON version $VERS not acceptable; trying python3"
PYTHON=python3
VERS=`$PYTHON --version 2>&1 | awk '{print $2}'`
case "$VERS" in
3*)
echo "Using $PYTHON version $VERS"
;;
*)
fail "Unable to find python3; instant death"
;;
esac
;;
esac
echo "Installing libslax ..."
cd submodules/libslax/
autoreconf --install
autoreconf --install
mkdir build
cd build
../configure --prefix $TOOLS
make && make install && make test
if [ $? -ne 0 ]; then
fail "libslax build failed"
fi
echo "Installing xml2rfc ..."
cd $TOP/submodules/xml2rfc
$PYTHON setup.py install --user --install-scripts=$TOOLS/bin
if [ $? -ne 0 ]; then
fail "xml2rfc build failed"
fi
echo "Installing pyang ..."
cd $TOP/submodules/pyang
$PYTHON setup.py install --user --install-scripts=$TOOLS/bin
if [ $? -ne 0 ]; then
fail "pyang build failed"
fi
echo "Install complete"
exit 0