From 92ee1314c1c4f6a93bbca3c4ffaeddc51b5609af Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 7 Jul 2010 21:29:59 +0200 Subject: handle resolv.conf and ntp for pppoe network setup correctly --- package/ntpclient/Makefile | 3 ++- package/ppp/Makefile | 12 +++++------- package/ppp/files/etc/ppp/ip-down.d/01-resolver | 8 ++++++++ package/ppp/files/etc/ppp/ip-down.d/umts | 7 ------- package/ppp/files/etc/ppp/ip-up.d/01-resolver | 12 ++++++++++++ package/ppp/files/etc/ppp/ip-up.d/02-ntp | 10 ++++++++++ package/ppp/files/etc/ppp/ip-up.d/umts | 7 ------- 7 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 package/ppp/files/etc/ppp/ip-down.d/01-resolver delete mode 100755 package/ppp/files/etc/ppp/ip-down.d/umts create mode 100644 package/ppp/files/etc/ppp/ip-up.d/01-resolver create mode 100644 package/ppp/files/etc/ppp/ip-up.d/02-ntp delete mode 100755 package/ppp/files/etc/ppp/ip-up.d/umts diff --git a/package/ntpclient/Makefile b/package/ntpclient/Makefile index 8e0a6242d..51ab9839a 100644 --- a/package/ntpclient/Makefile +++ b/package/ntpclient/Makefile @@ -5,10 +5,11 @@ include ${TOPDIR}/rules.mk PKG_NAME:= ntpclient PKG_VERSION:= 2007_365 -PKG_RELEASE:= 1 +PKG_RELEASE:= 2 PKG_MD5SUM:= cb98711f11769cdd22fc592844cef414 PKG_DESCR:= NTP client for setting system time from NTP servers PKG_SECTION:= net +PKG_DEPENDS:= libpthread PKG_URL:= http://doolittle.icarus.com/ntpclient PKG_SITES:= http://doolittle.icarus.com/ntpclient/ diff --git a/package/ppp/Makefile b/package/ppp/Makefile index cef306cf7..9623bc58d 100644 --- a/package/ppp/Makefile +++ b/package/ppp/Makefile @@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk PKG_NAME:= ppp PKG_VERSION:= 2.4.5 -PKG_RELEASE:= 1 +PKG_RELEASE:= 3 PKG_MD5SUM:= 4621bc56167b6953ec4071043fe0ec57 PKG_DESCR:= Point-to-Point Protocol software PKG_SECTION:= net @@ -29,7 +29,6 @@ $(eval $(call PKG_template,PPP_MOD_PPPUMTS,ppp-mod-pppumts,${PKG_VERSION}-${PKG_ CONFIGURE_ENV+= UNAME_S="Linux" XAKE_FLAGS+= CC="${TARGET_CC}" \ COPTS="${TCFLAGS}" \ - HAVE_INET6="1" \ STAGING_DIR=${STAGING_DIR} \ DESTDIR="${WRKINST}/usr" \ TARGET_AR='${TARGET_CROSS}ar' @@ -45,18 +44,17 @@ SUB_INSTALLS-${ADK_PACKAGE_PPP_MOD_PPPSTATS}+= mod-pppstats-install SUB_INSTALLS-${ADK_PACKAGE_PPP_MOD_PPPUMTS}+= mod-pppumts-install post-install: ${SUB_INSTALLS-m} ${SUB_INSTALLS-y} - echo ------------------------------- - echo ${SUB_INSTALLS-m} - echo ${SUB_INSTALLS-y} ${INSTALL_DIR} ${IDIR_PPP}/etc/ppp - ln -sf /tmp/resolv.conf ${IDIR_PPP}/etc/ppp/resolv.conf install -m0600 ./files/etc/ppp/chap-secrets ${IDIR_PPP}/etc/ppp/ ${INSTALL_DATA} ./files/etc/ppp/options ${IDIR_PPP}/etc/ppp/ - ${INSTALL_FILTER} ${INSTALL_BIN} ./files/etc/ppp/ip-up ${IDIR_PPP}/etc/ppp/ ${INSTALL_DIR} ${IDIR_PPP}/etc/ppp/ip-up.d + ${INSTALL_BIN} ./files/etc/ppp/ip-up.d/0* \ + ${IDIR_PPP}/etc/ppp/ip-up.d ${INSTALL_BIN} ./files/etc/ppp/ip-down ${IDIR_PPP}/etc/ppp/ ${INSTALL_DIR} ${IDIR_PPP}/etc/ppp/ip-down.d + ${INSTALL_BIN} ./files/etc/ppp/ip-down.d/0* \ + ${IDIR_PPP}/etc/ppp/ip-down.d ${INSTALL_DIR} ${IDIR_PPP}/usr/sbin ${INSTALL_BIN} ${WRKINST}/usr/sbin/pppd ${IDIR_PPP}/usr/sbin/ ${INSTALL_DIR} ${IDIR_PPP}/usr/lib/pppd diff --git a/package/ppp/files/etc/ppp/ip-down.d/01-resolver b/package/ppp/files/etc/ppp/ip-down.d/01-resolver new file mode 100644 index 000000000..78eaea035 --- /dev/null +++ b/package/ppp/files/etc/ppp/ip-down.d/01-resolver @@ -0,0 +1,8 @@ +#!/bin/sh +if [ -n "$USEPEERDNS" -a -f /etc/ppp/resolv.conf ]; then + if [ -f /etc/ppp/resolv.prev ]; then + cp -f /etc/ppp/resolv.prev /etc/resolv.conf + else + rm -f /etc/resolv.conf + fi +fi diff --git a/package/ppp/files/etc/ppp/ip-down.d/umts b/package/ppp/files/etc/ppp/ip-down.d/umts deleted file mode 100755 index 6c812a782..000000000 --- a/package/ppp/files/etc/ppp/ip-down.d/umts +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -[ "$IF_USE_TEMPLATE" == "umts" ] || exit 0 - -# enable bit 3, disable bit 4 - i.e. UMTS-LED from blue to green -LED=$(cat /proc/sys/diag) -echo $(((LED | 16) ^ 16 | 8)) > /proc/sys/diag diff --git a/package/ppp/files/etc/ppp/ip-up.d/01-resolver b/package/ppp/files/etc/ppp/ip-up.d/01-resolver new file mode 100644 index 000000000..0a980bde6 --- /dev/null +++ b/package/ppp/files/etc/ppp/ip-up.d/01-resolver @@ -0,0 +1,12 @@ +#!/bin/sh +if [ -n "$USEPEERDNS" -a -f /etc/ppp/resolv.conf ]; then + rm -f /etc/ppp/resolv.prev + if [ -f /etc/resolv.conf ]; then + cp /etc/resolv.conf /etc/ppp/resolv.prev + grep domain /etc/ppp/resolv.prev > /etc/resolv.conf + grep search /etc/ppp/resolv.prev >> /etc/resolv.conf + cat /etc/ppp/resolv.conf >> /etc/resolv.conf + else + cp /etc/ppp/resolv.conf /etc + fi +fi diff --git a/package/ppp/files/etc/ppp/ip-up.d/02-ntp b/package/ppp/files/etc/ppp/ip-up.d/02-ntp new file mode 100644 index 000000000..ac25dd567 --- /dev/null +++ b/package/ppp/files/etc/ppp/ip-up.d/02-ntp @@ -0,0 +1,10 @@ +#!/bin/sh + +. /etc/rc.conf + +# get time via ntpclient if available +[ -x /usr/sbin/ntpclient ] && ntpclient -s -h pool.ntp.org +# get time via rdate if available +[ -x /usr/sbin/rdate ] && rdate -nv pool.ntp.org +# restart ntpd when enabled +test x"${ntpd:-NO}" = x"NO" || /etc/init.d/ntpd restart diff --git a/package/ppp/files/etc/ppp/ip-up.d/umts b/package/ppp/files/etc/ppp/ip-up.d/umts deleted file mode 100755 index 0c18970e0..000000000 --- a/package/ppp/files/etc/ppp/ip-up.d/umts +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -[ "$IF_USE_TEMPLATE" == "umts" ] || exit 0 - -# enable bit 4 i.e. UMTS-LED blue -LED=$(cat /proc/sys/diag) -echo $((LED | 16)) > /proc/sys/diag -- cgit v1.2.3