openwrt/package/libs/openssl/files/openssl.init

32 lines
845 B
Plaintext
Raw Normal View History

#!/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
}