1 | #!/bin/sh |
---|
2 | # |
---|
3 | # Script to setup the environment for openvpn-build/generic and openvpn-build/windows-nsis |
---|
4 | |
---|
5 | # Exit immediate on errors |
---|
6 | set -e |
---|
7 | |
---|
8 | BUILD_DEPS="mingw-w64 man2html dos2unix nsis unzip wget curl autoconf libtool gcc-arm-linux-gnueabi" |
---|
9 | OSSLSIGNCODE_DEPS="libssl-dev libcurl4-openssl-dev build-essential" |
---|
10 | OSSLSIGNCODE_URL="https://netcologne.dl.sourceforge.net/project/osslsigncode/osslsigncode/osslsigncode-1.7.1.tar.gz" |
---|
11 | OSSLSIGNCODE_PACKAGE="osslsigncode-latest.tar.gz" |
---|
12 | OPENVPN_BUILD_URL="https://github.com/OpenVPN/openvpn-build.git" |
---|
13 | MINGW_PACKAGES="mingw-w64 mingw-w64-common mingw-w64-i686-dev mingw-w64-x86-64-dev" |
---|
14 | NSIS_PACKAGES="nsis nsis-common nsis-doc nsis-pluginapi" |
---|
15 | GIT_PKG="git" |
---|
16 | |
---|
17 | check_if_root() { |
---|
18 | if ! [ `whoami` = "root" ]; then |
---|
19 | echo "ERROR: you must run this script as root!" |
---|
20 | exit 1 |
---|
21 | fi |
---|
22 | } |
---|
23 | |
---|
24 | install_packages() { |
---|
25 | apt-get update |
---|
26 | apt-get -y install $BUILD_DEPS $GIT_PKG $GNUEABI_PKG $MINGW_PACKAGES $NSIS_PACKAGES |
---|
27 | } |
---|
28 | |
---|
29 | # osslsigncode is required for signing the binaries and installers |
---|
30 | install_osslsigncode() { |
---|
31 | apt-get -y install $OSSLSIGNCODE_DEPS |
---|
32 | curl -L $OSSLSIGNCODE_URL > $OSSLSIGNCODE_PACKAGE |
---|
33 | tar -zxf $OSSLSIGNCODE_PACKAGE |
---|
34 | cd osslsigncode-* |
---|
35 | ./configure |
---|
36 | make |
---|
37 | make install |
---|
38 | cd .. |
---|
39 | } |
---|
40 | |
---|
41 | clone_openvpn_build() { |
---|
42 | if ! [ -d "openvpn-build" ]; then |
---|
43 | git clone $OPENVPN_BUILD_URL |
---|
44 | fi |
---|
45 | } |
---|
46 | |
---|
47 | # Main script |
---|
48 | check_if_root |
---|
49 | install_packages |
---|
50 | install_osslsigncode |
---|
51 | clone_openvpn_build |
---|