From 7ecc692a5ee552fe9a8d28b21930d8a30f7ab9ae Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Wed, 4 Mar 2009 18:01:20 +0000 Subject: Fix for transportation of init variables into hooks and back again. git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2667 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initramfs/stage3-stuff/bin/init-wrapper | 23 +++++++++++++---------- initramfs/stage3-stuff/etc/functions | 1 + initramfs/stage3-stuff/init | 3 --- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/initramfs/stage3-stuff/bin/init-wrapper b/initramfs/stage3-stuff/bin/init-wrapper index a0b76bdc..ed2db50c 100755 --- a/initramfs/stage3-stuff/bin/init-wrapper +++ b/initramfs/stage3-stuff/bin/init-wrapper @@ -1,5 +1,5 @@ #!/bin/ash -# Copyright (c) 2006..2008 - OpenSLX GmbH +# Copyright (c) 2006..2009 - OpenSLX GmbH # # This program is free software distributed under the GPL version 2. # See http://openslx.org/COPYING @@ -12,29 +12,29 @@ # wrapperscript for plugin init files ############################################################################# -# get parameters +# Get parameters init_file="$1" DEBUGLEVEL="$2" [ -z $DEBUGLEVEL ] && DEBUGLEVEL=0 -# how do the localization here? There is not yet a country-Variable +# How do the localization here? There is not yet a country-Variable . /etc/messages . /etc/functions . /etc/distro-functions -# configuration settings for this slx system's environment +# Configuration settings for this slx system's environment . /etc/slxsystem.conf 2>/dev/null # initramfs-setup configuration (common initial settings for all clients using # a certain InitRamFS generated by slxconfig-demuxer) [ -f /etc/initramfs-setup ] && . /etc/initramfs-setup 2>/dev/null -# initial +# Initial [ -d /tmp/env ] || mkdir -p /tmp/env if [ ! -f /tmp/env/base.sed ]; then - # get environment and prepare as sed command + # Get environment and prepare as sed command pre_env_base=$(env | sed -e 's/^\([^=]*\).*/\1/' | tr '\n' ';') pre_env_base=$(echo $pre_env_base| sed -e 's/;/\.\*\/\/;s\/\^/g') pre_env_base="s/^$pre_env_base//;" @@ -43,15 +43,18 @@ else pre_env_base=$(cat /tmp/env/base.sed) fi -# load temporary environments +# Load temporary environments [ -f /tmp/env/wrapper.env ] && . /tmp/env/wrapper.env [ "${DEBUGLEVEL}" -eq 15 ] && set -x [ -f $init_file ] && . $init_file [ "${DEBUGLEVEL}" -eq 15 ] && set +x -# remove already known environment variables from postenv -env |sed -e $pre_env_base | sort -u | \ - sed "1s|.*|# generated by init-wrapper; last changed by $init_file/|" | \ +# Remove already known environment variables from postenv +#env |sed -e $pre_env_base | sort -u | \ +# Store the environment for re-initialization in runinithook function +env | grep -v -E "debug|DEBUGLEVEL" | sort -u | \ + sed "1s|.*|# generated by init-wrapper; last changed by $init_file|" | \ sed -e 's/^\([^=]*\)=\(.*\)/export \1="\2"/' \ > /tmp/env/wrapper.env + diff --git a/initramfs/stage3-stuff/etc/functions b/initramfs/stage3-stuff/etc/functions index 88f661a3..f28dba32 100644 --- a/initramfs/stage3-stuff/etc/functions +++ b/initramfs/stage3-stuff/etc/functions @@ -536,6 +536,7 @@ if [ -d /etc/init-hooks/$hook ]; then for hook_script in /etc/init-hooks/$hook/*.sh; do if [ -e $hook_script ]; then /bin/init-wrapper $hook_script $DEBUGLEVEL + . /tmp/env/wrapper.env fi done fi diff --git a/initramfs/stage3-stuff/init b/initramfs/stage3-stuff/init index 87961607..d7866ead 100755 --- a/initramfs/stage3-stuff/init +++ b/initramfs/stage3-stuff/init @@ -393,10 +393,7 @@ if strinstr "eth" "$nwif" ; then done fi # hook to setup bridging (several virtualization tools ...) -# xenbr_config runinithook '20-nw-bridge-config' -# fixme: hack for non-returning nwif variable -ip link show dev br0 >/dev/null 2&>1 && nwif=br0 # set up loopback networking [ $DEBUGLEVEL -eq 20 ] && echo "** starting ip config at $(sysup)" -- cgit v1.2.3-55-g7522