[package] ddns-scripts: add https support to ddns-scripts

adds a "use_https" and "cacert" option to the ddns-scripts package.

when use_https is enabled, then curl is required to perform the update.

the cacert option can be set to either a single file containing a trust
signing authority certificate or a directory containing certificates
which has been prepared with the usual c_rehash method.

Signed-off-by: Matthew William Cox <matt@mattcox.ca>

git-svn-id: svn://svn.openwrt.org/openwrt/packages@25578 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian 2011-02-19 12:44:03 +00:00
parent 5be4d2c626
commit c926b187c1
2 changed files with 27 additions and 2 deletions

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=ddns-scripts
PKG_VERSION:=1.0.0
PKG_RELEASE:=12
PKG_RELEASE:=13
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

View File

@ -45,6 +45,9 @@ fi
#config_get domain $service_id domain
#
#
#config_get use_https $service_id use_https
#config_get cacert $service_id cacert
#
#config_get ip_source $service_id ip_source
#config_get ip_interface $service_id ip_interface
#config_get ip_network $service_id ip_network
@ -81,11 +84,29 @@ then
force_unit="hours"
fi
if [ -z "$use_https" ]
then
use_https=0
fi
#some constants
retrieve_prog="/usr/bin/wget -O - ";
if [ "x$use_https" = "x1" ]
then
retrieve_prog="/usr/bin/curl "
if [ -f "$cacert" ]
then
retrieve_prog="${retrieve_prog}--cacert $cacert "
elif [ -d "$cacert" ]
then
retrieve_prog="${retrieve_prog}--capath $cacert "
fi
else
retrieve_prog="/usr/bin/wget -O - ";
fi
service_file="/usr/lib/ddns/services"
ip_regex="[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}"
@ -118,6 +139,10 @@ then
IFS=$OLD_IFS
fi
if [ "x$use_https" = x1 ]
then
update_url=$(echo $update_url | sed -e 's/^http:/https:/')
fi
verbose_echo "update_url=$update_url"