| 1 |
#!/usr/bin/env bash |
|---|
| 2 |
# |
|---|
| 3 |
# VLC media player configuration script, borrowed from linux menuconfig |
|---|
| 4 |
# Cyril Deguet <asmax@videolan.org> |
|---|
| 5 |
# |
|---|
| 6 |
#----------------------------------------------------------------- |
|---|
| 7 |
# William Roadcap was the original author of Menuconfig. |
|---|
| 8 |
# Michael Elizabeth Chastain (mec@shout.net) is the current maintainer. |
|---|
| 9 |
# |
|---|
| 10 |
# 070497 Bernhard Kaindl (bkaindl@netway.at) - get default values for |
|---|
| 11 |
# new bool, tristate and dep_tristate parameters from the defconfig file. |
|---|
| 12 |
# new configuration parameters are marked with '(NEW)' as in make config. |
|---|
| 13 |
# |
|---|
| 14 |
# 180697 Bernhard Kaindl (bkaindl@netway.at) - added the needed support |
|---|
| 15 |
# for string options. They are handled like the int and hex options. |
|---|
| 16 |
# |
|---|
| 17 |
# 081297 Pavel Machek (pavel@atrey.karlin.mff.cuni.cz) - better error |
|---|
| 18 |
# handling |
|---|
| 19 |
# |
|---|
| 20 |
# 131197 Michael Chastain (mec@shout.net) - output all lines for a |
|---|
| 21 |
# choice list, not just the selected one. This makes the output |
|---|
| 22 |
# the same as Configure output, which is important for smart config |
|---|
| 23 |
# dependencies. |
|---|
| 24 |
# |
|---|
| 25 |
# 101297 Michael Chastain (mec@shout.net) - remove sound driver cruft. |
|---|
| 26 |
# |
|---|
| 27 |
# 221297 Michael Chastain (mec@shout.net) - make define_bool actually |
|---|
| 28 |
# define its arguments so that later tests on them work right. |
|---|
| 29 |
# |
|---|
| 30 |
# 160198 Michael Chastain (mec@shout.net) - fix bug with 'c' command |
|---|
| 31 |
# (complement existing value) when used on virgin uninitialized variables. |
|---|
| 32 |
# |
|---|
| 33 |
# 090398 Axel Boldt (boldt@math.ucsb.edu) - allow for empty lines in help |
|---|
| 34 |
# texts. |
|---|
| 35 |
# |
|---|
| 36 |
# 12 Dec 1998, Michael Elizabeth Chastain (mec@shout.net) |
|---|
| 37 |
# Remove a /tmp security hole in get_def (also makes it faster). |
|---|
| 38 |
# Give uninitialized variables canonical values rather than null value. |
|---|
| 39 |
# Change a lot of places to call set_x_info uniformly. |
|---|
| 40 |
# Take out message about preparing version (old sound driver cruft). |
|---|
| 41 |
# |
|---|
| 42 |
# 13 Dec 1998, Riley H Williams <Riley@Williams.Name> |
|---|
| 43 |
# When an error occurs, actually display the error message as well as |
|---|
| 44 |
# our comments thereon. |
|---|
| 45 |
# |
|---|
| 46 |
# 31 Dec 1998, Michael Elizabeth Chastain (mec@shout.net) |
|---|
| 47 |
# Fix mod_bool to honor $CONFIG_MODULES. |
|---|
| 48 |
# Fix dep_tristate to call define_bool when dependency is "n". |
|---|
| 49 |
# |
|---|
| 50 |
# 02 January 1999, Michael Elizabeth Chastain (mec@shout.net) |
|---|
| 51 |
# Blow away lxdialog.scrltmp on entry to activate_menu. This protects |
|---|
| 52 |
# against people who use commands like ' ' to select menus. |
|---|
| 53 |
# |
|---|
| 54 |
# 24 January 1999, Michael Elizabeth Chastain, <mec@shout.net> |
|---|
| 55 |
# - Improve the exit message (Jeff Ronne). |
|---|
| 56 |
# |
|---|
| 57 |
# 06 July 1999, Andrzej M. Krzysztofowicz, <ankry@mif.pg.gda.pl> |
|---|
| 58 |
# - Support for multiple conditions in dep_tristate(). |
|---|
| 59 |
# - Implemented new functions: define_tristate(), define_int(), define_hex(), |
|---|
| 60 |
# define_string(), dep_bool(). |
|---|
| 61 |
# |
|---|
| 62 |
# 12 November 2001, Keith Owens <kaos@ocs.com.au> |
|---|
| 63 |
# Escape double quotes on eval so the quotes are still there on the second |
|---|
| 64 |
# evaluation, required to handle strings with special characters. |
|---|
| 65 |
# |
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
# |
|---|
| 69 |
# Change this to TRUE if you prefer all kernel options listed |
|---|
| 70 |
# in a single menu rather than the standard menu hierarchy. |
|---|
| 71 |
# |
|---|
| 72 |
single_menu_mode= |
|---|
| 73 |
|
|---|
| 74 |
# |
|---|
| 75 |
# Make sure we're really running bash. |
|---|
| 76 |
# |
|---|
| 77 |
[ -z "$BASH" ] && { echo "Menuconfig requires bash" 1>&2; exit 1; } |
|---|
| 78 |
|
|---|
| 79 |
# |
|---|
| 80 |
# Cache function definitions, turn off posix compliance |
|---|
| 81 |
# |
|---|
| 82 |
set -h +o posix |
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
# Given a configuration variable, set the global variable $x to its value, |
|---|
| 87 |
# and the global variable $info to the string " (NEW)" if this is a new |
|---|
| 88 |
# variable. |
|---|
| 89 |
# |
|---|
| 90 |
# This function looks for: (1) the current value, or (2) the default value |
|---|
| 91 |
# from the arch-dependent defconfig file, or (3) a default passed by the caller. |
|---|
| 92 |
|
|---|
| 93 |
function set_x_info () { |
|---|
| 94 |
eval x=\$$1 |
|---|
| 95 |
if [ -z "$x" ]; then |
|---|
| 96 |
eval `sed -n -e 's/# \(.*\) is not set.*/\1=n/' -e "/^$1=/p" arch/$ARCH/defconfig` |
|---|
| 97 |
eval x=\${$1:-\"$2\"} |
|---|
| 98 |
eval $1=$x |
|---|
| 99 |
eval INFO_$1="' (NEW)'" |
|---|
| 100 |
fi |
|---|
| 101 |
eval info=\"\$INFO_$1\" |
|---|
| 102 |
} |
|---|
| 103 |
|
|---|
| 104 |
# |
|---|
| 105 |
# Load the functions used by the config.in files. |
|---|
| 106 |
# |
|---|
| 107 |
# I do this because these functions must be redefined depending |
|---|
| 108 |
# on whether they are being called for interactive use or for |
|---|
| 109 |
# saving a configuration to a file. |
|---|
| 110 |
# |
|---|
| 111 |
# Thank the heavens bash supports nesting function definitions. |
|---|
| 112 |
# |
|---|
| 113 |
load_functions () { |
|---|
| 114 |
|
|---|
| 115 |
# |
|---|
| 116 |
# Additional comments |
|---|
| 117 |
# |
|---|
| 118 |
function comment () { |
|---|
| 119 |
comment_ctr=$[ comment_ctr + 1 ] |
|---|
| 120 |
echo -ne "': $comment_ctr' '--- $1' " >>MCmenu |
|---|
| 121 |
} |
|---|
| 122 |
|
|---|
| 123 |
# |
|---|
| 124 |
# Define a boolean to a specific value. |
|---|
| 125 |
# |
|---|
| 126 |
function define_bool () { |
|---|
| 127 |
eval $1=$2 |
|---|
| 128 |
} |
|---|
| 129 |
|
|---|
| 130 |
function define_tristate () { |
|---|
| 131 |
eval $1=$2 |
|---|
| 132 |
} |
|---|
| 133 |
|
|---|
| 134 |
function define_hex () { |
|---|
| 135 |
eval $1=$2 |
|---|
| 136 |
} |
|---|
| 137 |
|
|---|
| 138 |
function define_int () { |
|---|
| 139 |
eval $1=$2 |
|---|
| 140 |
} |
|---|
| 141 |
|
|---|
| 142 |
function define_string () { |
|---|
| 143 |
eval $1=\"$2\" |
|---|
| 144 |
} |
|---|
| 145 |
|
|---|
| 146 |
# |
|---|
| 147 |
# Create a boolean (Yes/No) function for our current menu |
|---|
| 148 |
# which calls our local bool function. |
|---|
| 149 |
# |
|---|
| 150 |
function bool () { |
|---|
| 151 |
set_x_info "$2" "n" |
|---|
| 152 |
|
|---|
| 153 |
case $x in |
|---|
| 154 |
y|m) flag="*" ;; |
|---|
| 155 |
n) flag=" " ;; |
|---|
| 156 |
esac |
|---|
| 157 |
|
|---|
| 158 |
echo -ne "'$2' '[$flag] $1$info' " >>MCmenu |
|---|
| 159 |
|
|---|
| 160 |
echo -e "function $2 () { l_bool '$2' \"\$1\" ;}\n" >>MCradiolists |
|---|
| 161 |
} |
|---|
| 162 |
|
|---|
| 163 |
# |
|---|
| 164 |
# Create a tristate (Yes/No/Module) radiolist function |
|---|
| 165 |
# which calls our local tristate function. |
|---|
| 166 |
# |
|---|
| 167 |
# Collapses to a boolean (Yes/No) if module support is disabled. |
|---|
| 168 |
# |
|---|
| 169 |
function tristate () { |
|---|
| 170 |
if [ "$CONFIG_MODULES" != "y" ] |
|---|
| 171 |
then |
|---|
| 172 |
bool "$1" "$2" |
|---|
| 173 |
else |
|---|
| 174 |
set_x_info "$2" "n" |
|---|
| 175 |
|
|---|
| 176 |
case $x in |
|---|
| 177 |
y) flag="*" ;; |
|---|
| 178 |
m) flag="M" ;; |
|---|
| 179 |
*) flag=" " ;; |
|---|
| 180 |
esac |
|---|
| 181 |
|
|---|
| 182 |
echo -ne "'$2' '<$flag> $1$info' " >>MCmenu |
|---|
| 183 |
|
|---|
| 184 |
echo -e " |
|---|
| 185 |
function $2 () { l_tristate '$2' \"\$1\" ;}" >>MCradiolists |
|---|
| 186 |
fi |
|---|
| 187 |
} |
|---|
| 188 |
|
|---|
| 189 |
# |
|---|
| 190 |
# Create a tristate radiolist function which is dependent on |
|---|
| 191 |
# another vlc configuration option. |
|---|
| 192 |
# |
|---|
| 193 |
# Quote from the original configure script: |
|---|
| 194 |
# |
|---|
| 195 |
# If the option we depend upon is a module, |
|---|
| 196 |
# then the only allowable options are M or N. If Y, then |
|---|
| 197 |
# this is a normal tristate. This is used in cases where modules |
|---|
| 198 |
# are nested, and one module requires the presence of something |
|---|
| 199 |
# else in the kernel. |
|---|
| 200 |
# |
|---|
| 201 |
function dep_tristate () { |
|---|
| 202 |
ques="$1" |
|---|
| 203 |
var="$2" |
|---|
| 204 |
dep=y |
|---|
| 205 |
shift 2 |
|---|
| 206 |
while [ $# -gt 0 ]; do |
|---|
| 207 |
if [ "$1" = y ]; then |
|---|
| 208 |
shift |
|---|
| 209 |
elif [ "$1" = m ]; then |
|---|
| 210 |
dep=m |
|---|
| 211 |
shift |
|---|
| 212 |
else |
|---|
| 213 |
dep=n |
|---|
| 214 |
shift $# |
|---|
| 215 |
fi |
|---|
| 216 |
done |
|---|
| 217 |
if [ "$dep" = y ]; then |
|---|
| 218 |
tristate "$ques" "$var" |
|---|
| 219 |
elif [ "$dep" = m ]; then |
|---|
| 220 |
mod_bool "$ques" "$var" |
|---|
| 221 |
else |
|---|
| 222 |
define_tristate "$var" n |
|---|
| 223 |
fi |
|---|
| 224 |
} |
|---|
| 225 |
|
|---|
| 226 |
# |
|---|
| 227 |
# Same as above, but now only Y and N are allowed as dependency |
|---|
| 228 |
# (i.e. third and next arguments). |
|---|
| 229 |
# |
|---|
| 230 |
function dep_bool () { |
|---|
| 231 |
ques="$1" |
|---|
| 232 |
var="$2" |
|---|
| 233 |
dep=y |
|---|
| 234 |
shift 2 |
|---|
| 235 |
while [ $# -gt 0 ]; do |
|---|
| 236 |
if [ "$1" = y ]; then |
|---|
| 237 |
shift |
|---|
| 238 |
else |
|---|
| 239 |
dep=n |
|---|
| 240 |
shift $# |
|---|
| 241 |
fi |
|---|
| 242 |
done |
|---|
| 243 |
if [ "$dep" = y ]; then |
|---|
| 244 |
bool "$ques" "$var" |
|---|
| 245 |
else |
|---|
| 246 |
define_bool "$var" n |
|---|
| 247 |
fi |
|---|
| 248 |
} |
|---|
| 249 |
|
|---|
| 250 |
function dep_mbool () { |
|---|
| 251 |
ques="$1" |
|---|
| 252 |
var="$2" |
|---|
| 253 |
dep=y |
|---|
| 254 |
shift 2 |
|---|
| 255 |
while [ $# -gt 0 ]; do |
|---|
| 256 |
if [ "$1" = y -o "$1" = m ]; then |
|---|
| 257 |
shift |
|---|
| 258 |
else |
|---|
| 259 |
dep=n |
|---|
| 260 |
shift $# |
|---|
| 261 |
fi |
|---|
| 262 |
done |
|---|
| 263 |
if [ "$dep" = y ]; then |
|---|
| 264 |
bool "$ques" "$var" |
|---|
| 265 |
else |
|---|
| 266 |
define_bool "$var" n |
|---|
| 267 |
fi |
|---|
| 268 |
} |
|---|
| 269 |
|
|---|
| 270 |
# |
|---|
| 271 |
# Add a menu item which will call our local int function. |
|---|
| 272 |
# |
|---|
| 273 |
function int () { |
|---|
| 274 |
set_x_info "$2" "$3" |
|---|
| 275 |
|
|---|
| 276 |
echo -ne "'$2' '($x) $1$info' " >>MCmenu |
|---|
| 277 |
|
|---|
| 278 |
echo -e "function $2 () { l_int '$1' '$2' '$3' '$x' ;}" >>MCradiolists |
|---|
| 279 |
} |
|---|
| 280 |
|
|---|
| 281 |
# |
|---|
| 282 |
# Add a menu item which will call our local hex function. |
|---|
| 283 |
# |
|---|
| 284 |
function hex () { |
|---|
| 285 |
set_x_info "$2" "$3" |
|---|
| 286 |
x=${x##*[x,X]} |
|---|
| 287 |
|
|---|
| 288 |
echo -ne "'$2' '($x) $1$info' " >>MCmenu |
|---|
| 289 |
|
|---|
| 290 |
echo -e "function $2 () { l_hex '$1' '$2' '$3' '$x' ;}" >>MCradiolists |
|---|
| 291 |
} |
|---|
| 292 |
|
|---|
| 293 |
# |
|---|
| 294 |
# Add a menu item which will call our local string function. |
|---|
| 295 |
# |
|---|
| 296 |
function string () { |
|---|
| 297 |
set_x_info "$2" "$3" |
|---|
| 298 |
|
|---|
| 299 |
echo -ne "'$2' ' $1: \"$x\"$info' " >>MCmenu |
|---|
| 300 |
|
|---|
| 301 |
echo -e "function $2 () { l_string '$1' '$2' '$3' '$x' ;}" >>MCradiolists |
|---|
| 302 |
} |
|---|
| 303 |
|
|---|
| 304 |
# |
|---|
| 305 |
# Add a menu item which will call our local One-of-Many choice list. |
|---|
| 306 |
# |
|---|
| 307 |
function choice () { |
|---|
| 308 |
# |
|---|
| 309 |
# Need to remember params cause they're gonna get reset. |
|---|
| 310 |
# |
|---|
| 311 |
title=$1 |
|---|
| 312 |
choices=$2 |
|---|
| 313 |
default=$3 |
|---|
| 314 |
current= |
|---|
| 315 |
|
|---|
| 316 |
# |
|---|
| 317 |
# Find out if one of the choices is already set. |
|---|
| 318 |
# If it's not then make it the default. |
|---|
| 319 |
# |
|---|
| 320 |
set -- $choices |
|---|
| 321 |
firstchoice=$2 |
|---|
| 322 |
|
|---|
| 323 |
while [ -n "$2" ] |
|---|
| 324 |
do |
|---|
| 325 |
if eval [ \"_\$$2\" = \"_y\" ] |
|---|
| 326 |
then |
|---|
| 327 |
current=$1 |
|---|
| 328 |
break |
|---|
| 329 |
fi |
|---|
| 330 |
shift ; shift |
|---|
| 331 |
done |
|---|
| 332 |
|
|---|
| 333 |
: ${current:=$default} |
|---|
| 334 |
|
|---|
| 335 |
echo -ne "'$firstchoice' '($current) $title' " >>MCmenu |
|---|
| 336 |
|
|---|
| 337 |
echo -e " |
|---|
| 338 |
function $firstchoice () \ |
|---|
| 339 |
{ l_choice '$title' \"$choices\" \"$current\" ;}" >>MCradiolists |
|---|
| 340 |
} |
|---|
| 341 |
|
|---|
| 342 |
} # END load_functions() |
|---|
| 343 |
|
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 |
|
|---|
| 347 |
|
|---|
| 348 |
# |
|---|
| 349 |
# Extract available help for an option from Configure.help |
|---|
| 350 |
# and send it to standard output. |
|---|
| 351 |
# |
|---|
| 352 |
# Most of this function was borrowed from the original kernel |
|---|
| 353 |
# Configure script. |
|---|
| 354 |
# |
|---|
| 355 |
function extract_help () { |
|---|
| 356 |
if [ -f doc/Configure.help ] |
|---|
| 357 |
then |
|---|
| 358 |
#first escape regexp special characters in the argument: |
|---|
| 359 |
var=$(echo "$1"|sed 's/[][\/.^$*]/\\&/g') |
|---|
| 360 |
#now pick out the right help text: |
|---|
| 361 |
text=$(sed -n "/^$var[ ]*\$/,\${ |
|---|
| 362 |
/^$var[ ]*\$/c\\ |
|---|
| 363 |
${var}:\\ |
|---|
| 364 |
|
|---|
| 365 |
/^#/b |
|---|
| 366 |
/^[^ ]/q |
|---|
| 367 |
s/^ // |
|---|
| 368 |
/<file:\\([^>]*\\)>/s//\\1/g |
|---|
| 369 |
p |
|---|
| 370 |
}" doc/Configure.help) |
|---|
| 371 |
|
|---|
| 372 |
if [ -z "$text" ] |
|---|
| 373 |
then |
|---|
| 374 |
echo "There is no help available for this option." |
|---|
| 375 |
return 1 |
|---|
| 376 |
else |
|---|
| 377 |
echo "$text" |
|---|
| 378 |
fi |
|---|
| 379 |
else |
|---|
| 380 |
echo "There is no help available for this option." |
|---|
| 381 |
return 1 |
|---|
| 382 |
fi |
|---|
| 383 |
} |
|---|
| 384 |
|
|---|
| 385 |
# |
|---|
| 386 |
# Activate a help dialog. |
|---|
| 387 |
# |
|---|
| 388 |
function help () { |
|---|
| 389 |
if extract_help $1 >help.out |
|---|
| 390 |
then |
|---|
| 391 |
$DIALOG --backtitle "$backtitle" --title "$2"\ |
|---|
| 392 |
--textbox help.out $ROWS $COLS |
|---|
| 393 |
else |
|---|
| 394 |
$DIALOG --backtitle "$backtitle" \ |
|---|
| 395 |
--textbox help.out $ROWS $COLS |
|---|
| 396 |
fi |
|---|
| 397 |
rm -f help.out |
|---|
| 398 |
} |
|---|
| 399 |
|
|---|
| 400 |
# |
|---|
| 401 |
# Show the README file. |
|---|
| 402 |
# |
|---|
| 403 |
function show_readme () { |
|---|
| 404 |
$DIALOG --backtitle "$backtitle" \ |
|---|
| 405 |
--textbox scripts/README.Menuconfig $ROWS $COLS |
|---|
| 406 |
} |
|---|
| 407 |
|
|---|
| 408 |
# |
|---|
| 409 |
# Begin building the dialog menu command and Initialize the |
|---|
| 410 |
# Radiolist function file. |
|---|
| 411 |
# |
|---|
| 412 |
function menu_name () { |
|---|
| 413 |
echo -ne "$DIALOG --title '$1'\ |
|---|
| 414 |
--backtitle '$backtitle' \ |
|---|
| 415 |
--menu '$menu_instructions' \ |
|---|
| 416 |
$ROWS $COLS $((ROWS-10)) \ |
|---|
| 417 |
'$default' " >MCmenu |
|---|
| 418 |
>MCradiolists |
|---|
| 419 |
} |
|---|
| 420 |
|
|---|
| 421 |
# |
|---|
| 422 |
# Add a submenu option to the menu currently under construction. |
|---|
| 423 |
# |
|---|
| 424 |
function submenu () { |
|---|
| 425 |
echo -ne "'activate_menu $2' '$1 --->' " >>MCmenu |
|---|
| 426 |
} |
|---|
| 427 |
|
|---|
| 428 |
# |
|---|
| 429 |
# Handle a boolean (Yes/No) option. |
|---|
| 430 |
# |
|---|
| 431 |
function l_bool () { |
|---|
| 432 |
if [ -n "$2" ] |
|---|
| 433 |
then |
|---|
| 434 |
case "$2" in |
|---|
| 435 |
y|m) eval $1=y ;; |
|---|
| 436 |
c) eval x=\$$1 |
|---|
| 437 |
case $x in |
|---|
| 438 |
y) eval $1=n ;; |
|---|
| 439 |
n) eval $1=y ;; |
|---|
| 440 |
*) eval $1=y ;; |
|---|
| 441 |
esac ;; |
|---|
| 442 |
*) eval $1=n ;; |
|---|
| 443 |
esac |
|---|
| 444 |
else |
|---|
| 445 |
echo -ne "\007" |
|---|
| 446 |
fi |
|---|
| 447 |
} |
|---|
| 448 |
|
|---|
| 449 |
# |
|---|
| 450 |
# Same as bool() except options are (Module/No) |
|---|
| 451 |
# |
|---|
| 452 |
function mod_bool () { |
|---|
| 453 |
if [ "$CONFIG_MODULES" != "y" ]; then |
|---|
| 454 |
define_bool "$2" "n" |
|---|
| 455 |
else |
|---|
| 456 |
set_x_info "$2" "n" |
|---|
| 457 |
|
|---|
| 458 |
case $x in |
|---|
| 459 |
y|m) flag='M' ;; |
|---|
| 460 |
*) flag=' ' ;; |
|---|
| 461 |
esac |
|---|
| 462 |
|
|---|
| 463 |
echo -ne "'$2' '<$flag> $1$info' " >>MCmenu |
|---|
| 464 |
|
|---|
| 465 |
echo -e "function $2 () { l_mod_bool '$2' \"\$1\" ;}" >>MCradiolists |
|---|
| 466 |
fi |
|---|
| 467 |
} |
|---|
| 468 |
|
|---|
| 469 |
# |
|---|
| 470 |
# Same as l_bool() except options are (Module/No) |
|---|
| 471 |
# |
|---|
| 472 |
function l_mod_bool() { |
|---|
| 473 |
if [ -n "$2" ] |
|---|
| 474 |
then |
|---|
| 475 |
case "$2" in |
|---|
| 476 |
y) echo -en "\007" |
|---|
| 477 |
${DIALOG} --backtitle "$backtitle" \ |
|---|
| 478 |
--infobox "\ |
|---|
| 479 |
This feature depends on another which has been configured as a module. \ |
|---|
| 480 |
As a result, this feature will be built as a module." 4 70 |
|---|
| 481 |
sleep 5 |
|---|
| 482 |
eval $1=m ;; |
|---|
| 483 |
m) eval $1=m ;; |
|---|
| 484 |
c) eval x=\$$1 |
|---|
| 485 |
case $x in |
|---|
| 486 |
m) eval $1=n ;; |
|---|
| 487 |
n) eval $1=m ;; |
|---|
| 488 |
*) eval $1=m ;; |
|---|
| 489 |
esac ;; |
|---|
| 490 |
*) eval $1=n ;; |
|---|
| 491 |
esac |
|---|
| 492 |
else |
|---|
| 493 |
echo -ne "\007" |
|---|
| 494 |
fi |
|---|
| 495 |
} |
|---|
| 496 |
|
|---|
| 497 |
# |
|---|
| 498 |
# Handle a tristate (Yes/No/Module) option. |
|---|
| 499 |
# |
|---|
| 500 |
function l_tristate () { |
|---|
| 501 |
if [ -n "$2" ] |
|---|
| 502 |
then |
|---|
| 503 |
eval x=\$$1 |
|---|
| 504 |
|
|---|
| 505 |
case "$2" in |
|---|
| 506 |
y) eval $1=y ;; |
|---|
| 507 |
m) eval $1=m ;; |
|---|
| 508 |
c) eval x=\$$1 |
|---|
| 509 |
case $x in |
|---|
| 510 |
y) eval $1=n ;; |
|---|
| 511 |
n) eval $1=m ;; |
|---|
| 512 |
m) eval $1=y ;; |
|---|
| 513 |
*) eval $1=y ;; |
|---|
| 514 |
esac ;; |
|---|
| 515 |
*) eval $1=n ;; |
|---|
| 516 |
esac |
|---|
| 517 |
else |
|---|
| 518 |
echo -ne "\007" |
|---|
| 519 |
fi |
|---|
| 520 |
} |
|---|
| 521 |
|
|---|
| 522 |
# |
|---|
| 523 |
# Create a dialog for entering an integer into a kernel option. |
|---|
| 524 |
# |
|---|
| 525 |
function l_int () { |
|---|
| 526 |
while true |
|---|
| 527 |
do |
|---|
| 528 |
if $DIALOG --title "$1" \ |
|---|
| 529 |
--backtitle "$backtitle" \ |
|---|
| 530 |
--inputbox "$inputbox_instructions_int" \ |
|---|
| 531 |
10 75 "$4" 2>MCdialog.out |
|---|
| 532 |
then |
|---|
| 533 |
answer="`cat MCdialog.out`" |
|---|
| 534 |
answer="${answer:-$3}" |
|---|
| 535 |
|
|---|
| 536 |
# Semantics of + and ? in GNU expr changed, so |
|---|
| 537 |
# we avoid them: |
|---|
| 538 |
if expr "$answer" : '0$' '|' "$answer" : '[1-9][0-9]*$' '|' "$answer" : '-[1-9][0-9]*$' >/dev/null |
|---|
| 539 |
then |
|---|
| 540 |
eval $2=\"$answer\" |
|---|
| 541 |
else |
|---|
| 542 |
eval $2=\"$3\" |
|---|
| 543 |
echo -en "\007" |
|---|
| 544 |
${DIALOG} --backtitle "$backtitle" \ |
|---|
| 545 |
--infobox "You have made an invalid entry." 3 43 |
|---|
| 546 |
sleep 2 |
|---|
| 547 |
fi |
|---|
| 548 |
|
|---|
| 549 |
break |
|---|
| 550 |
fi |
|---|
| 551 |
|
|---|
| 552 |
help "$2" "$1" |
|---|
| 553 |
done |
|---|
| 554 |
} |
|---|
| 555 |
|
|---|
| 556 |
# |
|---|
| 557 |
# Create a dialog for entering a hexadecimal into a kernel option. |
|---|
| 558 |
# |
|---|
| 559 |
function l_hex () { |
|---|
| 560 |
while true |
|---|
| 561 |
do |
|---|
| 562 |
if $DIALOG --title "$1" \ |
|---|
| 563 |
--backtitle "$backtitle" \ |
|---|
| 564 |
--inputbox "$inputbox_instructions_hex" \ |
|---|
| 565 |
10 75 "$4" 2>MCdialog.out |
|---|
| 566 |
then |
|---|
| 567 |
answer="`cat MCdialog.out`" |
|---|
| 568 |
answer="${answer:-$3}" |
|---|
| 569 |
answer="${answer##*[x,X]}" |
|---|
| 570 |
|
|---|
| 571 |
if expr "$answer" : '[0-9a-fA-F][0-9a-fA-F]*$' >/dev/null |
|---|
| 572 |
then |
|---|
| 573 |
eval $2=\"$answer\" |
|---|
| 574 |
else |
|---|
| 575 |
eval $2=\"$3\" |
|---|
| 576 |
echo -en "\007" |
|---|
| 577 |
${DIALOG} --backtitle "$backtitle" \ |
|---|
| 578 |
--infobox "You have made an invalid entry." 3 43 |
|---|
| 579 |
sleep 2 |
|---|
| 580 |
fi |
|---|
| 581 |
|
|---|
| 582 |
break |
|---|
| 583 |
fi |
|---|
| 584 |
|
|---|
| 585 |
help "$2" "$1" |
|---|
| 586 |
done |
|---|
| 587 |
} |
|---|
| 588 |
|
|---|
| 589 |
# |
|---|
| 590 |
# Create a dialog for entering a string into a kernel option. |
|---|
| 591 |
# |
|---|
| 592 |
function l_string () { |
|---|
| 593 |
while true |
|---|
| 594 |
do |
|---|
| 595 |
if $DIALOG --title "$1" \ |
|---|
| 596 |
--backtitle "$backtitle" \ |
|---|
| 597 |
--inputbox "$inputbox_instructions_string" \ |
|---|
| 598 |
10 75 "$4" 2>MCdialog.out |
|---|
| 599 |
then |
|---|
| 600 |
answer="`cat MCdialog.out`" |
|---|
| 601 |
answer="${answer:-$3}" |
|---|
| 602 |
|
|---|
| 603 |
# |
|---|
| 604 |
# Someone may add a nice check for the entered |
|---|
| 605 |
# string here... |
|---|
| 606 |
# |
|---|
| 607 |
eval $2=\"$answer\" |
|---|
| 608 |
|
|---|
| 609 |
break |
|---|
| 610 |
fi |
|---|
| 611 |
|
|---|
| 612 |
help "$2" "$1" |
|---|
| 613 |
done |
|---|
| 614 |
} |
|---|
| 615 |
|
|---|
| 616 |
|
|---|
| 617 |
# |
|---|
| 618 |
# Handle a one-of-many choice list. |
|---|
| 619 |
# |
|---|
| 620 |
function l_choice () { |
|---|
| 621 |
# |
|---|
| 622 |
# Need to remember params cause they're gonna get reset. |
|---|
| 623 |
# |
|---|
| 624 |
title="$1" |
|---|
| 625 |
choices="$2" |
|---|
| 626 |
current="$3" |
|---|
| 627 |
chosen= |
|---|
| 628 |
|
|---|
| 629 |
# |
|---|
| 630 |
# Scan current value of choices and set radiolist switches. |
|---|
| 631 |
# |
|---|
| 632 |
list= |
|---|
| 633 |
set -- $choices |
|---|
| 634 |
firstchoice=$2 |
|---|
| 635 |
while [ -n "$2" ] |
|---|
| 636 |
do |
|---|
| 637 |
case "$1" in |
|---|
| 638 |
"$current"*) if [ -z "$chosen" ]; then |
|---|
| 639 |
list="$list $2 $1 ON " |
|---|
| 640 |
chosen=1 |
|---|
| 641 |
else |
|---|
| 642 |
list="$list $2 $1 OFF " |
|---|
| 643 |
fi ;; |
|---|
| 644 |
*) list="$list $2 $1 OFF " ;; |
|---|
| 645 |
esac |
|---|
| 646 |
|
|---|
| 647 |
shift ; shift |
|---|
| 648 |
done |
|---|
| 649 |
|
|---|
| 650 |
while true |
|---|
| 651 |
do |
|---|
| 652 |
if $DIALOG --title "$title" \ |
|---|
| 653 |
--backtitle "$backtitle" \ |
|---|
| 654 |
--radiolist "$radiolist_instructions" \ |
|---|
| 655 |
15 70 6 $list 2>MCdialog.out |
|---|
| 656 |
then |
|---|
| 657 |
choice=`cat MCdialog.out` |
|---|
| 658 |
break |
|---|
| 659 |
fi |
|---|
| 660 |
|
|---|
| 661 |
help "$firstchoice" "$title" |
|---|
| 662 |
done |
|---|
| 663 |
|
|---|
| 664 |
# |
|---|
| 665 |
# Now set the boolean value of each option based on |
|---|
| 666 |
# the selection made from the radiolist. |
|---|
| 667 |
# |
|---|
| 668 |
set -- $choices |
|---|
| 669 |
while [ -n "$2" ] |
|---|
| 670 |
do |
|---|
| 671 |
if [ "$2" = "$choice" ] |
|---|
| 672 |
then |
|---|
| 673 |
eval $2=\"y\" |
|---|
| 674 |
else |
|---|
| 675 |
eval $2=\"n\" |
|---|
| 676 |
fi |
|---|
| 677 |
|
|---|
| 678 |
shift ; shift |
|---|
| 679 |
done |
|---|
| 680 |
} |
|---|
| 681 |
|
|---|
| 682 |
# |
|---|
| 683 |
# Call awk, and watch for error codes, etc. |
|---|
| 684 |
# |
|---|
| 685 |
function callawk () { |
|---|
| 686 |
awk "$1" || { echo "Awk died with error code $?. Giving up."; exit 1; } |
|---|
| 687 |
} |
|---|
| 688 |
|
|---|
| 689 |
# |
|---|
| 690 |
# A faster awk based recursive parser. (I hope) |
|---|
| 691 |
# |
|---|
| 692 |
function parser1 () { |
|---|
| 693 |
callawk ' |
|---|
| 694 |
BEGIN { |
|---|
| 695 |
menu_no = 0 |
|---|
| 696 |
comment_is_option = 0 |
|---|
| 697 |
parser("'$CONFIG_IN'","MCmenu0") |
|---|
| 698 |
} |
|---|
| 699 |
|
|---|
| 700 |
function parser(ifile,menu) { |
|---|
| 701 |
|
|---|
| 702 |
while (getline <ifile) { |
|---|
| 703 |
if ($1 == "mainmenu_option") { |
|---|
| 704 |
comment_is_option = "1" |
|---|
| 705 |
} |
|---|
| 706 |
else if ($1 == "comment" && comment_is_option == "1") { |
|---|
| 707 |
comment_is_option= "0" |
|---|
| 708 |
sub($1,"",$0) |
|---|
| 709 |
++menu_no |
|---|
| 710 |
|
|---|
| 711 |
printf("submenu %s MCmenu%s\n", $0, menu_no) >>menu |
|---|
| 712 |
|
|---|
| 713 |
newmenu = sprintf("MCmenu%d", menu_no); |
|---|
| 714 |
printf( "function MCmenu%s () {\n"\ |
|---|
| 715 |
"default=$1\n"\ |
|---|
| 716 |
"menu_name %s\n",\ |
|---|
| 717 |
menu_no, $0) >newmenu |
|---|
| 718 |
|
|---|
| 719 |
parser(ifile, newmenu) |
|---|
| 720 |
} |
|---|
| 721 |
else if ($0 ~ /^#|\$MAKE|mainmenu_name/) { |
|---|
| 722 |
printf("") >>menu |
|---|
| 723 |
} |
|---|
| 724 |
else if ($1 ~ "endmenu") { |
|---|
| 725 |
printf("}\n") >>menu |
|---|
| 726 |
return |
|---|
| 727 |
} |
|---|
| 728 |
else if ($1 == "source") { |
|---|
| 729 |
parser($2,menu) |
|---|
| 730 |
} |
|---|
| 731 |
else { |
|---|
| 732 |
print >>menu |
|---|
| 733 |
} |
|---|
| 734 |
} |
|---|
| 735 |
}' |
|---|
| 736 |
} |
|---|
| 737 |
|
|---|
| 738 |
# |
|---|
| 739 |
# Secondary parser for single menu mode. |
|---|
| 740 |
# |
|---|
| 741 |
function parser2 () { |
|---|
| 742 |
callawk ' |
|---|
| 743 |
BEGIN { |
|---|
| 744 |
parser("'$CONFIG_IN'","MCmenu0") |
|---|
| 745 |
} |
|---|
| 746 |
|
|---|
| 747 |
function parser(ifile,menu) { |
|---|
| 748 |
|
|---|
| 749 |
while (getline <ifile) { |
|---|
| 750 |
if ($0 ~ /^#|$MAKE|mainmenu_name/) { |
|---|
| 751 |
printf("") >>menu |
|---|
| 752 |
} |
|---|
| 753 |
else if ($1 ~ /mainmenu_option|endmenu/) { |
|---|
| 754 |
printf("") >>menu |
|---|
| 755 |
} |
|---|
| 756 |
else if ($1 == "source") { |
|---|
| 757 |
parser($2,menu) |
|---|
| 758 |
} |
|---|
| 759 |
else { |
|---|
| 760 |
print >>menu |
|---|
| 761 |
} |
|---|
| 762 |
} |
|---|
| 763 |
}' |
|---|
| 764 |
} |
|---|
| 765 |
|
|---|
| 766 |
# |
|---|
| 767 |
# Parse all the config.in files into mini scripts. |
|---|
| 768 |
# |
|---|
| 769 |
function parse_config_files () { |
|---|
| 770 |
rm -f MCmenu* |
|---|
| 771 |
|
|---|
| 772 |
echo "function MCmenu0 () {" >MCmenu0 |
|---|
| 773 |
echo 'default=$1' >>MCmenu0 |
|---|
| 774 |
echo "menu_name 'Main Menu'" >>MCmenu0 |
|---|
| 775 |
|
|---|
| 776 |
if [ "_$single_menu_mode" = "_TRUE" ] |
|---|
| 777 |
then |
|---|
| 778 |
parser2 |
|---|
| 779 |
else |
|---|
| 780 |
parser1 |
|---|
| 781 |
fi |
|---|
| 782 |
|
|---|
| 783 |
echo "comment ''" >>MCmenu0 |
|---|
| 784 |
echo "g_alt_config" >>MCmenu0 |
|---|
| 785 |
echo "s_alt_config" >>MCmenu0 |
|---|
| 786 |
|
|---|
| 787 |
echo "}" >>MCmenu0 |
|---|
| 788 |
|
|---|
| 789 |
# |
|---|
| 790 |
# These mini scripts must be sourced into the current |
|---|
| 791 |
# environment in order for all of this to work. Leaving |
|---|
| 792 |
# them on the disk as executables screws up the recursion |
|---|
| 793 |
# in activate_menu(), among other things. Once they are |
|---|
| 794 |
# sourced we can discard them. |
|---|
| 795 |
# |
|---|
| 796 |
for i in MCmenu* |
|---|
| 797 |
do |
|---|
| 798 |
echo -n "." |
|---|
| 799 |
source ./$i |
|---|
| 800 |
done |
|---|
| 801 |
rm -f MCmenu* |
|---|
| 802 |
} |
|---|
| 803 |
|
|---|
| 804 |
# |
|---|
| 805 |
# This is the menu tree's bootstrap. |
|---|
| 806 |
# |
|---|
| 807 |
# Executes the parsed menus on demand and creates a set of functions, |
|---|
| 808 |
# one per configuration option. These functions will in turn execute |
|---|
| 809 |
# dialog commands or recursively call other menus. |
|---|
| 810 |
# |
|---|
| 811 |
function activate_menu () { |
|---|
| 812 |
rm -f lxdialog.scrltmp |
|---|
| 813 |
while true |
|---|
| 814 |
do |
|---|
| 815 |
comment_ctr=0 #So comment lines get unique tags |
|---|
| 816 |
|
|---|
| 817 |
$1 "$default" 2> MCerror #Create the lxdialog menu & functions |
|---|
| 818 |
|
|---|
| 819 |
if [ "$?" != "0" ] |
|---|
| 820 |
then |
|---|
| 821 |
clear |
|---|
| 822 |
cat <<EOM |
|---|
| 823 |
|
|---|
| 824 |
Menuconfig has encountered a possible error in one of the vlc's |
|---|
| 825 |
configuration files and is unable to continue. Here is the error |
|---|
| 826 |
report: |
|---|
| 827 |
|
|---|
| 828 |
EOM |
|---|
| 829 |
sed 's/^/ Q> /' MCerror |
|---|
| 830 |
cat <<EOM |
|---|
| 831 |
|
|---|
| 832 |
Please report this to the maintainer <asmax@videolan.org>. |
|---|
| 833 |
|
|---|
| 834 |
Please indicate the vlc version you are trying to configure and |
|---|
| 835 |
which menu you were trying to enter when this error occurred. |
|---|
| 836 |
|
|---|
| 837 |
EOM |
|---|
| 838 |
cleanup |
|---|
| 839 |
exit 1 |
|---|
| 840 |
fi |
|---|
| 841 |
rm -f MCerror |
|---|
| 842 |
|
|---|
| 843 |
. ./MCradiolists #Source the menu's functions |
|---|
| 844 |
|
|---|
| 845 |
. ./MCmenu 2>MCdialog.out #Activate the lxdialog menu |
|---|
| 846 |
ret=$? |
|---|
| 847 |
|
|---|
| 848 |
read selection <MCdialog.out |
|---|
| 849 |
|
|---|
| 850 |
case "$ret" in |
|---|
| 851 |
0|3|4|5|6) |
|---|
| 852 |
defaults="$selection$defaults" #pseudo stack |
|---|
| 853 |
case "$ret" in |
|---|
| 854 |
0) eval $selection ;; |
|---|
| 855 |
3) eval $selection y ;; |
|---|
| 856 |
4) eval $selection n ;; |
|---|
| 857 |
5) eval $selection m ;; |
|---|
| 858 |
6) eval $selection c ;; |
|---|
| 859 |
esac |
|---|
| 860 |
default="${defaults%%*}" defaults="${defaults#*}" |
|---|
| 861 |
;; |
|---|
| 862 |
2) |
|---|
| 863 |
default="${selection%%\ *}" |
|---|
| 864 |
|
|---|
| 865 |
case "$selection" in |
|---|
| 866 |
*"-->"*|*"alt_config"*) |
|---|
| 867 |
show_readme ;; |
|---|
| 868 |
*) |
|---|
| 869 |
eval help $selection ;; |
|---|
| 870 |
esac |
|---|
| 871 |
;; |
|---|
| 872 |
255|1) |
|---|
| 873 |
break |
|---|
| 874 |
;; |
|---|
| 875 |
139) |
|---|
| 876 |
stty sane |
|---|
| 877 |
clear |
|---|
| 878 |
cat <<EOM |
|---|
| 879 |
|
|---|
| 880 |
There seems to be a problem with the lxdialog companion utility which is |
|---|
| 881 |
built prior to running Menuconfig. Usually this is an indicator that you |
|---|
| 882 |
have upgraded/downgraded your ncurses libraries and did not remove the |
|---|
| 883 |
old ncurses header file(s) in /usr/include or /usr/include/ncurses. |
|---|
| 884 |
|
|---|
| 885 |
It is VERY important that you have only one set of ncurses header files |
|---|
| 886 |
and that those files are properly version matched to the ncurses libraries |
|---|
| 887 |
installed on your machine. |
|---|
| 888 |
|
|---|
| 889 |
You may also need to rebuild lxdialog. This can be done by moving to |
|---|
| 890 |
the /usr/src/linux/scripts/lxdialog directory and issuing the |
|---|
| 891 |
"make clean all" command. |
|---|
| 892 |
|
|---|
| 893 |
If you have verified that your ncurses install is correct, you may email |
|---|
| 894 |
the maintainer <asmax@videolan.org>. |
|---|
| 895 |
|
|---|
| 896 |
EOM |
|---|
| 897 |
cleanup |
|---|
| 898 |
exit 139 |
|---|
| 899 |
;; |
|---|
| 900 |
esac |
|---|
| 901 |
done |
|---|
| 902 |
} |
|---|
| 903 |
|
|---|
| 904 |
# |
|---|
| 905 |
# Create a menu item to load an alternate configuration file. |
|---|
| 906 |
# |
|---|
| 907 |
g_alt_config () { |
|---|
| 908 |
echo -n "get_alt_config 'Load an Alternate Configuration File' "\ |
|---|
| 909 |
>>MCmenu |
|---|
| 910 |
} |
|---|
| 911 |
|
|---|
| 912 |
# |
|---|
| 913 |
# Get alternate config file name and load the |
|---|
| 914 |
# configuration from it. |
|---|
| 915 |
# |
|---|
| 916 |
get_alt_config () { |
|---|
| 917 |
set -f ## Switch file expansion OFF |
|---|
| 918 |
|
|---|
| 919 |
while true |
|---|
| 920 |
do |
|---|
| 921 |
ALT_CONFIG="${ALT_CONFIG:-$DEFAULTS}" |
|---|
| 922 |
|
|---|
| 923 |
$DIALOG --backtitle "$backtitle" \ |
|---|
| 924 |
--inputbox "\ |
|---|
| 925 |
Enter the name of the configuration file you wish to load. \ |
|---|
| 926 |
Accept the name shown to restore the configuration you \ |
|---|
| 927 |
last retrieved. Leave blank to abort."\ |
|---|
| 928 |
11 55 "$ALT_CONFIG" 2>MCdialog.out |
|---|
| 929 |
|
|---|
| 930 |
if [ "$?" = "0" ] |
|---|
| 931 |
then |
|---|
| 932 |
ALT_CONFIG=`cat MCdialog.out` |
|---|
| 933 |
|
|---|
| 934 |
[ "_" = "_$ALT_CONFIG" ] && break |
|---|
| 935 |
|
|---|
| 936 |
if eval [ -r \"$ALT_CONFIG\" ] |
|---|
| 937 |
then |
|---|
| 938 |
eval load_config_file \"$ALT_CONFIG\" |
|---|
| 939 |
break |
|---|
| 940 |
else |
|---|
| 941 |
echo -ne "\007" |
|---|
| 942 |
$DIALOG --backtitle "$backtitle" \ |
|---|
| 943 |
--infobox "File does not exist!" 3 38 |
|---|
| 944 |
sleep 2 |
|---|
| 945 |
fi |
|---|
| 946 |
else |
|---|
| 947 |
cat <<EOM >help.out |
|---|
| 948 |
|
|---|
| 949 |
For various reasons, one may wish to keep several different vlc |
|---|
| 950 |
configurations available on a single machine. |
|---|
| 951 |
|
|---|
| 952 |
If you have saved a previous configuration in a file other than the |
|---|
| 953 |
vlc's default, entering the name of the file here will allow you |
|---|
| 954 |
to modify that configuration. |
|---|
| 955 |
|
|---|
| 956 |
If you are uncertain, then you have probably never used alternate |
|---|
| 957 |
configuration files. You should therefor leave this blank to abort. |
|---|
| 958 |
|
|---|
| 959 |
EOM |
|---|
| 960 |
$DIALOG --backtitle "$backtitle"\ |
|---|
| 961 |
--title "Load Alternate Configuration"\ |
|---|
| 962 |
--textbox help.out $ROWS $COLS |
|---|
| 963 |
fi |
|---|
| 964 |
done |
|---|
| 965 |
|
|---|
| 966 |
set +f ## Switch file expansion ON |
|---|
| 967 |
rm -f help.out MCdialog.out |
|---|
| 968 |
} |
|---|
| 969 |
|
|---|
| 970 |
# |
|---|
| 971 |
# Create a menu item to store an alternate config file. |
|---|
| 972 |
# |
|---|
| 973 |
s_alt_config () { |
|---|
| 974 |
echo -n "save_alt_config 'Save Configuration to an Alternate File' "\ |
|---|
| 975 |
>>MCmenu |
|---|
| 976 |
} |
|---|
| 977 |
|
|---|
| 978 |
# |
|---|
| 979 |
# Get an alternate config file name and save the current |
|---|
| 980 |
# configuration to it. |
|---|
| 981 |
# |
|---|
| 982 |
save_alt_config () { |
|---|
| 983 |
set -f ## Switch file expansion OFF |
|---|
| 984 |
|
|---|
| 985 |
while true |
|---|
| 986 |
do |
|---|
| 987 |
$DIALOG --backtitle "$backtitle" \ |
|---|
| 988 |
--inputbox "\ |
|---|
| 989 |
Enter a filename to which this configuration should be saved \ |
|---|
| 990 |
as an alternate. Leave blank to abort."\ |
|---|
| 991 |
10 55 "$ALT_CONFIG" 2>MCdialog.out |
|---|
| 992 |
|
|---|
| 993 |
if [ "$?" = "0" ] |
|---|
| 994 |
then |
|---|
| 995 |
ALT_CONFIG=`cat MCdialog.out` |
|---|
| 996 |
|
|---|
| 997 |
[ "_" = "_$ALT_CONFIG" ] && break |
|---|
| 998 |
|
|---|
| 999 |
if eval touch $ALT_CONFIG 2>/dev/null |
|---|
| 1000 |
then |
|---|
| 1001 |
eval save_configuration $ALT_CONFIG |
|---|
| 1002 |
load_functions ## RELOAD |
|---|
| 1003 |
break |
|---|
| 1004 |
else |
|---|
| 1005 |
echo -ne "\007" |
|---|
| 1006 |
$DIALOG --backtitle "$backtitle" \ |
|---|
| 1007 |
--infobox "Can't create file! Probably a nonexistent directory." 3 60 |
|---|
| 1008 |
sleep 2 |
|---|
| 1009 |
fi |
|---|
| 1010 |
else |
|---|
| 1011 |
cat <<EOM >help.out |
|---|
| 1012 |
|
|---|
| 1013 |
For various reasons, one may wish to keep different vlc |
|---|
| 1014 |
configurations available on a single machine. |
|---|
| 1015 |
|
|---|
| 1016 |
Entering a file name here will allow you to later retrieve, modify |
|---|
| 1017 |
and use the current configuration as an alternate to whatever |
|---|
| 1018 |
configuration options you have selected at that time. |
|---|
| 1019 |
|
|---|
| 1020 |
If you are uncertain what all this means then you should probably |
|---|
| 1021 |
leave this blank. |
|---|
| 1022 |
EOM |
|---|
| 1023 |
$DIALOG --backtitle "$backtitle"\ |
|---|
| 1024 |
--title "Save Alternate Configuration"\ |
|---|
| 1025 |
--textbox help.out $ROWS $COLS |
|---|
| 1026 |
fi |
|---|
| 1027 |
done |
|---|
| 1028 |
|
|---|
| 1029 |
set +f ## Switch file expansion ON |
|---|
| 1030 |
rm -f help.out MCdialog.out |
|---|
| 1031 |
} |
|---|
| 1032 |
|
|---|
| 1033 |
# |
|---|
| 1034 |
# Load config options from a file. |
|---|
| 1035 |
# Converts all "# OPTION is not set" lines to "OPTION=n" lines |
|---|
| 1036 |
# |
|---|
| 1037 |
function load_config_file () { |
|---|
| 1038 |
awk ' |
|---|
| 1039 |
/# .* is not set.*/ { printf("%s=n\n", $2) } |
|---|
| 1040 |
! /# .* is not set.*/ { print } |
|---|
| 1041 |
' $1 >.tmpconfig |
|---|
| 1042 |
|
|---|
| 1043 |
source ./.tmpconfig |
|---|
| 1044 |
rm -f .tmpconfig |
|---|
| 1045 |
} |
|---|
| 1046 |
|
|---|
| 1047 |
# |
|---|
| 1048 |
# Just what it says. |
|---|
| 1049 |
# |
|---|
| 1050 |
save_configuration () { |
|---|
| 1051 |
echo |
|---|
| 1052 |
echo -n "Saving your vlc configuration." |
|---|
| 1053 |
|
|---|
| 1054 |
# |
|---|
| 1055 |
# Now, let's redefine the configuration functions for final |
|---|
| 1056 |
# output to the config files. |
|---|
| 1057 |
# |
|---|
| 1058 |
# Nested function definitions, YIPEE! |
|---|
| 1059 |
# |
|---|
| 1060 |
function bool () { |
|---|
| 1061 |
set_x_info "$2" "n" |
|---|
| 1062 |
eval define_bool \"$2\" \"$x\" |
|---|
| 1063 |
} |
|---|
| 1064 |
|
|---|
| 1065 |
function tristate () { |
|---|
| 1066 |
set_x_info "$2" "n" |
|---|
| 1067 |
eval define_tristate \"$2\" \"$x\" |
|---|
| 1068 |
} |
|---|
| 1069 |
|
|---|
| 1070 |
function dep_tristate () { |
|---|
| 1071 |
set_x_info "$2" "n" |
|---|
| 1072 |
var="$2" |
|---|
| 1073 |
shift 2 |
|---|
| 1074 |
while [ $# -gt 0 ]; do |
|---|
| 1075 |
if [ "$1" = y ]; then |
|---|
| 1076 |
shift |
|---|
| 1077 |
elif [ "$1" = m -a "$x" != n ]; then |
|---|
| 1078 |
x=m; shift |
|---|
| 1079 |
else |
|---|
| 1080 |
x=n; shift $# |
|---|
| 1081 |
fi |
|---|
| 1082 |
done |
|---|
| 1083 |
define_tristate "$var" "$x" |
|---|
| 1084 |
} |
|---|
| 1085 |
|
|---|
| 1086 |
function dep_bool () { |
|---|
| 1087 |
set_x_info "$2" "n" |
|---|
| 1088 |
var="$2" |
|---|
| 1089 |
shift 2 |
|---|
| 1090 |
while [ $# -gt 0 ]; do |
|---|
| 1091 |
if [ "$1" = y ]; then |
|---|
| 1092 |
  |
|---|