blob: 5f10f3339f843540cbaaac15aa2465c3df335f6e (
plain) (
tree)
|
|
#!/bin/ash
# Copyright (c) 2006..2008 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
#
# If you have any feedback please consult http://openslx.org/feedback and
# send your feedback to feedback@openslx.org
#
# General information about OpenSLX can be found at http://openslx.org
#
# wrapperscript for plugin init files
#############################################################################
# get parameters
init_file="$1"
DEBUGLEVEL="$2"
[ -z $DEBUGLEVEL ] && DEBUGLEVEL=0
# 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
. /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
[ -d /tmp/env ] || mkdir -p /tmp/env
# load temporary environments
for tmpenv in /tmp/env/*
do
[ -f "$tmpenv" ] && . $tmpenv
done
# get environment and prepare as sed command
pre_env=$(env | sed -e 's/^\([^=]*\).*/\1/' | tr '\n' ';')
pre_env=$(echo $pre_env| sed -e 's/;/\.\*\/\/;s\/\^/g')
pre_env="s/^$pre_env//;"
[ "${DEBUGLEVEL}" -gt 10 -a "${DEBUGLEVEL}" -le 20 ] && set -x
[ -f $init_file ] && . $init_file
[ "${DEBUGLEVEL}" -gt 10 -a "${DEBUGLEVEL}" -le 20 ] && set +x
outfile=$(basename $init_file)
outfile="${outfile}.env"
# remove already known environment variables from postenv
env |sed -e $pre_env | sort -u | \
sed -e '1s/.*/#generated by init-wrapper/' | \
sed -e 's/^\([^=]*\)=\(.*\)/\1="\2"/' \
> /tmp/env/$outfile
|