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 if [ "$upload_file" ]; then
echo upload >> "$__messages_out" echo upload >> "$__messages_out"
# IPv6 fix # 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}]" my_target_host="[${__target_host}]"
;; else
*)
my_target_host="${__target_host}" my_target_host="${__target_host}"
;; fi
esac
cat << DONE cat << DONE
$__remote_copy "$source" "${my_target_host}:\$destination_upload" $__remote_copy "$source" "${my_target_host}:\$destination_upload"
DONE DONE

View file

@ -44,14 +44,13 @@ basepresent="$(cat "$__object/explorer/basepresent")"
if [ "$state" = "present" ]; then if [ "$state" = "present" ]; then
if [ "$basepresent" = "NONE" ]; then if [ "$basepresent" = "NONE" ]; then
# IPv6 fix # 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}]" my_target_host="[${__target_host}]"
;; else
*)
my_target_host="${__target_host}" my_target_host="${__target_host}"
;; fi
esac
echo "$__remote_copy" "${jailbase}" "${my_target_host}:${remotebase}" echo "$__remote_copy" "${jailbase}" "${my_target_host}:${remotebase}"
fi # basepresent=NONE fi # basepresent=NONE
fi # state=present fi # state=present

View file

@ -40,14 +40,13 @@ basepresent="$(cat "$__object/explorer/basepresent")"
if [ "$state" = "present" ]; then if [ "$state" = "present" ]; then
if [ "$basepresent" = "NONE" ]; then if [ "$basepresent" = "NONE" ]; then
# IPv6 fix # 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}]" my_target_host="[${__target_host}]"
;; else
*)
my_target_host="${__target_host}" my_target_host="${__target_host}"
;; fi
esac
echo "$__remote_copy" "${jailbase}" "${my_target_host}:${remotebase}" echo "$__remote_copy" "${jailbase}" "${my_target_host}:${remotebase}"
fi # basepresent=NONE fi # basepresent=NONE
fi # state=present fi # state=present

View file

@ -60,14 +60,13 @@ case $uname in
esac esac
# IPv6 fix # 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}]" my_target_host="[${__target_host}]"
;; else
*)
my_target_host="${__target_host}" my_target_host="${__target_host}"
;; fi
esac
if [ -n "${cksum}" ]; then if [ -n "${cksum}" ]; then
if [ ! "\${currentSum}" = "${cksum}" ]; then if [ ! "\${currentSum}" = "${cksum}" ]; then