2022-03-23 01:03:30 +08:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
#
|
|
|
|
# Copyright (C) 2022 Enéas Ulir de Queiroz
|
|
|
|
|
2022-02-21 08:09:29 +08:00
|
|
|
ENGINES_DIR=engines-1.1
|
|
|
|
|
|
|
|
define Package/openssl/engine/Default
|
|
|
|
SECTION:=libs
|
|
|
|
CATEGORY:=Libraries
|
|
|
|
SUBMENU:=SSL
|
|
|
|
DEPENDS:=libopenssl @OPENSSL_ENGINE +libopenssl-conf
|
|
|
|
endef
|
|
|
|
|
|
|
|
# 1 = engine name
|
|
|
|
# 2 - package name, defaults to libopenssl-$(1)
|
|
|
|
define Package/openssl/add-engine
|
|
|
|
OSSL_ENG_PKG:=$(if $(2),$(2),libopenssl-$(1))
|
|
|
|
Package/$$(OSSL_ENG_PKG)/conffiles:=/etc/ssl/engines.cnf.d/$(1).cnf
|
|
|
|
|
|
|
|
define Package/$$(OSSL_ENG_PKG)/install
|
|
|
|
$$(INSTALL_DIR) $$(1)/usr/lib/$(ENGINES_DIR)
|
|
|
|
$$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/lib/$(ENGINES_DIR)/$(1).so \
|
|
|
|
$$(1)/usr/lib/$(ENGINES_DIR)
|
|
|
|
$$(INSTALL_DIR) $$(1)/etc/ssl/engines.cnf.d
|
|
|
|
$$(INSTALL_DATA) ./files/$(1).cnf $$(1)/etc/ssl/engines.cnf.d/
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/$$(OSSL_ENG_PKG)/postinst :=
|
|
|
|
#!/bin/sh
|
2022-02-21 08:09:30 +08:00
|
|
|
OPENSSL_UCI="$$$${IPKG_INSTROOT}/etc/config/openssl"
|
2022-02-21 08:09:29 +08:00
|
|
|
|
2022-02-21 08:09:30 +08:00
|
|
|
[ -z "$$$${IPKG_INSTROOT}" ] && uci -q get openssl.$(1) >/dev/null && exit 0
|
2022-02-21 08:09:29 +08:00
|
|
|
|
2022-02-21 08:09:30 +08:00
|
|
|
cat << EOF >> "$$$${OPENSSL_UCI}"
|
2022-02-21 08:09:29 +08:00
|
|
|
|
2022-02-21 08:09:30 +08:00
|
|
|
config engine '$(1)'
|
|
|
|
option enabled '1'
|
|
|
|
EOF
|
2022-02-21 08:09:29 +08:00
|
|
|
|
2022-02-21 08:09:30 +08:00
|
|
|
[ -n "$$$${IPKG_INSTROOT}" ] || /etc/init.d/openssl reload
|
2022-02-21 08:09:29 +08:00
|
|
|
endef
|
|
|
|
|
2022-02-21 08:09:30 +08:00
|
|
|
define Package/$$(OSSL_ENG_PKG)/postrm :=
|
2022-02-21 08:09:29 +08:00
|
|
|
#!/bin/sh
|
2022-02-21 08:09:30 +08:00
|
|
|
[ -n "$$$${IPKG_INSTROOT}" ] && exit 0
|
|
|
|
uci delete openssl.$(1)
|
|
|
|
uci commit openssl
|
|
|
|
/etc/init.d/openssl reload
|
2022-02-21 08:09:29 +08:00
|
|
|
endef
|
|
|
|
endef
|