From patchwork Thu Apr 30 01:41:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Weber X-Patchwork-Id: 466341 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 06213140310 for ; Thu, 30 Apr 2015 11:42:15 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=GRugfqgb; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 14598916DC; Thu, 30 Apr 2015 01:42:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Lobl2cKcrwqC; Thu, 30 Apr 2015 01:42:12 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 8BF53916CC; Thu, 30 Apr 2015 01:42:12 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 518D11C2284 for ; Thu, 30 Apr 2015 01:42:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 4D6452FAAF for ; Thu, 30 Apr 2015 01:42:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zOziXUuAnwin for ; Thu, 30 Apr 2015 01:42:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ie0-f179.google.com (mail-ie0-f179.google.com [209.85.223.179]) by silver.osuosl.org (Postfix) with ESMTPS id 075872FA93 for ; Thu, 30 Apr 2015 01:42:08 +0000 (UTC) Received: by iecrt8 with SMTP id rt8so56685070iec.0 for ; Wed, 29 Apr 2015 18:42:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=HLJB9TCFOUBXBW9stelfsJnWFI7yC+D6PTgia7dL94M=; b=GRugfqgb2c+KdFMN0aR6PtvOaSQP81O8IebVvSiuLLxn6KIw1OlmLV/rrqCyuprm0d fHqdEgybKwF4aHQTQGFNeL7LoIuy16U4DAUNz1Ou1AO7jj6vrsD4/nxMPaM/He6j7Ob+ WvQxEL3mMYHK1MnvVI4G2Owz/5z6z/aGDwbQOeRvk2fIKcSGK63omiIij6xe+pHlbwIw u0nTxnw+ussP0SL4h4Qk7auHFrvViVenasjADHeZp/fNSUcu3AAb4rglVKYbs8Ml+Qsf kk3zdxjck3uebItvVqzS+qCv52iCXKxGwGl5Z5aMerNMRtCXXbRn4bn7jmWY8yxHMnKK ZTOg== X-Received: by 10.42.48.203 with SMTP id t11mr6650282icf.35.1430358127257; Wed, 29 Apr 2015 18:42:07 -0700 (PDT) Received: from localhost.localdomain (173-28-136-113.client.mchsi.com. [173.28.136.113]) by mx.google.com with ESMTPSA id j20sm94290igt.5.2015.04.29.18.42.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Apr 2015 18:42:06 -0700 (PDT) From: Matt Weber To: buildroot@buildroot.org Date: Wed, 29 Apr 2015 20:41:58 -0500 Message-Id: <1430358118-5304-1-git-send-email-matt@thewebers.ws> X-Mailer: git-send-email 1.9.1 Subject: [Buildroot] [PATCH 1/1] busybox: udhcpc create leases file X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Matt Weber --- package/busybox/udhcpc.script | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) -- 1.9.1 diff --git a/package/busybox/udhcpc.script b/package/busybox/udhcpc.script index 50c52e6..d5d81bf 100755 --- a/package/busybox/udhcpc.script +++ b/package/busybox/udhcpc.script @@ -61,6 +61,29 @@ case "$1" in echo adding dns $i echo "nameserver $i # $interface" >> $RESOLV_CONF done + + # Based on http://sourceforge.net/p/kboot/mailman/message/1168535/ + { + echo "lease {" + echo " interface \"$interface\";" + echo " fixed-address $ip;" + [ -n "$boot_file" ] && echo " filename \"$boot_file\";" + [ -n "$subnet" ] && echo " option subnet-mask $subnet;" + [ -n "$router" ] && echo " option routers $router;" + echo " option dhcp-lease-time $lease;" + echo " option dhcp-message-type $dhcptype;" + [ -n "$dns" ] && echo " option domain-name-servers $dns;" + echo " option dhcp-server-identifier ${siaddr:-$serverid};" + [ -n "$domain" ] && echo " option domain-name \"$domain\";" + d=$(expr "$(date "+%Y.%m.%d-%H:%M:%S")" : "\(.*\):") + t=$(date -d "$d:$(expr $lease / 2)" "+%w %Y/%m/%d %H:%M:%S" 2>/dev/null) + [ -n "$t" ] && echo " renew $t;" + t=$(date -d "$d:$(expr 7 '*' $lease / 8)" "+%w %Y/%m/%d %H:%M:%S" 2>/dev/null) + [ -n "$t" ] && echo " rebind $t;" + t=$(date -d "$d:$lease" "+%w %Y/%m/%d %H:%M:%S" 2>/dev/null) + [ -n "$t" ] && echo " expire $t;" + echo "}" + } >> /var/lib/misc/udhcpc-$interface.leases ;; esac