61 lines
2.1 KiB
Bash
61 lines
2.1 KiB
Bash
# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package
|
|
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
|
|
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
|
|
|
|
# The prepare function is executed in the root of the temp directory
|
|
# This function is used for putting downloaded files to the correct location or applying patches
|
|
prepare() {
|
|
cd "$BPM_SOURCE"
|
|
|
|
autoreconf -fi
|
|
}
|
|
|
|
# The build function is executed in the source directory
|
|
# This function is used to compile the source code
|
|
build() {
|
|
mkdir build
|
|
|
|
./configure --prefix=/usr \
|
|
--enable-dco \
|
|
--enable-pkcs11 \
|
|
--enable-plugins \
|
|
--disable-systemd \
|
|
--enable-x509-alt-username
|
|
make
|
|
}
|
|
|
|
# The check function is executed in the source directory
|
|
# This function is used to run tests to verify the package has been compiled correctly
|
|
check() {
|
|
make check
|
|
}
|
|
|
|
# The package function is executed in the source directory
|
|
# This function is used to move the compiled files into the output directory
|
|
package() {
|
|
make DESTDIR="$BPM_OUTPUT" install
|
|
|
|
# Install esvm service
|
|
install -Dm644 "$BPM_WORKDIR"/openvpn.esv "$BPM_OUTPUT"/etc/esvm/services/openvpn.esv
|
|
|
|
# Install sysusers
|
|
install -Dm644 "$BPM_WORKDIR"/sysusers "$BPM_OUTPUT"/usr/lib/sysusers.d/openvpn.conf
|
|
|
|
# Install examples
|
|
install -d "$BPM_OUTPUT"/usr/share/openvpn
|
|
cp -r sample/sample-config-files "$BPM_OUTPUT"/usr/share/openvpn/examples
|
|
|
|
# Install contrib
|
|
for FILE in $(find contrib -type f); do
|
|
case "$(file --brief --mime-type --no-sandbox "$FILE")" in
|
|
"text/x-shellscript")
|
|
install -Dm755 "$FILE" "$BPM_OUTPUT"/usr/share/openvpn/"$FILE" ;;
|
|
*)
|
|
install -Dm644 "$FILE" "$BPM_OUTPUT"/usr/share/openvpn/"$FILE" ;;
|
|
esac
|
|
done
|
|
|
|
# Install package license
|
|
install -Dm644 "$BPM_SOURCE"/{COPYING,COPYRIGHT.GPL} -t "$BPM_OUTPUT"/usr/share/licenses/openvpn
|
|
}
|