-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathedge.sh
executable file
·81 lines (67 loc) · 2.72 KB
/
edge.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
74
75
76
77
78
79
80
81
#!/bin/bash
# Stop the script if it's already intalled.
if [[ -e /tmp/edge_installed ]]; then
exit 0
fi
compile_libpar2(){
{
mkdir /tmp/libpar2
wget -nv https://launchpad.net/libpar2/trunk/0.4/+download/libpar2-0.4.tar.gz -O - | tar --strip-components 1 -C /tmp/libpar2 -zxf -
wget -nv http://nzbget.net/files/libpar2-0.4-external-verification.patch -O /tmp/libpar2/libpar2-0.4-external-verification.patch
cd /tmp/libpar2
patch < libpar2-0.4-external-verification.patch
./configure --prefix=/usr
make -j5
make install
cd /
rm -rf cd /tmp/libpar2
} &> /config/libpar2-compile.log
echo "libpar2 build log exported to /config/libpar2-compile.log"
}
if [[ -n $EDGE ]]; then
echo "Compiling from source."
# Install build dependencies
{
apt-get update -qq
apt-get remove -y nzbget libpar2-1
apt-get install -qy libncurses5-dev sigc++ libssl-dev libxml2-dev sigc++ build-essential git
add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update -qq
apt-get install gcc-4.9 g++-4.9 cpp-4.9
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 40 --slave /usr/bin/gcc gcc /usr/bin/gcc-4.9
update-alternatives --config gcc
update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-4.9 40 --slave /usr/bin/cpp cpp /usr/bin/cpp-4.9
update-alternatives --config cpp
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9
update-alternatives --config g++
} &> /config/nzbget-${EDGE}-compile.log
# Patch and compile libpar2
echo "Start building libpar2"
compile_libpar2
# Compile nzbget
echo "Start building nzbget"
{
# Checkout the source code
git clone https://github.com/nzbget/nzbget.git /tmp/nzbget-source
# Build and install the source code
cd /tmp/nzbget-source
# Checkout whatever branch/tag/commit was provided
git checkout $EDGE
./configure --prefix=/usr --enable-parcheck
make -j5
make install
# Do a cleanup
cd /
apt-get remove -qy libncurses5-dev sigc++ libssl-dev libxml2-dev sigc++ build-essential subversion
rm -rf /tmp/nzbget-source
# Copy the config template to the webui path
cp /usr/share/nzbget/nzbget.conf /usr/share/nzbget/webui/
# Make sure all runtime dependencies are installed
apt-get install -y libxml2 sgml-base libsigc++-2.0-0c2a python2.7-minimal xml-core javascript-common \
libjs-jquery libjs-jquery-metadata libjs-jquery-tablesorter libjs-twitter-bootstrap libpython-stdlib \
python2.7 python-minimal python
} &>> /config/nzbget-${EDGE}-compile.log
echo "nzbget build log exported to /config/nzbget-${EDGE}-compile.log"
fi
# Mark edge as installed
touch /tmp/edge_installed