Better test for IPv6 address.

This commit is contained in:
Darko Poljak 2016-11-05 16:38:49 +01:00
parent 4ddf6557e3
commit 6ce6c7830b
4 changed files with 28 additions and 32 deletions

View file

@ -67,14 +67,13 @@ DONE
if [ "$upload_file" ]; then
echo upload >> "$__messages_out"
# IPv6 fix
case "${__target_host}" in
*:*)
echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$'
if [ $? -eq 0 ]
then
my_target_host="[${__target_host}]"
;;
*)
else
my_target_host="${__target_host}"
;;
esac
fi
cat << DONE
$__remote_copy "$source" "${my_target_host}:\$destination_upload"
DONE

View file

@ -44,14 +44,13 @@ basepresent="$(cat "$__object/explorer/basepresent")"
if [ "$state" = "present" ]; then
if [ "$basepresent" = "NONE" ]; then
# IPv6 fix
case "${__target_host}" in
*:*)
echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$'
if [ $? -eq 0 ]
then
my_target_host="[${__target_host}]"
;;
*)
else
my_target_host="${__target_host}"
;;
esac
fi
echo "$__remote_copy" "${jailbase}" "${my_target_host}:${remotebase}"
fi # basepresent=NONE
fi # state=present

View file

@ -40,14 +40,13 @@ basepresent="$(cat "$__object/explorer/basepresent")"
if [ "$state" = "present" ]; then
if [ "$basepresent" = "NONE" ]; then
# IPv6 fix
case "${__target_host}" in
*:*)
echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$'
if [ $? -eq 0 ]
then
my_target_host="[${__target_host}]"
;;
*)
else
my_target_host="${__target_host}"
;;
esac
fi
echo "$__remote_copy" "${jailbase}" "${my_target_host}:${remotebase}"
fi # basepresent=NONE
fi # state=present

View file

@ -60,14 +60,13 @@ case $uname in
esac
# IPv6 fix
case "${__target_host}" in
*:*)
echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$'
if [ $? -eq 0 ]
then
my_target_host="[${__target_host}]"
;;
*)
else
my_target_host="${__target_host}"
;;
esac
fi
if [ -n "${cksum}" ]; then
if [ ! "\${currentSum}" = "${cksum}" ]; then