You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
613 B
Bash
27 lines
613 B
Bash
#!/bin/sh
|
|
|
|
. /lib/functions.sh
|
|
|
|
NEW_PASSWORD="$1"
|
|
|
|
MY_SERVICE_NAME=dlanApp2Backend
|
|
|
|
HTTP_REALM=$(uci_get ${MY_SERVICE_NAME} global http_realm "")
|
|
HTTP_USERNAME=$(uci_get ${MY_SERVICE_NAME} global http_username "")
|
|
|
|
[ -n "${HTTP_REALM}" -a -n "${HTTP_USERNAME}" ] || exit 1
|
|
|
|
if [ -n "${NEW_PASSWORD}" ]; then
|
|
NEW_HA1=$(echo -n "${HTTP_USERNAME}:${HTTP_REALM}:${NEW_PASSWORD}" | md5sum | cut -d ' ' -f 1)
|
|
else
|
|
NEW_HA1=""
|
|
fi
|
|
|
|
uci_set ${MY_SERVICE_NAME} global http_password ""
|
|
uci_set ${MY_SERVICE_NAME} global http_ha1 ${NEW_HA1}
|
|
|
|
uci_commit ${MY_SERVICE_NAME}
|
|
/etc/init.d/${MY_SERVICE_NAME} reload
|
|
|
|
exit 0
|