#!/bin/sh # # setting up the web setup menu. . /etc/init.d/rc.functions ps=$(ps); echo "$ps" | grep "{update_quick_st" | grep -q -v $$ && { echo "${0##*/} is already running">&2; exit 1; } setupdir="${1-/etc/setup}" websetupdir="${2-/var/www/tpl/quickstart}" tmpdir="${3-/tmp/setup.$$}" # xml-Daten als Verzeichnisstruktur abbilden rm -rf $tmpdir mkdir $tmpdir cd $tmpdir for file in $setupdir/*.xml; do grep . "$file" | while read line; do name=${file##*/} TEXTDOMAIN="${name%.*}-$name" if [ -z "${line#*}" ]; then name=`echo "$line" | sed 's/.* name="\($(tr '"'"'\)\?\([^'"'"'"]*\).*/\2/'` mkdir -p "$name" cd "$name" sed 's/ name="[^"]*"//' -i args.xml 2>/dev/null echo -n " name=\"$(tr "$name")\"" >> args.xml if [ -z "${line#*command=\"*\">}" ]; then command="${line#*command=\"}" command="${command%%\"*}" echo -n " command=\"$command\"" >> args.xml fi elif [ -z "${line#*}" ]; then cd .. elif [ -z "${line##*quickstart*}" -o -n "$select" -a -z "${line#*}" -o -n "$select" -a -z "${line#*}" ]; then eval "echo \"$(echo "$line" | sed 's/"/\\"/g')\"" >> menu.xml select=1 else select= fi done done touch end.xml # Verzeichnisstruktur in web datein schreiben rm -rf $websetupdir/* find $tmpdir/* -name menu.xml 2>/dev/null | while read file; do dir="${file%/menu.xml}" path="${dir#$tmpdir}" name="`sed 's/.*name="\([^\"]*\)".*\|.*/\1/' "$dir/args.xml"`" base_command="`sed 's/.*command="\([^\"]*\)".*\|.*/\1/' "$dir/args.xml"`" mkdir -p "$websetupdir$path" echo "

$name

" >> "$websetupdir/$path/20_headline.sh" # test -n "$command" && echo "" >> "$websetupdir/$path/30_setup.sh" cat "$file" | while read line; do name="`echo "$line" | sed 's/.* name="\([^\"]*\)" .*\|.*/\1/'`" config="`echo "$line" | sed 's/.* sysconfig="\([^\"]*\)" .*\|.*/\1/'`" value="`echo "$line" | sed 's/.* value="\([^\"]*\)" .*\|.*/\1/'`" help1="`echo "$line" | sed 's/.* help1="\([^\"]*\)" .*\|.*/\1/'`" setup="`echo "$line" | sed 's/.* setup="\([^\"]*\)" .*\|.*/\1/'`" multi="`echo "$line" | sed 's/.* multi="\([^\"]*\)" .*\|.*/\1/'`" edit="`echo "$line" | sed 's/.* edit="\([^\"]*\)" .*\|.*/\1/'`" command="`echo "$line" | sed 's/.* command="\([^\"]*\)" .*\|.*/\1/'`" command="$command${command:+;}$base_command" value="\${$config-$value}" test -n "$command" -a -n "$config" && echo "" if [ -z "${line##*type=\"bool\"*}" ]; then echo "
" elif [ -z "${line##*type=\"text\"*}" -o -z "${line##*type=\"numtext\"*}" -o -z "${line##*type=\"number\"*}" -o -z "${line##*type=\"ip\"*}" ]; then echo "
" elif [ -z "${line##*type=\"selection\"*}" ]; then if [ -n "$multi" -o -n "$edit" ]; then echo "
" fi if [ -n "$setup" ]; then echo "\1<\/option>/' ?>" echo "
" if [ -n "$multi" -o -n "$edit" ]; then echo "
" echo "" fi fi elif [ -z "${line##**}" ]; then echo $line | sed 's/\(.*\)<\/value>/