diff options
author | Koen Kooi <koen@openembedded.org> | 2006-05-03 13:49:50 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2006-05-03 13:49:50 +0000 |
commit | ab60b907a46f9d0e55551ae52ad408bb5b278bbf (patch) | |
tree | d5b13d155856acb55fcd8a65a15fd090602acf61 | |
parent | b7e3e75b864c5b8c5ce472203efc8ef5fea26cca (diff) | |
parent | 1d95c117acc204d97154c7f8a70ec2400d4cbdbb (diff) |
merge of 36c85029caf52a5bdf60cd12bee0ef045cf0937b
and 78a66f0dabbef07f6cf0dae7150a8f3cd22f6ebf
-rwxr-xr-x | packages/initscripts/initscripts-1.0/populate-volatile.sh | 63 | ||||
-rw-r--r-- | packages/initscripts/initscripts_1.0.bb | 2 | ||||
-rw-r--r-- | packages/sysvinit/sysvinit/rcS-default | 2 | ||||
-rw-r--r-- | packages/sysvinit/sysvinit_2.86.bb | 2 | ||||
-rw-r--r-- | packages/udev/files/network.sh | 29 | ||||
-rw-r--r-- | packages/udev/files/udev_network_queue.sh | 35 | ||||
-rw-r--r-- | packages/udev/udev_084.bb | 18 |
7 files changed, 129 insertions, 22 deletions
diff --git a/packages/initscripts/initscripts-1.0/populate-volatile.sh b/packages/initscripts/initscripts-1.0/populate-volatile.sh index bf498084e4..f22bf2fdfe 100755 --- a/packages/initscripts/initscripts-1.0/populate-volatile.sh +++ b/packages/initscripts/initscripts-1.0/populate-volatile.sh @@ -8,6 +8,35 @@ COREDEF="00_core" [ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems." +create_file() { + EXEC=" + touch \"$1\" + chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1 + chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 " + + test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache + + eval $EXEC & +} + +mk_dir() { + EXEC=" + mkdir -p \"$1\" + chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1 + chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 " + + test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache + + eval $EXEC & +} + +link_file() { + EXEC="test -e \"$2\" -o -L $2 || ln -s \"$1\" \"$2\" >/dev/tty0 2>&1" + + test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache + + eval $EXEC & +} check_requirements() { @@ -72,22 +101,21 @@ apply_cfgfile() { cat ${CFGFILE} | grep -v "^#" | \ while read LINE; do - TTYPE=`echo ${LINE} | cut -d " " -f 1` - TUSER=`echo ${LINE} | cut -d " " -f 2` - TGROUP=`echo ${LINE} | cut -d " " -f 3` - TMODE=`echo ${LINE} | cut -d " " -f 4` - TNAME=`echo ${LINE} | cut -d " " -f 5` + + # This is a hell of a lot faster than using cut or awk 5 times + eval `echo "$LINE" | sed -n "s/\(.*\)\ \(.*\) \(.*\)\ \(.*\)\ \(.*\)\ \(.*\)/TTYPE=\1 ; TUSER=\2; TGROUP=\3; TMODE=\4; TNAME=\5 TLTARGET=\6/p"` [ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-." + [ "${TTYPE}" = "l" ] && { [ -e "${TNAME}" ] && { echo "Cannot create link over existing -${TNAME}-." >&2 } || { - TSOURCE=`echo ${LINE} | cut -d " " -f 6` + TSOURCE="$TLTARGET" [ -L "${TNAME}" ] || { [ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-." - ln -s "${TSOURCE}" "${TNAME}" + link_file "${TSOURCE}" "${TNAME}" & } } continue @@ -112,10 +140,10 @@ apply_cfgfile() { case "${TTYPE}" in "f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-." - touch "${TNAME}" + create_file "${TNAME}" & ;; "d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-." - mkdir -p "${TNAME}" + mk_dir "${TNAME}" & # Add check to see if there's an entry in fstab to mount. ;; *) [ "${VERBOSE}" != "no" ] && echo "Invalid type -${TTYPE}-." @@ -123,9 +151,6 @@ apply_cfgfile() { ;; esac - chown ${TUSER} ${TNAME} || echo "Failed to set owner -${TUSER}- for -${TNAME}-." >&2 - chgrp ${TGROUP} ${TNAME} || echo "Failed to set group -${TGROUP}- for -${TNAME}-." >&2 - chmod ${TMODE} ${TNAME} || echo "Failed to set mode -${TMODE}- for -${TNAME}-." >&2 done @@ -133,8 +158,12 @@ apply_cfgfile() { } - -for file in `ls -1 "${CFGDIR}" | sort`; do - apply_cfgfile "${CFGDIR}/${file}" - done - +if test -e /etc/volatile.cache -a "$VOLATILE_ENABLE_CACHE" = "yes" +then + sh /etc/volatile.cache +else + rm -f /etc/volatile.cache + for file in `ls -1 "${CFGDIR}" | sort`; do + apply_cfgfile "${CFGDIR}/${file}" + done +fi diff --git a/packages/initscripts/initscripts_1.0.bb b/packages/initscripts/initscripts_1.0.bb index 29886d0ac0..b3c0bfb9ab 100644 --- a/packages/initscripts/initscripts_1.0.bb +++ b/packages/initscripts/initscripts_1.0.bb @@ -6,7 +6,7 @@ DEPENDS = "makedevs" DEPENDS_openzaurus = "makedevs virtual/kernel" RDEPENDS = "makedevs" LICENSE = "GPL" -PR = "r71" +PR = "r72" SRC_URI = "file://halt \ file://ramdisk \ diff --git a/packages/sysvinit/sysvinit/rcS-default b/packages/sysvinit/sysvinit/rcS-default index 46e48b9796..82bf55970c 100644 --- a/packages/sysvinit/sysvinit/rcS-default +++ b/packages/sysvinit/sysvinit/rcS-default @@ -19,3 +19,5 @@ EDITMOTD=no FSCKFIX=yes # Set TICKADJ to the correct tick value for this specific machine #TICKADJ=10000 +# Enable caching in populate-volatile.sh +VOLATILE_ENABLE_CACHE=yes diff --git a/packages/sysvinit/sysvinit_2.86.bb b/packages/sysvinit/sysvinit_2.86.bb index 98cc47bc2a..e2124c7fe9 100644 --- a/packages/sysvinit/sysvinit_2.86.bb +++ b/packages/sysvinit/sysvinit_2.86.bb @@ -3,7 +3,7 @@ SECTION = "base" LICENSE = "GPL" MAINTAINER = "Chris Larson <kergoth@handhelds.org>" HOMEPAGE = "http://freshmeat.net/projects/sysvinit/" -PR = "r23" +PR = "r24" # USE_VT and SERIAL_CONSOLE are generally defined by the MACHINE .conf. # Set PACKAGE_ARCH appropriately. diff --git a/packages/udev/files/network.sh b/packages/udev/files/network.sh index 5e2bd5799a..5016328df4 100644 --- a/packages/udev/files/network.sh +++ b/packages/udev/files/network.sh @@ -6,6 +6,35 @@ test -x /sbin/cardctl && exit 0 # We get two "add" events for hostap cards due to wifi0 echo "$INTERFACE" | grep -q wifi && exit 0 + +# Check if /etc/init.d/network has been run yet to see if we are +# called by starting /etc/rcS.d/S03udev and not by hotplugging a device +# +# At this stage, network interfaces should not be brought up +# automatically because: +# a) /etc/init.d/network has not been run yet (security issue) +# b) /var has not been populated yet so /etc/resolv,conf points to +# oblivion, making the network unusable +# + +spoofp="`grep ^spoofprotect /etc/network/options`" +if test -z "$spoofp" +then + # This is the default from /etc/init.d/network + spoofp_val=yes +else + spoofp_val=${spoofp#spoofprotect=} +fi + +test "$spoofp_val" = yes && spoofp_val=1 || spoofp_val=0 + +# I think it is safe to assume that "lo" will always be there ;) +if test "`cat /proc/sys/net/ipv4/conf/lo/rp_filter`" != "$spoofp_val" -a -n "$spoofp_val" +then + echo "$INTERFACE" >> /dev/udev_network_queue + exit 0 +fi + # # Code taken from pcmcia-cs:/etc/pcmcia/network # diff --git a/packages/udev/files/udev_network_queue.sh b/packages/udev/files/udev_network_queue.sh new file mode 100644 index 0000000000..05e08e9d1b --- /dev/null +++ b/packages/udev/files/udev_network_queue.sh @@ -0,0 +1,35 @@ +#! /bin/sh +# +# Copyright Matthias Hentges <devel@hentges.net> (c) 2006 +# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the license) +# +# Filename: udev_network_queue.sh +# Date: 03-May-06 + +do_start() { + if test -e /dev/udev_network_queue + then + echo "Activating queued NICs..." + for NIC in `cat /dev/udev_network_queue` + do + export INTERFACE="$NIC" ; export ACTION=add + /etc/udev/scripts/network.sh + done + echo "" + else + echo "No NICs queued" + fi +} + +do_stop() { + /bin/true +} + +case "$1" in +start) do_start;; +stop) do_stop;; +restart) do_stop + do_start;; +*) echo "Usage: `basename $0` [ start | stop | restart ]" + exit 0;; +esac diff --git a/packages/udev/udev_084.bb b/packages/udev/udev_084.bb index d42366b992..0bb96c7f36 100644 --- a/packages/udev/udev_084.bb +++ b/packages/udev/udev_084.bb @@ -8,13 +8,14 @@ SRC_URI = "http://kernel.org/pub/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \ file://flags.patch;patch=1 \ file://udevsynthesize.patch;patch=1 \ file://udevsynthesize.sh \ - file://mount.blacklist" + file://mount.blacklist \ + file://udev_network_queue.sh" include udev.inc INITSCRIPT_PARAMS = "start 03 S ." -PR = "r11" +PR = "r12" FILES_${PN} += "${base_libdir}" UDEV_EXTRAS = "extras/firmware/ extras/scsi_id/ extras/volume_id/ extras/run_directory/" @@ -26,7 +27,8 @@ do_install () { oe_runmake 'DESTDIR=${D}' INSTALL=install install install -d ${D}${sysconfdir}/init.d install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev - + install -m 0755 ${WORKDIR}/udev_network_queue.sh ${D}${sysconfdir}/init.d/ + install -d ${D}${sysconfdir}/udev/rules.d/ install -m 0644 ${WORKDIR}/mount.blacklist ${D}${sysconfdir}/udev/ @@ -46,3 +48,13 @@ do_install () { install -m 0755 ${S}/udevsynthesize ${D}${base_libdir}/udev/udevsynthesize install -m 0755 ${WORKDIR}/udevsynthesize.sh ${D}${sbindir}/udevsynthesize } + + +pkg_postinst_append() { + update-rc.d -s udev_network_queue.sh start 41 S . start 55 0 6 . +} + + +pkg_postrm_append() { + update-rc.d -f udev_network_queue.sh remove +} |