#!/bin/bash
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.

echo "Error: Please review this virtual install script and remove this line."
exit 1

if [ -z ${INST_DIR+x} ]; then
	export INST_DIR="${TmpInstDir}"
fi

make DESTDIR="${INST_DIR}" install_sw install_ssldirs install_fips

mv "${INST_DIR}"/etc/ssl/openssl-3/fipsmodule.cnf "${INST_DIR}"/

if [ "x$NOSTRIP" != "xNOSTRIP" ]; then
	$STRIP "${INST_DIR}"/usr/lib/openssl-3/*.so*
fi

[ -d "${INST_DIR}/lib" ] || install -d "${INST_DIR}/lib"
cp -af "${INST_DIR}"/usr/lib/openssl-3/*.so* "${INST_DIR}"/lib

rm -rf "${INST_DIR}"/usr
rm -rf "${INST_DIR}"/etc/ssl

install -Dm644 synology/openssl.cnf "${INST_DIR}"/etc/ssl/openssl-3/openssl.cnf
mv "${INST_DIR}"/fipsmodule.cnf "${INST_DIR}"/etc/ssl/openssl-3/fipsmodule.cnf
