|
|
|
@ -35,7 +35,7 @@ var_insert() { |
|
|
|
eval "$1=\"$3\$$1\"" |
|
|
|
} |
|
|
|
|
|
|
|
# Functions for working with config/$config.$swpid/packages |
|
|
|
# Functions for working with $swpdir/packages |
|
|
|
# |
|
|
|
# pkgenable package-list |
|
|
|
# pkgdisable package-list |
|
|
|
@ -49,8 +49,8 @@ then |
|
|
|
pkgin() { :; } |
|
|
|
pkgout() { :; } |
|
|
|
__pkgfilter() { |
|
|
|
"$@" < config/$config.$swpid/packages > config/$config.$swpid/packages.new |
|
|
|
mv config/$config.$swpid/packages.new config/$config.$swpid/packages |
|
|
|
"$@" < $swpdir/packages > $swpdir/packages.new |
|
|
|
mv $swpdir/packages.new $swpdir/packages |
|
|
|
} |
|
|
|
pkgfilter() { |
|
|
|
bprof pkgfilter start |
|
|
|
@ -95,8 +95,8 @@ then |
|
|
|
bprof pkgcheck start |
|
|
|
local pattern="$1" stat="$2" |
|
|
|
|
|
|
|
sed -n -e "/^$stat.*[ =]$pattern / q0 ; $ q1 ;" \ |
|
|
|
< config/$config.$swpid/packages |
|
|
|
sed -n -e "/^$stat.*[ =]${pattern} / q0 ; $ q1 ;" \ |
|
|
|
< $swpdir/packages |
|
|
|
local ret=$? |
|
|
|
bprof pkgcheck stop |
|
|
|
return $ret |
|
|
|
@ -140,19 +140,19 @@ then |
|
|
|
script="$script sub(\" $2 \", \" \");" |
|
|
|
;; |
|
|
|
esac |
|
|
|
shift; shift; |
|
|
|
shift 2 |
|
|
|
done |
|
|
|
script="$script} {print;}" |
|
|
|
pkgfilter "awk" "--" "$script" |
|
|
|
} |
|
|
|
else |
|
|
|
pkgin() { cfghlp pkg_in config/$config.$swpid/packages; } |
|
|
|
pkgout() { cfghlp pkg_out config/$config.$swpid/packages ; } |
|
|
|
pkgin() { cfghlp pkg_in $swpdir/packages; } |
|
|
|
pkgout() { cfghlp pkg_out $swpdir/packages ; } |
|
|
|
pkgfilter() { |
|
|
|
bprof pkgfilter start |
|
|
|
cfghlp pkg_out config/$config.$swpid/packages.tmp |
|
|
|
"$@" < config/$config.$swpid/packages.tmp > config/$config.$swpid/packages |
|
|
|
cfghlp pkg_in config/$config.$swpid/packages |
|
|
|
cfghlp pkg_out $swpdir/packages.tmp |
|
|
|
"$@" < $swpdir/packages.tmp > $swpdir/packages |
|
|
|
cfghlp pkg_in $swpdir/packages |
|
|
|
bprof pkgfilter stop |
|
|
|
} |
|
|
|
pkgenable() { |
|
|
|
@ -184,83 +184,64 @@ else |
|
|
|
fi |
|
|
|
|
|
|
|
comment() { |
|
|
|
local text="$1" help="$2" |
|
|
|
bprof comment start |
|
|
|
if [ $ROCKCFG_EXPERT -eq 1 -o $expert -eq 0 ] |
|
|
|
if [ "$ROCKCFG_EXPERT" -eq 1 -o $expert -eq 0 ] |
|
|
|
then |
|
|
|
commentnr=$(( $commentnr + 1 )) |
|
|
|
echo "COMMENT_$commentnr '$spacer$1'" >> config.dialog.$menu_this.$swpid |
|
|
|
|
|
|
|
# Hi, esden here, very ill stuff here I save the help |
|
|
|
# strings here to a temporary file named config.help.$swpid |
|
|
|
# this sed tr sandwitch formats the string so that |
|
|
|
# \n are masked and the Help strings are not killed some way |
|
|
|
if [ "$2" != "" ] ; then |
|
|
|
set_help "COMMENT_$commentnr" "$2" |
|
|
|
fi |
|
|
|
echo "COMMENT_$commentnr '$spacer$text'" >> $swpdir/config.dialog.$menu_this |
|
|
|
|
|
|
|
set_help "COMMENT_$commentnr" "$help" |
|
|
|
fi |
|
|
|
bprof comment stop |
|
|
|
} |
|
|
|
|
|
|
|
comment_id() { |
|
|
|
local text="$1" id="$2" help="$3" |
|
|
|
|
|
|
|
bprof comment_id start |
|
|
|
if [ $ROCKCFG_EXPERT -eq 1 -o $expert -eq 0 ] |
|
|
|
if [ "$ROCKCFG_EXPERT" -eq 1 -o "$expert" -eq 0 ] |
|
|
|
then |
|
|
|
echo "$2 '$spacer$1'" >> config.dialog.$menu_this.$swpid |
|
|
|
echo "$id '$spacer$text'" >> $swpdir/config.dialog.$menu_this |
|
|
|
|
|
|
|
# If you do not know what mighty esden |
|
|
|
# is doing here see comment() |
|
|
|
if [ "$3" != "" ] ; then |
|
|
|
set_help "$2" "$3" |
|
|
|
fi |
|
|
|
set_help "$id" "$help" |
|
|
|
fi |
|
|
|
bprof comment_id stop |
|
|
|
} |
|
|
|
|
|
|
|
const() { |
|
|
|
bprof const start |
|
|
|
local q="'" |
|
|
|
local v="${2//$q/$q\\$q$q}" |
|
|
|
eval "$1=\"\$2\"" |
|
|
|
echo "export $1='$v'" >> config/$config.$swpid/config |
|
|
|
bprof const stop |
|
|
|
} |
|
|
|
|
|
|
|
# Usage: set_data NAME DEFAULT |
|
|
|
# |
|
|
|
set_data() { |
|
|
|
local name="$1" q="'" |
|
|
|
data="$2" |
|
|
|
bprof set_data start |
|
|
|
local q="'" |
|
|
|
|
|
|
|
set_name="ROCKCFGSET_${1#ROCKCFG_}" |
|
|
|
usr_name="ROCKCFGUSR_${1#ROCKCFG_}" |
|
|
|
set_name="ROCKCFGSET_${name#ROCKCFG_}" |
|
|
|
usr_name="ROCKCFGUSR_${name#ROCKCFG_}" |
|
|
|
usr_data="${!usr_name}" |
|
|
|
|
|
|
|
menumode=0 |
|
|
|
data="$2" |
|
|
|
|
|
|
|
if [ "${!set_name}" ]; then |
|
|
|
data="${!set_name}" |
|
|
|
fi |
|
|
|
dfl_data="$data" |
|
|
|
|
|
|
|
if [ $ROCKCFG_EXPERT -eq 1 -o $expert -eq 0 ]; then |
|
|
|
menumode=2 |
|
|
|
if [ $nousrconfig -eq 1 ] && [ -n "${!1}" -a "${!1}" != "$data" ] ; then |
|
|
|
eval "$usr_name=\"${!1}\"" |
|
|
|
usr_data="${!1}" |
|
|
|
fi |
|
|
|
if [ "$ROCKCFG_EXPERT" -eq 1 -o "$expert" -eq 0 ]; then |
|
|
|
if [ -n "$usr_data" ]; then |
|
|
|
data="$usr_data" |
|
|
|
obegin="<" oend=">" menumode=1 |
|
|
|
obegin="<" oend=">" |
|
|
|
else |
|
|
|
unset $usr_name |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
eval "$1=\"\$data\"" |
|
|
|
item="$1" |
|
|
|
|
|
|
|
echo "export $1='${data//$q/$q\\$q$q}'" >> config/$config.$swpid/config |
|
|
|
eval "$name=\"\$data\"" |
|
|
|
item="$name" |
|
|
|
bprof set_data stop |
|
|
|
} |
|
|
|
|
|
|
|
@ -268,58 +249,62 @@ choice() { |
|
|
|
bprof choice start |
|
|
|
local obegin="(" oend=")" |
|
|
|
local q="'" |
|
|
|
local name="$1" default="$2" |
|
|
|
|
|
|
|
set_data "$1" "$2" |
|
|
|
set_data "$name" "$default" |
|
|
|
|
|
|
|
# if data is not in list, leave usr_data unmodified |
|
|
|
# but set the current value to the default |
|
|
|
local fallback_hack=0 |
|
|
|
eval $( |
|
|
|
shift; shift |
|
|
|
shift 2 |
|
|
|
while [ "$#" != 0 ] ; do |
|
|
|
[ "$data" = "$1" ] && exit |
|
|
|
shift; shift |
|
|
|
[ "$1" = "$default" ] && exit |
|
|
|
shift 2 |
|
|
|
done |
|
|
|
echo "fallback_hack=1" |
|
|
|
) |
|
|
|
if [ "$fallback_hack" = 1 ]; then |
|
|
|
obegin="?"; oend="?"; data="$dfl_data"; eval "$1=\"\$data\"" |
|
|
|
echo "export $1='${data//$q/$q\\$q$q}'" >> config/$config.$swpid/config |
|
|
|
obegin="?"; oend="?"; data="$dfl_data"; eval "$name=\"\$data\"" |
|
|
|
fi |
|
|
|
|
|
|
|
if [ "$menumode" -gt 0 ] |
|
|
|
if [ "$ROCKCFG_EXPERT" -eq 1 -o "$expert" -eq 0 ] |
|
|
|
then |
|
|
|
{ echo -en "$item\tchoice_action '$usr_name' '$usr_data'" ; shift ; shift |
|
|
|
echo -n " '' 'Reset_this_switch_to_default_value'" |
|
|
|
for x ; do echo -n " '$x'" ; done ; echo ; } >> config.data.$menu_this.$swpid |
|
|
|
{ echo -en "$item\tchoice_action '$usr_name' '$usr_data'" |
|
|
|
echo -n " '' 'Reset_this_switch_to_default_value'" |
|
|
|
shift 2 ; printf " '%s'" "$@" ; echo |
|
|
|
} >> $swpdir/config.data.$menu_this |
|
|
|
|
|
|
|
xdata="$obegin$data$oend" |
|
|
|
|
|
|
|
while [ "$1" -a "$1" != "$data" ] ; do shift ; shift ; done |
|
|
|
while [ "$1" -a "$1" != "$data" ] ; do shift 2 ; done |
|
|
|
printf "'$item' '$spacer%-${tabspace}s ${2//_/ }'\n" "$xdata" \ |
|
|
|
>> config.dialog.$menu_this.$swpid |
|
|
|
>> $swpdir/config.dialog.$menu_this |
|
|
|
fi |
|
|
|
|
|
|
|
bprof choice stop |
|
|
|
} |
|
|
|
|
|
|
|
choice_action() { |
|
|
|
item="$1" ; default="$2" ; shift 2 |
|
|
|
|
|
|
|
command="./src/rockdialog.bin --title 'Build Config' \ |
|
|
|
--backtitle '$configtitle' \ |
|
|
|
--radiolist 'Arrow keys navigate the menu. Press <Enter> to activate menu items. Highlighted letters are hotkeys.' \ |
|
|
|
$(( $lines - 4 )) $(( $columns - 5 )) $(( $lines - 12 ))" |
|
|
|
default=$2 ; item=$1 ; shift ; shift |
|
|
|
while [ "$#" -gt 1 ] ; do |
|
|
|
command="$command '$1' '${2//_/ }'" |
|
|
|
if [ "$1" = "$default" ] |
|
|
|
then command="$command '$1' '${2//_/ }' ON" |
|
|
|
else command="$command '$1' '${2//_/ }' OFF" ; fi |
|
|
|
shift ; shift |
|
|
|
then command="$command ON" |
|
|
|
else command="$command OFF" ; fi |
|
|
|
shift 2 |
|
|
|
done |
|
|
|
eval "$command" 2> config.out.$swpid |
|
|
|
eval "$command" 2> $swpdir/config.out |
|
|
|
|
|
|
|
case "$?" in |
|
|
|
0|6) |
|
|
|
eval "$item='`cat config.out.$swpid`'" |
|
|
|
eval "$item='`cat $swpdir/config.out`'" |
|
|
|
set_data "${item/ROCKCFGUSR/ROCKCFG}" "$default" |
|
|
|
;; |
|
|
|
1|255) return 0 ;; |
|
|
|
2) echo "No help." ; sleep 1 ;; |
|
|
|
@ -328,63 +313,69 @@ choice_action() { |
|
|
|
} |
|
|
|
|
|
|
|
text() { |
|
|
|
local name="$1" id="$2" default="$3" help="$4" |
|
|
|
bprof text start |
|
|
|
local q="'" obegin="(" oend=")" |
|
|
|
set_data "$2" "$3" |
|
|
|
|
|
|
|
if [ "$menumode" -gt 0 ] |
|
|
|
set_data "$id" "$default" |
|
|
|
|
|
|
|
if [ "$ROCKCFG_EXPERT" -eq 1 -o "$expert" -eq 0 ] |
|
|
|
then |
|
|
|
echo -e "$2\ttext_action '$1' '$usr_name'" \ |
|
|
|
"'${data//$q/$q\\$q$q}'" >> config.data.$menu_this.$swpid |
|
|
|
echo -e "$id\ttext_action '$name' '$usr_name'" \ |
|
|
|
"'${data//$q/$q\\$q$q}'" >> $swpdir/config.data.$menu_this |
|
|
|
|
|
|
|
xdata="${obegin}$( printf "%-${tabspace}s" \ |
|
|
|
"$(echo $data | cut -c1-20)")${oend}" |
|
|
|
"$(echo $data | cut -c1-20)")${oend}" |
|
|
|
|
|
|
|
printf "'$2' '$spacer%s $1'\n" \ |
|
|
|
"${xdata//$q/$q\\$q$q}" >> config.dialog.$menu_this.$swpid |
|
|
|
printf "'$id' '$spacer%s $name'\n" \ |
|
|
|
"${xdata//$q/$q\\$q$q}" >> $swpdir/config.dialog.$menu_this |
|
|
|
|
|
|
|
# If you do not know what mighty esden |
|
|
|
# is doin here see comment() |
|
|
|
if [ "$4" != "" ] ; then |
|
|
|
set_help "$2" "$4" |
|
|
|
fi |
|
|
|
set_help "$id" "$help" |
|
|
|
fi |
|
|
|
bprof text stop |
|
|
|
} |
|
|
|
|
|
|
|
text_action() { |
|
|
|
local label="$1" usrvar="$2" data="$3" |
|
|
|
|
|
|
|
./src/rockdialog.bin --title 'Build Config' \ |
|
|
|
--backtitle "$configtitle" \ |
|
|
|
--inputbox "$1" 9 $(( $columns - 5 )) "$3" 2> config.out.$swpid |
|
|
|
[ "$?" -eq 0 -o "$?" -eq 1 ] && eval "$2=\"\$(cat config.out.$swpid)\"" |
|
|
|
--inputbox "$label" 9 $(( $columns - 5 )) "$data" 2> $swpdir/config.out |
|
|
|
if [ "$?" -eq 0 -o "$?" -eq 1 ] ; then |
|
|
|
eval "$usrvar=\"\$(cat $swpdir/config.out)\"" |
|
|
|
set_data "${usrvar/ROCKCFGUSR/ROCKCFG}" "$data" |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
bool() { |
|
|
|
bprof bool start |
|
|
|
local name="$1" id="$2" default="$3" help="$4" |
|
|
|
local x obegin="[" oend="]" |
|
|
|
set_data "$2" "$3" |
|
|
|
|
|
|
|
if [ "$menumode" -gt 0 ] |
|
|
|
bprof bool start |
|
|
|
set_data "$id" "$default" |
|
|
|
|
|
|
|
if [ "$ROCKCFG_EXPERT" -eq 1 -o "$expert" -eq 0 ] |
|
|
|
then |
|
|
|
if [ $data -eq 0 ] ; then x="${obegin} ${oend}" ; else x="${obegin}*${oend}" ; fi |
|
|
|
echo -e "$2\tbool_action '$usr_name' '$usr_data' '$3'" >> config.data.$menu_this.$swpid |
|
|
|
if [ $data -eq 0 ] ; then |
|
|
|
x="${obegin} ${oend}" |
|
|
|
else |
|
|
|
x="${obegin}*${oend}" |
|
|
|
fi |
|
|
|
echo -e "$id\tbool_action '$usr_name' '$usr_data' '$default'" \ |
|
|
|
>> $swpdir/config.data.$menu_this |
|
|
|
|
|
|
|
printf "$2 '$spacer%-${tabspace}s ${1//_/ }'\n" "$x" >> config.dialog.$menu_this.$swpid |
|
|
|
printf "$id '$spacer%-${tabspace}s ${name//_/ }'\n" "$x" \ |
|
|
|
>> $swpdir/config.dialog.$menu_this |
|
|
|
|
|
|
|
# If you do not know what mighty esden is doin here see comment() |
|
|
|
if [ "$4" != "" ] ; then |
|
|
|
set_help "$2" "$4" |
|
|
|
fi |
|
|
|
set_help "$id" "$help" |
|
|
|
fi |
|
|
|
bprof bool stop |
|
|
|
} |
|
|
|
|
|
|
|
bool_action() { |
|
|
|
local usrvar=$1 |
|
|
|
local origval=$3 |
|
|
|
local usrval |
|
|
|
eval "usrval=\${$usrvar}" |
|
|
|
case "$usrval" in |
|
|
|
local usrvar=$1 origval=$3 |
|
|
|
|
|
|
|
case "${!usrvar}" in |
|
|
|
"") [ "$origval" == "0" ] && eval "$usrvar=1" |
|
|
|
[ "$origval" == "1" ] && eval "$usrvar=0" |
|
|
|
;; |
|
|
|
@ -395,66 +386,64 @@ bool_action() { |
|
|
|
[ "$origval" == "1" ] && eval "$usrvar=1" |
|
|
|
;; |
|
|
|
esac |
|
|
|
set_data "${usrvar/ROCKCFGUSR/ROCKCFG}" "$3" |
|
|
|
} |
|
|
|
|
|
|
|
editfile() { |
|
|
|
local id="$1" file="$2" label="$3" |
|
|
|
|
|
|
|
bprof editfile start |
|
|
|
if [ $ROCKCFG_EXPERT -eq 1 -o $expert -eq 0 ] ; then |
|
|
|
if [ "$ROCKCFG_EXPERT" -eq 1 -o $expert -eq 0 ] ; then |
|
|
|
local x="$spacer" q="'" |
|
|
|
comment ",----< $3 >----." |
|
|
|
comment ",----< $label >----." |
|
|
|
block_begin 0 ; spacer="${spacer%??}| " |
|
|
|
|
|
|
|
touch "$2" |
|
|
|
touch "$file" |
|
|
|
line_nr=1 |
|
|
|
while read line ; do |
|
|
|
line="${line//$q/$q\\$q$q}" |
|
|
|
printf "$1:${editfilenr} '$spacer%-${tabspace}s %s'\n" \ |
|
|
|
`printf "%03d:" $line_nr` "$line" >> config.dialog.$menu_this.$swpid |
|
|
|
printf "$id:${editfilenr} '$spacer%-${tabspace}s %s'\n" \ |
|
|
|
`printf "%03d:" $line_nr` "$line" >> $swpdir/config.dialog.$menu_this |
|
|
|
|
|
|
|
echo -e "$1:${editfilenr}\teditfile_action $2" \ |
|
|
|
"$line_nr '$3'" >> config.data.$menu_this.$swpid |
|
|
|
echo -e "$id:${editfilenr}\teditfile_action $file" \ |
|
|
|
"$line_nr '$label'" >> $swpdir/config.data.$menu_this |
|
|
|
|
|
|
|
editfilenr=$(( $editfilenr + 1 )) |
|
|
|
line_nr=$(( $line_nr + 1 )) |
|
|
|
done < "$2" |
|
|
|
done < "$file" |
|
|
|
|
|
|
|
printf "$1:${editfilenr} '$spacer%-${tabspace}s %s'\n" \ |
|
|
|
`printf "%03d:" $line_nr` "<add new rule>" >> config.dialog.$menu_this.$swpid |
|
|
|
printf "$id:${editfilenr} '$spacer%-${tabspace}s %s'\n" \ |
|
|
|
`printf "%03d:" $line_nr` "<add new rule>" >> $swpdir/config.dialog.$menu_this |
|
|
|
|
|
|
|
echo -e "$1:${editfilenr}\teditfile_action $2" \ |
|
|
|
"$line_nr '$3'" >> config.data.$menu_this.$swpid |
|
|
|
echo -e "$id:${editfilenr}\teditfile_action $file" \ |
|
|
|
"$line_nr '$label'" >> $swpdir/config.data.$menu_this |
|
|
|
|
|
|
|
editfilenr=$(( $editfilenr + 1 )) |
|
|
|
|
|
|
|
block_end |
|
|
|
comment "\`------${3//?/-}------'\''" |
|
|
|
comment "\`------${label//?/-}------'\''" |
|
|
|
spacer="$x" |
|
|
|
fi |
|
|
|
bprof editfile stop |
|
|
|
} |
|
|
|
|
|
|
|
editfile_action() { |
|
|
|
line="`tail -n +$2 $1 | head -n 1`" |
|
|
|
|
|
|
|
./src/rockdialog.bin --title 'Build Config' \ |
|
|
|
--backtitle "$configtitle" \ |
|
|
|
--inputbox "$3 - Line $3" \ |
|
|
|
9 $(( $columns - 5 )) "$line" 2> config.out.$swpid |
|
|
|
|
|
|
|
head -n $(( $2 - 1 )) $1 > $1.new |
|
|
|
[ -s config.out.$swpid ] && echo "`cat config.out.$swpid`" >> $1.new |
|
|
|
tail -n +$(( $2 + 1 )) $1 >> $1.new |
|
|
|
local filename="$1" |
|
|
|
|
|
|
|
mv $1.new $1 |
|
|
|
cp -a "$filename"{,.orig} |
|
|
|
${EDITOR:-vim} "$filename" && rm -f "$filename.orig" \ |
|
|
|
|| mv "$filename"{.orig,} |
|
|
|
} |
|
|
|
|
|
|
|
startprog() { |
|
|
|
local id="$1" label="$2" prog="$3" |
|
|
|
|
|
|
|
bprof startprog start |
|
|
|
if [ $ROCKCFG_EXPERT -eq 1 -o $expert -eq 0 ] |
|
|
|
if [ "$ROCKCFG_EXPERT" -eq 1 -o $expert -eq 0 ] |
|
|
|
then |
|
|
|
printf "$1 '$spacer%-${tabspace}s %s'\n" \ |
|
|
|
"-->" "$2" >> config.dialog.$menu_this.$swpid |
|
|
|
echo -e "$1\t$3" >> config.data.$menu_this.$swpid |
|
|
|
printf "$id '$spacer%-${tabspace}s %s'\n" \ |
|
|
|
"-->" "$label" >> $swpdir/config.dialog.$menu_this |
|
|
|
echo -e "$id\t$prog" >> $swpdir/config.data.$menu_this |
|
|
|
fi |
|
|
|
bprof startprog stop |
|
|
|
} |
|
|
|
@ -475,6 +464,12 @@ block_end() { |
|
|
|
bprof block_end stop |
|
|
|
} |
|
|
|
|
|
|
|
# has to be called at the beginning of each config cycle |
|
|
|
config_cycle() { |
|
|
|
expert=0; |
|
|
|
menu_counter=0; |
|
|
|
} |
|
|
|
|
|
|
|
expert_begin() { |
|
|
|
expert=$(( $expert + 1 )) |
|
|
|
} |
|
|
|
@ -484,18 +479,22 @@ expert_end() { |
|
|
|
} |
|
|
|
|
|
|
|
menu_begin() { |
|
|
|
local id="$1" name="$2" |
|
|
|
bprof menu_begin start |
|
|
|
menu_counter=$(( $menu_counter + 1 )) |
|
|
|
|
|
|
|
if [ $ROCKCFG_EXPERT -eq 1 -o $expert -eq 0 ] |
|
|
|
if [ "$ROCKCFG_EXPERT" -eq 1 -o $expert -eq 0 ] |
|
|
|
then |
|
|
|
printf "$1 '$spacer%-${tabspace}s %s'\n" \ |
|
|
|
"===>" "$2" >> config.dialog.$menu_this.$swpid |
|
|
|
echo -e "$1\tmenu_current=$menu_counter" >> config.data.$menu_this.$swpid |
|
|
|
|
|
|
|
echo "$1 '===> $2'" >> config.dialog.$menu_counter.$swpid |
|
|
|
echo -e "$1\tmenu_current=$menu_this current=$1" >> config.data.$menu_counter.$swpid |
|
|
|
echo -e "MENU_BACK\tmenu_current=$menu_this current=$1" >> config.data.$menu_counter.$swpid |
|
|
|
printf "$id '$spacer%-${tabspace}s %s'\n" \ |
|
|
|
"===>" "$name" >> $swpdir/config.dialog.$menu_this |
|
|
|
echo -e "$id\tmenu_current=$menu_counter" \ |
|
|
|
>> $swpdir/config.data.$menu_this |
|
|
|
|
|
|
|
echo "$id '===> $name'" >> $swpdir/config.dialog.$menu_counter |
|
|
|
echo -e "$id\tmenu_current=$menu_this current=$id" \ |
|
|
|
>> $swpdir/config.data.$menu_counter |
|
|
|
echo -e "MENU_BACK\tmenu_current=$menu_this current=$id" \ |
|
|
|
>> $swpdir/config.data.$menu_counter |
|
|
|
fi |
|
|
|
|
|
|
|
menu_stack="$menu_this $menu_stack" |
|
|
|
@ -514,13 +513,18 @@ menu_end() { |
|
|
|
} |
|
|
|
|
|
|
|
set_help() { |
|
|
|
local id="$1" help="$2" |
|
|
|
|
|
|
|
bprof set_help start |
|
|
|
(echo -ne "$1 '$1:\n\n$2'" | sed 's,$,\\n,' | |
|
|
|
tr -d '\n' | sed 's,\\n$,,'; echo ) >> config.help.$swpid |
|
|
|
if [ "$help" != "" ] ; then |
|
|
|
echo -e "$id $help\n\n" >> $swpdir/config.help |
|
|
|
fi |
|
|
|
bprof set_help stop |
|
|
|
} |
|
|
|
|
|
|
|
get_help() { |
|
|
|
local item_name="$1" tmp_text hlp_text default_text |
|
|
|
|
|
|
|
bprof get_help start |
|
|
|
|
|
|
|
cat << EOT |
|
|
|
@ -545,7 +549,7 @@ EOT |
|
|
|
|
|
|
|
# Create standard help output ... |
|
|
|
default_text=" |
|
|
|
There is no help on '$1' available. |
|
|
|
There is no help on '$item_name' available. |
|
|
|
|
|
|
|
Please read the build Documentation (Documentation/BUILD) |
|
|
|
before building ROCK Linux. |
|
|
|
@ -557,27 +561,17 @@ More information can be found on the ROCK Linux Homepage: |
|
|
|
Information about the ROCK Linux mailing lists and the mailing |
|
|
|
list archive can be found at: |
|
|
|
|
|
|
|
http://www.rocklinux.org/mail.html and |
|
|
|
http://www.rocklinux.org/wiki/Mailing_Lists and |
|
|
|
http://www.rocklinux.net/lurker/splash" |
|
|
|
|
|
|
|
# Ok let us find a help for the current item ... |
|
|
|
|
|
|
|
# First of all mask all special chars in the item name |
|
|
|
# Comment: this is sick. You can't get any \n this way !!! |
|
|
|
item_name=$( echo "$1" | sed 's/[][\/.^$*]/\\&/g' ) |
|
|
|
# Now search *.hlp files |
|
|
|
hlp_text=$( sed -n "/^$item_name[ ]*\$/,\${ |
|
|
|
/^$item_name[ ]*\$/c\\ |
|
|
|
$item_name:\\ |
|
|
|
|
|
|
|
/^#/d |
|
|
|
/^[^ ]/q |
|
|
|
s/^ // |
|
|
|
p |
|
|
|
}" scripts/config*.hlp package/*/*/subconfig-*.hlp package/*/*/config*.hlp target/*/config*.hlp misc/*/config*.hlp misc/*/*/config*.hlp 2>/dev/null ) |
|
|
|
hlp_text="$( sed -e "/^$item_name\$/,/^\$/ p ; d" \ |
|
|
|
misc/*/{,*/}config*.hlp package/*/*/{sub,}config-*.hlp \ |
|
|
|
{scripts,target/*}/config*.hlp 2>/dev/null )" |
|
|
|
|
|
|
|
# Get help strings out of the temporary file. |
|
|
|
tmp_text=$(grep "^$item_name" config.help.$swpid | cut -f2- -d' ' | sed -e "s,^',," -e "s,'$,," ) |
|
|
|
tmp_text="$( sed -e "/^[ ]*$item_name\([ ]\|\$\)/,/^\$/ p ; d" \ |
|
|
|
$swpdir/config.help 2>/dev/null )" |
|
|
|
|
|
|
|
# Let us see what we have ... |
|
|
|
if [ "$hlp_text" -a "$tmp_text" ] ; then |
|
|
|
@ -594,12 +588,11 @@ Here the one out of config.hlp: |
|
|
|
|
|
|
|
$hlp_text" |
|
|
|
elif [ "$hlp_text" ] ; then |
|
|
|
echo "$hlp_text" |
|
|
|
echo "config.hlp: $hlp_text" |
|
|
|
elif [ "$tmp_text" ] ; then |
|
|
|
echo "$tmp_text" |
|
|
|
echo "config.in: $tmp_text" |
|
|
|
else |
|
|
|
echo "$default_text" |
|
|
|
fi |
|
|
|
bprof get_help stop |
|
|
|
} |
|
|
|
|