ddns-scripts: change install path of custom service providers
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
parent
cde01dc150
commit
3ec59622e9
1 changed files with 21 additions and 20 deletions
|
@ -20,15 +20,15 @@ usage() {
|
||||||
echo "Usage: $(basename "$0") <command> <action> <service>"
|
echo "Usage: $(basename "$0") <command> <action> <service>"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Supported ddns <command>:"
|
echo "Supported ddns <command>:"
|
||||||
echo " service: Command for ddns service provider"
|
echo " service: Command for custom ddns service providers"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Supported ddns 'service' command <action>:"
|
echo "Supported ddns 'service' command <action>:"
|
||||||
echo " update: Update local ddns service list"
|
echo " update: Update local custom ddns service list"
|
||||||
echo " list-available: List all available service providers"
|
echo " list-available: List all available custom service providers"
|
||||||
echo " list-installed: List all installed service providers"
|
echo " list-installed: List all installed custom service providers"
|
||||||
echo " install <service>: Install service provider"
|
echo " install <service>: Install custom service provider"
|
||||||
echo " remove <service>: Remove service provider"
|
echo " remove <service>: Remove custom service provider"
|
||||||
echo " purge: Remove local ddns serivces"
|
echo " purge: Remove local custom ddns services"
|
||||||
|
|
||||||
exit "$code"
|
exit "$code"
|
||||||
}
|
}
|
||||||
|
@ -63,16 +63,16 @@ action_list_available() {
|
||||||
if [ -f "${DDNS_PACKAGE_DIR}/list" ]; then
|
if [ -f "${DDNS_PACKAGE_DIR}/list" ]; then
|
||||||
cat "${DDNS_PACKAGE_DIR}/list"
|
cat "${DDNS_PACKAGE_DIR}/list"
|
||||||
else
|
else
|
||||||
echo "No service file found please download first"
|
echo "No custom service list file found. Please download first"
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
action_list_installed() {
|
action_list_installed() {
|
||||||
if [ -d "${DDNS_PACKAGE_DIR}/services" ]; then
|
if [ -d "${DDNS_PACKAGE_DIR}/custom" ]; then
|
||||||
ls "${DDNS_PACKAGE_DIR}/services"
|
ls "${DDNS_PACKAGE_DIR}/custom"
|
||||||
else
|
else
|
||||||
echo "No services installed"
|
echo "No custom services installed"
|
||||||
exit 4
|
exit 4
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -83,25 +83,26 @@ action_install() {
|
||||||
local url cacert
|
local url cacert
|
||||||
|
|
||||||
config_load ddns
|
config_load ddns
|
||||||
config_get url global 'url' "${URL}${DDNS_PACKAGE_DIR}"
|
config_get url global 'url' "${URL}${DDNS_PACKAGE_DIR}/services"
|
||||||
config_get cacert global 'cacert' "IGNORE"
|
config_get cacert global 'cacert' "IGNORE"
|
||||||
url="${url}/services/${service}.json"
|
url="${url}/${service}.json"
|
||||||
|
|
||||||
if [ -z "$service" ]; then
|
if [ -z "$service" ]; then
|
||||||
usage "4" "No service specified"
|
usage "4" "No custom service specified"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "${DDNS_PACKAGE_DIR}/services"
|
mkdir -p "${DDNS_PACKAGE_DIR}/custom"
|
||||||
|
|
||||||
if [ "$cacert" = "IGNORE" ]; then
|
if [ "$cacert" = "IGNORE" ]; then
|
||||||
uclient-fetch \
|
uclient-fetch \
|
||||||
--no-check-certificate \
|
--no-check-certificate \
|
||||||
"${url}" \
|
"${url}" \
|
||||||
-O "${DDNS_PACKAGE_DIR}/services/${service}.json"
|
-O "${DDNS_PACKAGE_DIR}/custom/${service}.json"
|
||||||
elif [ -f "$cacert" ]; then
|
elif [ -f "$cacert" ]; then
|
||||||
uclient-fetch \
|
uclient-fetch \
|
||||||
--ca-certifcate="${cacert}" \
|
--ca-certifcate="${cacert}" \
|
||||||
"${url}" \
|
"${url}" \
|
||||||
-O "${DDNS_PACKAGE_DIR}/services/${service}.json"
|
-O "${DDNS_PACKAGE_DIR}/custom/${service}.json"
|
||||||
elif [ -n "$cacert" ]; then
|
elif [ -n "$cacert" ]; then
|
||||||
echo "Certification file not found ($cacert)"
|
echo "Certification file not found ($cacert)"
|
||||||
exit 5
|
exit 5
|
||||||
|
@ -111,14 +112,14 @@ action_install() {
|
||||||
action_remove() {
|
action_remove() {
|
||||||
local service="$1"
|
local service="$1"
|
||||||
if [ -z "$service" ]; then
|
if [ -z "$service" ]; then
|
||||||
usage "4" "No service specified"
|
usage "4" "No custom service specified"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm "${DDNS_PACKAGE_DIR}/services/${service}.json"
|
rm "${DDNS_PACKAGE_DIR}/custom/${service}.json"
|
||||||
}
|
}
|
||||||
|
|
||||||
action_purge() {
|
action_purge() {
|
||||||
rm -rf "${DDNS_PACKAGE_DIR}/services"
|
rm -rf "${DDNS_PACKAGE_DIR}/custom"
|
||||||
rm -rf "${DDNS_PACKAGE_DIR}/list"
|
rm -rf "${DDNS_PACKAGE_DIR}/list"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue