aboutsummaryrefslogtreecommitdiffstats
path: root/package/libs/openssl/files/openssl.init
diff options
context:
space:
mode:
Diffstat (limited to 'package/libs/openssl/files/openssl.init')
-rwxr-xr-xpackage/libs/openssl/files/openssl.init31
1 files changed, 31 insertions, 0 deletions
diff --git a/package/libs/openssl/files/openssl.init b/package/libs/openssl/files/openssl.init
new file mode 100755
index 0000000000..21e253e7a5
--- /dev/null
+++ b/package/libs/openssl/files/openssl.init
@@ -0,0 +1,31 @@
+#!/bin/sh /etc/rc.common
+
+START=13
+ENGINES_CNF_D="/etc/ssl/engines.cnf.d"
+ENGINES_CNF="/var/etc/ssl/engines.cnf"
+ENGINES_DIR="%ENGINES_DIR%"
+
+config_engine() {
+ local enabled force
+ config_get_bool enabled "$1" enabled 1
+ config_get_bool force "$1" force 0
+ [ "$enabled" = 0 ] && return
+ if [ "$force" = 0 ] && \
+ [ ! -f "${ENGINES_CNF_D}/$1.cnf" ] && \
+ [ ! -f "${ENGINES_DIR}/$1.so" ]; then
+ echo Skipping engine "$1": not installed
+ return
+ fi
+ echo Enabling engine "$1"
+ echo "$1=$1" >> "${ENGINES_CNF}"
+}
+
+start() {
+ mkdir -p "$(dirname "${ENGINES_CNF}")" || exit 1
+ echo Generating engines.cnf
+ echo "# This file is automatically generated from /etc/config/openssl." \
+ > "${ENGINES_CNF}" || \
+ { echo Error writing ${ENGINES_CNF} >&2; exit 1; }
+ config_load openssl
+ config_foreach config_engine engine
+}