diff options
Diffstat (limited to 'net-misc/wakeonlan')
-rw-r--r-- | net-misc/wakeonlan/Manifest | 2 | ||||
-rw-r--r-- | net-misc/wakeonlan/files/wakeonlan-0.41-ethers-lookup-r1.patch | 90 | ||||
-rw-r--r-- | net-misc/wakeonlan/wakeonlan-0.41-r3.ebuild | 25 |
3 files changed, 117 insertions, 0 deletions
diff --git a/net-misc/wakeonlan/Manifest b/net-misc/wakeonlan/Manifest index 31c3f68029d3..190ca03c76bd 100644 --- a/net-misc/wakeonlan/Manifest +++ b/net-misc/wakeonlan/Manifest @@ -1,4 +1,6 @@ +AUX wakeonlan-0.41-ethers-lookup-r1.patch 2287 BLAKE2B 95bacd277caff21b056f3a8c159808594dce0fc60c735757148a315c87d02d110695b343eaffa28b067668b2f874ad1f88516fe9cee4f98621ecbb15396b1b4f SHA512 52a0b30aa8a2beee0056112b49cfe6ef6021f682f7ba1ba38173d227f5e103f34fdded8c61b7b399cc548ca5e182b47d320af6dffe617673aa873f08c20e1bc4 AUX wakeonlan-0.41-ethers-lookup.patch 2284 BLAKE2B fa45175d623a3e4cfb5b79ec4f499401b798a8fc3e4dd10a8d580f02083334db32ff5f925defb72b71d6ceceee3017d3bf9a4c2ef2559c9eb8e9d92e6e25a63e SHA512 39cdee0f2732f4d09822cbb82e4674e966b1648fbdd84b4a8adaf3b734ea2e8e4b5f0d535f7d70dbf3608c23ddc0761de9c5892a5c6c73613f322dc4e71db3d2 DIST wakeonlan-0.41.tar.gz 6028 BLAKE2B d560c7dd830daf596ffd7d797d1908d1fc90d20c6861a0e341b20eb38137b809fe1a78819f9ca729fa06f88285cfb22d0719092bed1d49d9763a7e2bb8a986bf SHA512 192ed2ad157e3f5af01632b8f2b727e232448e5a9bff6aec25298fa9913ec38f1036b665b141b5299994c88b1941d9896b6eaa92cfdb44d65db3628f50e3824f EBUILD wakeonlan-0.41-r2.ebuild 656 BLAKE2B d54b3d423bdc9e563beb94b7ff7a8bd11e15c2db232125966ce2f3036efec681d521f230b71cb245503ad890a8b4c606c7e59357370009d04d5f335a8628e670 SHA512 f1d799b8372909276834149a272340471e8a97312d4c5821f53c2382159dc160f8d2b4ab8ae60f9764fddbb5ee88df0703452a532b76571a4b099241b62b93cb +EBUILD wakeonlan-0.41-r3.ebuild 649 BLAKE2B 85edf6292cab6564eeb3c799e263e81df5724d78e371763295aeccda87e688e11d9c834cac99f86be86d19a1bc8a25b08f16b1733d8fb35509c08bcef76330e4 SHA512 c698e9b4f308a9e2e9013232cd920baabf22698d562ef3b4ff7ed44b5277b338696652503b7821d0f1b74e256ea7e22f9badaf8f88d35550aed56f9ffab2120e MISC metadata.xml 252 BLAKE2B d5ae1c6434a18a4052d21b9d34d573fceda4a6a37f4f0f1001fcd8c5d7d179d6f6d7df0f611b7129eddeb894dbcbf573d9c22f25dfc12fcd989900efe48b3512 SHA512 84cb947f6732467eb3137a917ea484aed7b45f56115790f8fb6595b73d0a558e03f379e239db903e4741934744c8eb10237382be10788787c684fafc854527d3 diff --git a/net-misc/wakeonlan/files/wakeonlan-0.41-ethers-lookup-r1.patch b/net-misc/wakeonlan/files/wakeonlan-0.41-ethers-lookup-r1.patch new file mode 100644 index 000000000000..3e01c3e52c38 --- /dev/null +++ b/net-misc/wakeonlan/files/wakeonlan-0.41-ethers-lookup-r1.patch @@ -0,0 +1,90 @@ +--- wakeonlan-0.41.orig/wakeonlan ++++ wakeonlan-0.41/wakeonlan +@@ -5,6 +5,7 @@ + ######################################################################### + + use strict; ++use Net::hostent; + use Socket; + use Getopt::Std; + use vars qw($VERSION $opt_v $opt_h $opt_i $opt_p $opt_f); +@@ -44,19 +45,64 @@ + + sub wake + { +- my $hwaddr = shift; ++ my $host = shift; + my $ipaddr = shift || $DEFAULT_IP; + my $port = shift || $DEFAULT_PORT; + + my ($raddr, $them, $proto); +- my ($hwaddr_re, $pkt); ++ my ($hwaddr, $hwaddr_re, $pkt); + +- # Validate hardware address (ethernet address) ++ # get the hardware address (ethernet address) + + $hwaddr_re = join(':', ('[0-9A-Fa-f]{1,2}') x 6); +- if ($hwaddr !~ m/^$hwaddr_re$/) { +- warn "Invalid hardware address: $hwaddr\n"; +- return undef; ++ if ($host =~ m/^$hwaddr_re$/) { ++ $hwaddr = $host; ++ } else { ++ # $host is not a hardware address, try to resolve it ++ my $ip_re = join('\.', ('([0-9]|[1-9][0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))') x 4); ++ my $ip_addr; ++ if ($host =~ m/^$ip_re$/) { ++ $ip_addr = $host; ++ } else { ++ my $h; ++ unless ($h = gethost($host)) { ++ warn "$host is not a hardware address and I could not resolve it as to an IP address.\n"; ++ return undef; ++ } ++ $ip_addr = inet_ntoa($h->addr); ++ } ++ # look up ip in /etc/ethers ++ unless (open (ETHERS, '<', '/etc/ethers')) { ++ warn "$host is not a hardware address and I could not open /etc/ethers.\n"; ++ return undef; ++ } ++ while (<ETHERS>) { ++ if (($_ !~ m/^$/) && ($_ !~ m/^#/)) { # ignore comments ++ my ($mac, $ip); ++ ($mac, $ip) = split(' ', $_, 3); ++ if ($ip =~ m/^$ip_re$/) { ++ if ($ip eq $ip_addr) { ++ $hwaddr = $mac; ++ last; ++ } ++ next; ++ } else { ++ my $h2; ++ unless ($h2 = gethost($ip)) { ++ next; ++ } ++ if (inet_ntoa($h2->addr) eq $ip_addr) { ++ $hwaddr = $mac; ++ last; ++ } ++ } ++ } ++ } ++ close (ETHERS); ++ unless (defined($hwaddr)) { ++ warn "Could not find $host in /etc/ethers\n"; ++ return undef; ++ } + } + + # Generate magic sequence +@@ -68,7 +114,7 @@ + + # Allocate socket and send packet + +- $raddr = gethostbyname($ipaddr); ++ $raddr = gethostbyname($ipaddr)->addr; + $them = pack_sockaddr_in($port, $raddr); + $proto = getprotobyname('udp'); + diff --git a/net-misc/wakeonlan/wakeonlan-0.41-r3.ebuild b/net-misc/wakeonlan/wakeonlan-0.41-r3.ebuild new file mode 100644 index 000000000000..c61e6f722759 --- /dev/null +++ b/net-misc/wakeonlan/wakeonlan-0.41-r3.ebuild @@ -0,0 +1,25 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +GENTOO_DEPEND_ON_PERL=noslotop +inherit perl-module + +DESCRIPTION="Client for Wake-On-LAN" +HOMEPAGE="https://github.com/jpoliv/wakeonlan/" +SRC_URI="https://github.com/jpoliv/wakeonlan/archive/${P}.tar.gz" + +LICENSE="Artistic GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~ppc ~sparc ~x86 ~amd64-linux ~x86-linux" +IUSE="" + +DEPEND="virtual/perl-ExtUtils-MakeMaker" + +PATCHES="${FILESDIR}/${P}-ethers-lookup-r1.patch" + +src_install() { + perl-module_src_install + dodoc examples/lab001.wol + fperms u+w /usr/bin/wakeonlan /usr/share/man/man1/wakeonlan.1 +} |