]> code.ossystems Code Review - openembedded-core.git/commitdiff
oe-git-proxy: don't depend on syslinux
authorAndré Draszik <git@andred.net>
Fri, 15 Jul 2016 15:03:27 +0000 (16:03 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 20 Jul 2016 09:24:55 +0000 (10:24 +0100)
gethostip comes from syslinux. It seems odd to depend on a bootloader
to clone a git repository.

Switch to using getent from the c-library, which should be available
on every system.

We now also support the case where a hostname resolves to more than
one IP address.

Signed-off-by: André Draszik <git@andred.net>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/oe-git-proxy

index 12479024062828818266f0ebaf6173efe87d92c1..0078e95450266cd4471c076ed4b11d2f96a8df50 100755 (executable)
@@ -86,13 +86,14 @@ match_host() {
 
        # Match by netmask
        if valid_ipv4 $GLOB; then
-               HOST_IP=$(gethostip -d $HOST)
-               if valid_ipv4 $HOST_IP; then
-                       match_ipv4 $GLOB $HOST_IP
-                       if [ $? -eq 0 ]; then
-                               return 0
+               for HOST_IP in $(getent ahostsv4 $HOST | grep ' STREAM ' | cut -d ' ' -f 1) ; do
+                       if valid_ipv4 $HOST_IP; then
+                               match_ipv4 $GLOB $HOST_IP
+                               if [ $? -eq 0 ]; then
+                                       return 0
+                               fi
                        fi
-               fi
+               done
        fi
 
        return 1