summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <uberlord@gentoo.org>2006-04-22 18:12:25 +0000
committerRoy Marples <uberlord@gentoo.org>2006-04-22 18:12:25 +0000
commitc8616e34a6e6542dee573b18072236e02f5093cb (patch)
treeb729328bd90bd2baf0cff2c13e68a2f7d6b96a55 /net-misc/udhcp
parentRemoved mask on >=media-video/kmplayer-0.9.2_rc1. Release candidate 1 removed... (diff)
downloadgentoo-2-c8616e34a6e6542dee573b18072236e02f5093cb.tar.gz
gentoo-2-c8616e34a6e6542dee573b18072236e02f5093cb.tar.bz2
gentoo-2-c8616e34a6e6542dee573b18072236e02f5093cb.zip
Adds the --env,-e option to pass environment variables to the setup script.
(Portage version: 2.1_pre7-r5)
Diffstat (limited to 'net-misc/udhcp')
-rw-r--r--net-misc/udhcp/ChangeLog10
-rw-r--r--net-misc/udhcp/Manifest15
-rw-r--r--net-misc/udhcp/files/digest-udhcp-0.9.9_pre20041216-r33
-rw-r--r--net-misc/udhcp/files/udhcp-0.9.9_pre20041216-env.patch127
-rw-r--r--net-misc/udhcp/files/udhcpc.sh10
-rw-r--r--net-misc/udhcp/udhcp-0.9.9_pre20041216-r3.ebuild57
6 files changed, 211 insertions, 11 deletions
diff --git a/net-misc/udhcp/ChangeLog b/net-misc/udhcp/ChangeLog
index 3a4359f9ac65..f2c7d9574899 100644
--- a/net-misc/udhcp/ChangeLog
+++ b/net-misc/udhcp/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for net-misc/udhcp
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/udhcp/ChangeLog,v 1.21 2006/04/07 22:31:26 uberlord Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/udhcp/ChangeLog,v 1.22 2006/04/22 18:12:25 uberlord Exp $
+
+*udhcp-0.9.9_pre20041216-r3 (22 Apr 2006)
+
+ 22 Apr 2006; Roy Marples <uberlord@gentoo.org>
+ +files/udhcp-0.9.9_pre20041216-env.patch, files/udhcpc.sh,
+ +udhcp-0.9.9_pre20041216-r3.ebuild:
+ Adds the --env,-e option to pass environment variables to the setup script.
+ This will be used by baselayout-1.12.0_pre18 and later.
*udhcp-0.9.9_pre20041216-r2 (07 Apr 2006)
diff --git a/net-misc/udhcp/Manifest b/net-misc/udhcp/Manifest
index 295d201b3488..034750791d40 100644
--- a/net-misc/udhcp/Manifest
+++ b/net-misc/udhcp/Manifest
@@ -10,15 +10,21 @@ SHA256 574364d7da5c57aab18a25fac14ec639c885a7789ce34ce0160ad290c594cd2a files/di
MD5 3abdec37a6b19a6b855f1a7b4f291234 files/digest-udhcp-0.9.9_pre20041216-r2 271
RMD160 a3cc96f239981b7db322e546083f1a17563e4d51 files/digest-udhcp-0.9.9_pre20041216-r2 271
SHA256 8e1df539da56f114fe2b51e764815ff78da8a95d378222fce1568467d63f19e0 files/digest-udhcp-0.9.9_pre20041216-r2 271
+MD5 3abdec37a6b19a6b855f1a7b4f291234 files/digest-udhcp-0.9.9_pre20041216-r3 271
+RMD160 a3cc96f239981b7db322e546083f1a17563e4d51 files/digest-udhcp-0.9.9_pre20041216-r3 271
+SHA256 8e1df539da56f114fe2b51e764815ff78da8a95d378222fce1568467d63f19e0 files/digest-udhcp-0.9.9_pre20041216-r3 271
+MD5 64bb08e23054a3867d2cc4b2014e97e0 files/udhcp-0.9.9_pre20041216-env.patch 3599
+RMD160 4f111f1769232f3bddf5881f8b4a339e74e8309d files/udhcp-0.9.9_pre20041216-env.patch 3599
+SHA256 5ee4c293e667f4bfa5f8a5a50ce1b1cc3b2dda5de000094fd698e7736ee28c17 files/udhcp-0.9.9_pre20041216-env.patch 3599
MD5 841852ac59a61a1940dd9d509821f231 files/udhcp-gcc-3.4.patch 261
RMD160 d0c31131bc4c14ef20f0a52c46e15a6034bb3fc9 files/udhcp-gcc-3.4.patch 261
SHA256 f4ffec4f9bf809b82c4f8a48a3a0b098084c50f904d6c8b1513cb32087459802 files/udhcp-gcc-3.4.patch 261
MD5 f74f1f81c1fd4933d63b860dc070eec6 files/udhcp.rc 719
RMD160 15d474dd873685bf1c301e772548a27f6fc26d5e files/udhcp.rc 719
SHA256 ec031a7de6ed600d5172fc6e131dfd16160e471da9aac8558ad88f1b1c5bc6e1 files/udhcp.rc 719
-MD5 3cf16eddedc6f60a6eb8caa40befea6e files/udhcpc.sh 2648
-RMD160 bcba0f2e1aad68c72bb02fc4080e93211054760b files/udhcpc.sh 2648
-SHA256 9f5ec470d56f0e611524157ef98b8df536c00d1cfdaef4d4bd50ec609657d790 files/udhcpc.sh 2648
+MD5 fc8a44ba5943f0bbf8e64ac000842533 files/udhcpc.sh 2363
+RMD160 41e77f82461ff90fae8e7d4c24229b208230cffc files/udhcpc.sh 2363
+SHA256 32ad4650780134ccb07d6f022e952a8b0cc9f88ccbb78631b738d54b2894e93b files/udhcpc.sh 2363
MD5 8ef75eba39772bdd1a8facc7815dbebb metadata.xml 161
RMD160 77385273ea1d12ed4093a4167307486b74d1cf82 metadata.xml 161
SHA256 a11fdd02015a232398fdf22a20d26a95fc34d44c54513e6b26b6128d0b76122e metadata.xml 161
@@ -31,3 +37,6 @@ SHA256 0fd541d581cf51d24abdb3aae786349e7fff948c35a91285a20869f23cbee72d udhcp-0.
MD5 a8d709e105e9500631ecadd004ddd4b1 udhcp-0.9.9_pre20041216-r2.ebuild 1250
RMD160 6aa363ff1975924e780686c9475637dc1de27eee udhcp-0.9.9_pre20041216-r2.ebuild 1250
SHA256 e56b7f3f37e3361731e405fd3b983e5da04238ee84f23fa8d93da1a10a7dc31f udhcp-0.9.9_pre20041216-r2.ebuild 1250
+MD5 693592f1b6f6169cf61f1ebb6406c720 udhcp-0.9.9_pre20041216-r3.ebuild 1513
+RMD160 558f788c68769cb5d2c4656093a104ddc6490c93 udhcp-0.9.9_pre20041216-r3.ebuild 1513
+SHA256 12871221991ea59436bea86dcacaac26328dd60ff6fb68f3e596c8123bd4b095 udhcp-0.9.9_pre20041216-r3.ebuild 1513
diff --git a/net-misc/udhcp/files/digest-udhcp-0.9.9_pre20041216-r3 b/net-misc/udhcp/files/digest-udhcp-0.9.9_pre20041216-r3
new file mode 100644
index 000000000000..d5e8d6d049f6
--- /dev/null
+++ b/net-misc/udhcp/files/digest-udhcp-0.9.9_pre20041216-r3
@@ -0,0 +1,3 @@
+MD5 759bb5f1f05e4725a48e5019fa5f61f2 udhcp-0.9.9_pre20041216.tar.bz2 42353
+RMD160 ed223b166f9ab9c0e0b210b690319e3ca8417af5 udhcp-0.9.9_pre20041216.tar.bz2 42353
+SHA256 e4bcf9490f5e5c14a97d6ca46f054225e15a765edf9cdb181888032a0082dad6 udhcp-0.9.9_pre20041216.tar.bz2 42353
diff --git a/net-misc/udhcp/files/udhcp-0.9.9_pre20041216-env.patch b/net-misc/udhcp/files/udhcp-0.9.9_pre20041216-env.patch
new file mode 100644
index 000000000000..f3068b698ec7
--- /dev/null
+++ b/net-misc/udhcp/files/udhcp-0.9.9_pre20041216-env.patch
@@ -0,0 +1,127 @@
+--- udhcp/dhcpc.c
++++ udhcp/dhcpc.c
+@@ -68,6 +68,8 @@
+ clientid: NULL,
+ hostname: NULL,
+ fqdn: NULL,
++ envList: NULL,
++ envListLength: 0,
+ ifindex: 0,
+ arp: "\0\0\0\0\0\0", /* appease gcc-3.0 */
+ };
+@@ -78,6 +80,7 @@
+ printf(
+ "Usage: udhcpc [OPTIONS]\n\n"
+ " -c, --clientid=CLIENTID Client identifier\n"
++" -e, --env=\"FOO=BAR\" Environment variable passed to script\n"
+ " -H, --hostname=HOSTNAME Client hostname\n"
+ " -h Alias for -H\n"
+ " -F, --fqdn=FQDN Client fully qualified domain name\n"
+@@ -193,9 +196,11 @@
+ long now;
+ int max_fd;
+ int sig;
++ struct stringList *env_tmp;
+
+ static const struct option arg_options[] = {
+ {"clientid", required_argument, 0, 'c'},
++ {"env", required_argument, 0, 'e'},
+ {"foreground", no_argument, 0, 'f'},
+ {"background", no_argument, 0, 'b'},
+ {"hostname", required_argument, 0, 'H'},
+@@ -214,7 +219,7 @@
+ /* get options */
+ while (1) {
+ int option_index = 0;
+- c = getopt_long(argc, argv, "c:fbH:h:F:i:np:qr:s:v", arg_options, &option_index);
++ c = getopt_long(argc, argv, "c:e:fbH:h:F:i:np:qr:s:v", arg_options, &option_index);
+ if (c == -1) break;
+
+ switch (c) {
+@@ -227,6 +232,17 @@
+ client_config.clientid[OPT_DATA] = '\0';
+ strncpy(client_config.clientid + OPT_DATA, optarg, len);
+ break;
++ case 'e':
++ env_tmp = xmalloc(strlen(optarg) + sizeof *env_tmp);
++ if (!env_tmp) {
++ DEBUG(LOG_ERR, "No memory for %s", optargs);
++ exit(1);
++ }
++ strncpy(env_tmp->string, optarg, strlen(optarg));
++ env_tmp->next=client_config.envList;
++ client_config.envList=env_tmp;
++ client_config.envListLength++;
++ break;
+ case 'f':
+ client_config.foreground = 1;
+ break;
+--- udhcp/dhcpc.h
++++ udhcp/dhcpc.h
+@@ -17,6 +17,12 @@
+ #define RELEASED 7
+
+
++struct stringList {
++ struct stringList *next;
++ char string[1];
++};
++
++
+ struct client_config_t {
+ char foreground; /* Do not fork */
+ char quit_after_lease; /* Quit after obtaining lease */
+@@ -28,6 +34,8 @@
+ uint8_t *clientid; /* Optional client id to use */
+ uint8_t *hostname; /* Optional hostname to use */
+ uint8_t *fqdn; /* Optional fully qualified domain name to use */
++ struct stringList *envList; /* Environment variables to pass to the script */
++ int envListLength; /* Length of the environment variable list */
+ int ifindex; /* Index number of the interface to use */
+ uint8_t arp[6]; /* Our arp address */
+ };
+--- udhcp/script.c
++++ udhcp/script.c
+@@ -141,6 +141,7 @@
+ uint8_t *temp;
+ struct in_addr subnet;
+ char over = 0;
++ struct stringList *sp;
+
+ if (packet == NULL)
+ num_options = 0;
+@@ -158,7 +159,7 @@
+ if (!(over & SNAME_FIELD) && packet->sname[0]) num_options++;
+ }
+
+- envp = xcalloc(sizeof(char *), num_options + 5);
++ envp = xcalloc(sizeof(char *), num_options + client_config.envListLength + 5);
+ j = 0;
+ asprintf(&envp[j++], "interface=%s", client_config.interface);
+ asprintf(&envp[j++], "%s=%s", "PATH",
+@@ -198,6 +199,10 @@
+ packet->sname[sizeof(packet->sname) - 1] = '\0';
+ asprintf(&envp[j++], "sname=%s", packet->sname);
+ }
++ if (client_config.envList) {
++ for (sp=client_config.envList; sp; sp=sp->next)
++ asprintf(&envp[j++], "%s", sp->string);
++ }
+ return envp;
+ }
+
+--- udhcp/udhcpc.8
++++ udhcp/udhcpc.8
+@@ -13,6 +13,12 @@
+ Send the client identifier
+ .IR CLIENTID .
+ .TP
++.BI \-e\ ENV=VALUE ,\ \-\-env= VARIABLE=VALUE
++Send the script the given enviroment variable
++.IR VARIABLE
++set to the value
++.IR VALUE .
++.TP
+ .BR -f ,\ \-\-foreground
+ Do not fork after obtaining a lease.
+ .TP
diff --git a/net-misc/udhcp/files/udhcpc.sh b/net-misc/udhcp/files/udhcpc.sh
index 1a408eec3635..4f4a4702b2f4 100644
--- a/net-misc/udhcp/files/udhcpc.sh
+++ b/net-misc/udhcp/files/udhcpc.sh
@@ -1,7 +1,8 @@
#!/bin/sh
# udhcp setup script
-# Ideally this should be in /etc/udhcp, but Spanky insists it belongs in
-# rcscripts as it's only baselayout that forces it. Ce la vie.
+
+# Ideally this should be the defalt udhcpc script, but I doubt upstream
+# will accept it.
PATH=/bin:/usr/bin:/sbin:/usr/sbin
@@ -58,7 +59,6 @@ update_interface()
update_routes()
{
- [[ -n "${PEER_ROUTERS}" ]] && [[ "${PEER_ROUTERS}" != "yes" ]] && return
while route del default dev "${interface}" 2>/dev/null ; do
:
done
@@ -77,10 +77,6 @@ deconfig()
[[ -x /sbin/resolvconf ]] && resolvconf -d "${interface}"
}
-# As udhcp will not pass as any custom env vars, we load this file instead.
-[[ -e /var/run/udhcpc-"${interface}".conf ]] \
- && . /var/run/udhcpc-"${interface}".conf
-
case "$1" in
bound|renew)
update_hostname
diff --git a/net-misc/udhcp/udhcp-0.9.9_pre20041216-r3.ebuild b/net-misc/udhcp/udhcp-0.9.9_pre20041216-r3.ebuild
new file mode 100644
index 000000000000..50b7dbc9325a
--- /dev/null
+++ b/net-misc/udhcp/udhcp-0.9.9_pre20041216-r3.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/udhcp/udhcp-0.9.9_pre20041216-r3.ebuild,v 1.1 2006/04/22 18:12:25 uberlord Exp $
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="udhcp Server/Client Package"
+HOMEPAGE="http://udhcp.busybox.net/"
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~sparc ~x86"
+IUSE=""
+
+DEPEND="virtual/libc"
+PROVIDE="virtual/dhcpc"
+
+S="${WORKDIR}/${PN}"
+
+pkg_setup() {
+ enewgroup dhcp
+ enewuser dhcp -1 -1 /var/lib/dhcp dhcp
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ # This patch adds the --env,-e option to udhcpc so we can pass the dhcp
+ # client some environment variables to pass to the script. We do this so
+ # the script knows mertric and whether to setup DNS, NTP and routers.
+ epatch "${FILESDIR}/${P}"-env.patch
+}
+
+src_compile() {
+ emake \
+ CROSS_COMPILE=${CHOST}- \
+ STRIP=true \
+ UDHCP_SYSLOG=1 \
+ || die
+}
+
+src_install() {
+ make STRIP=true install DESTDIR="${D}" USRSBINDIR="${D}/sbin" || die
+ newinitd "${FILESDIR}"/udhcp.rc udhcp
+ insinto /etc
+ doins samples/udhcpd.conf
+ dodoc AUTHORS ChangeLog README* TODO
+ newdoc samples/README README.scripts
+
+ # udhcpc setup script - the supplied ones don't work
+ # This does it supports resolvconf, metrics and whether to setup
+ # dns, ntp and routers. Requires the --env patch above.
+ exeinto /lib/rcscripts/sh
+ newexe "${FILESDIR}"/udhcpc.sh udhcpc.sh
+}