1 #!/bin/sh /etc/rc.common
4 ENGINES_CNF_D
="/etc/ssl/engines.cnf.d"
5 ENGINES_CNF
="/var/etc/ssl/engines.cnf"
6 ENGINES_DIR
="%ENGINES_DIR%"
9 local builtin enabled force
11 config_get_bool
builtin "$1" builtin 0
12 config_get_bool enabled
"$1" enabled
1
13 config_get_bool force
"$1" force
0
15 if [ "$enabled" = 0 ]; then
16 [ "$builtin" != 1 ] && return 1
17 echo "Engine $1 is built into the libcrypto library and can't be disabled through UCI." && \
18 echo "If the engine was not built-in, remove 'config builtin' from /etc/config/openssl."
19 elif [ "$force" = 1 ]; then
21 elif ! grep -q "\\[ *$1 *]" "${ENGINES_CNF_D}"/*; then
22 echo "$1: Could not find section [$1] in config files."
24 elif [ "$builtin" = 1 ]; then
26 elif [ ! -f "${ENGINES_DIR}/$1.so" ];then
27 echo "$1: ${ENGINES_DIR}/$1.so not found."
30 echo Enabling engine
"$1"
31 echo "$1=$1" >> "${ENGINES_CNF}"
35 mkdir
-p "$(dirname "${ENGINES_CNF}")" ||
exit 1
36 echo Generating engines.cnf
37 echo "# This file is automatically generated from /etc/config/openssl." \
38 > "${ENGINES_CNF}" || \
39 { echo Error writing
${ENGINES_CNF} >&2; exit 1; }
41 config_foreach config_engine engine