summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2009-07-25 13:29:43 +0200
committerDieter Plaetinck <dieter@plaetinck.be>2009-07-25 13:29:43 +0200
commit14fc7d28f64debe5e466c94df83878243df29f9c (patch)
tree4c20375485c1f4df29a1c5b7f3c60e419db4140f /src/core
parenta3dff558013e516ccddbfddc47adbbfddd8e7e82 (diff)
make the $ret variable local everywhere
Diffstat (limited to 'src/core')
-rw-r--r--src/core/libs/lib-blockdevices-filesystems.sh2
-rwxr-xr-xsrc/core/libs/lib-flowcontrol.sh6
-rw-r--r--src/core/libs/lib-ui-interactive.sh2
-rw-r--r--src/core/libs/lib-ui.sh14
-rw-r--r--src/core/procedures/interactive4
5 files changed, 14 insertions, 14 deletions
diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh
index d46031a..d971db0 100644
--- a/src/core/libs/lib-blockdevices-filesystems.sh
+++ b/src/core/libs/lib-blockdevices-filesystems.sh
@@ -659,7 +659,7 @@ process_filesystem ()
fi
[ -z "$fs_label" ] && [ "$fs_type" = lvm-vg -o "$fs_type" = lvm-pv ] && fs_label=default #TODO. implement the incrementing numbers label for lvm vg's and lv's
- ret=0
+ local ret=0
#TODO: health checks on $fs_params etc
case ${fs_type} in #TODO: implement label, opts etc decently
xfs) mkfs.xfs -f $part $opts >$LOG 2>&1; ret=$? ;;
diff --git a/src/core/libs/lib-flowcontrol.sh b/src/core/libs/lib-flowcontrol.sh
index 64e7f2b..078a33d 100755
--- a/src/core/libs/lib-flowcontrol.sh
+++ b/src/core/libs/lib-flowcontrol.sh
@@ -100,7 +100,7 @@ execute ()
then
shift 2
$object "$@"
- ret=$?
+ local ret=$?
exit_var=exit_$object
read $exit_var <<< $ret # maintain exit status of each worker
else
@@ -128,7 +128,7 @@ execute ()
debug 'MAIN' "Loop iteration. \$worker_str: $worker_str"
execute worker $worker_str || read $exit_var <<< $? # assign last failing exit code to exit_phase_<phasename>, if any.
done
- ret=${!exit_var}
+ local ret=${!exit_var}
fi
debug 'MAIN' "Execute(): $object exit state was $ret"
@@ -183,7 +183,7 @@ show_report () #TODO: abstract UI method (cli/dia)
do
object=phase_$phase
exit_var=exit_$object
- ret=${!exit_var}
+ local ret=${!exit_var}
echo -n "Phase $phase: "
[ "$ret" = "0" ] && echo "Success" || echo "Failed"
eval phase_array=$(declare | grep -e "^${object}=" | cut -d"=" -f 2-)
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh
index e68c999..6dd8e71 100644
--- a/src/core/libs/lib-ui-interactive.sh
+++ b/src/core/libs/lib-ui-interactive.sh
@@ -155,7 +155,7 @@ interactive_time () {
interactive_prepare_disks ()
{
DONE=0
- ret=1 # 1 means unsuccessful. 0 for ok
+ local ret=1 # 1 means unsuccessful. 0 for ok
NEXTITEM=
DISK_CONFIG_TYPE=
[ "$BLOCK_ROLLBACK_USELESS" = "0" ] && show_warning "Rollback may be needed" "It seems you already went here. You should probably rollback previous changes before reformatting, otherwise stuff will probably fail"
diff --git a/src/core/libs/lib-ui.sh b/src/core/libs/lib-ui.sh
index cbd860c..c02b994 100644
--- a/src/core/libs/lib-ui.sh
+++ b/src/core/libs/lib-ui.sh
@@ -321,7 +321,7 @@ _dia_ask_checklist ()
shift 3
done
_dia_dialog --checklist "$str" 0 0 0 $list 2>$ANSWER
- ret=$?
+ local ret=$?
ANSWER_CHECKLIST=`cat $ANSWER`
debug 'UI' "_dia_ask_checklist: user checked ON: $ANSWER_CHECKLIST"
return $ret
@@ -354,7 +354,7 @@ _dia_ask_number ()
[ -n $3 -a $3 != '0' ] && str2="$str2 max $3"
[ -n "$str2" ] && str="$str ( $str2 )"
_dia_dialog --inputbox "$str" 0 0 $4 2>$ANSWER
- ret=$?
+ local ret=$?
ANSWER_NUMBER=`cat $ANSWER`
if [[ $ANSWER_NUMBER = *[^0-9]* ]] #TODO: handle exit state
then
@@ -393,7 +393,7 @@ _dia_ask_option ()
CANCEL_LABEL=Cancel
[ $TYPE == optional ] && CANCEL_LABEL='Skip'
_dia_dialog $DEFAULT --cancel-label $CANCEL_LABEL --colors --title " $DIA_MENU_TITLE " --menu "$DIA_MENU_TEXT $EXTRA_INFO" 0 0 0 "$@" 2>$ANSWER
- ret=$?
+ local ret=$?
ANSWER_OPTION=`cat $ANSWER`
debug 'UI' "dia_ask_option: ANSWER_OPTION: $ANSWER_OPTION, returncode (skip/cancel): $ret ($DIA_MENU_TITLE)"
[ $TYPE == required ] && return $ret
@@ -413,7 +413,7 @@ _dia_ask_password ()
fi
_dia_dialog --passwordbox "Enter your $type_l password" 8 65 "$2" 2>$ANSWER
- ret=$?
+ local ret=$?
[ -n "$type_u" ] && read ${type_u}_PASSWORD < $ANSWER
[ -z "$type_u" ] && read PASSWORD < $ANSWER
cat $ANSWER
@@ -426,7 +426,7 @@ _dia_ask_string ()
{
exitcode=${3:-1}
_dia_dialog --inputbox "$1" 0 0 "$2" 2>$ANSWER
- ret=$?
+ local ret=$?
ANSWER_STRING=`cat $ANSWER`
debug 'UI' "_dia_ask_string: user entered $ANSWER_STRING"
[ -z "$ANSWER_STRING" ] && return $exitcode
@@ -443,7 +443,7 @@ _dia_ask_yesno ()
# If $2 contains an explicit 'no' we set defaultno for yesno dialog
[ "$2" == "no" ] && default="--defaultno"
dialog $default --yesno "$str" $height 55 # returns 0 for yes, 1 for no
- ret=$?
+ local ret=$?
[ $ret -eq 0 ] && debug 'UI' "dia_ask_yesno: User picked YES"
[ $ret -gt 0 ] && debug 'UI' "dia_ask_yesno: User picked NO"
return $ret
@@ -562,7 +562,7 @@ _cli_ask_option ()
[ -n "$DEFAULT" ] && echo -n " > [ $DEFAULT ] "
[ -z "$DEFAULT" ] && echo -n " > "
read ANSWER_OPTION
- ret=0
+ local ret=0
[ -z "$ANSWER_OPTION" -a -n "$DEFAULT" ] && ANSWER_OPTION="$DEFAULT"
[ "$ANSWER_OPTION" == CANCEL ] && ret=1 && ANSWER_OPTION=
[ "$ANSWER_OPTION" == SKIP ] && ret=0 && ANSWER_OPTION=
diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive
index 61fe90e..f9f79d3 100644
--- a/src/core/procedures/interactive
+++ b/src/core/procedures/interactive
@@ -64,8 +64,8 @@ mainmenu()
"8" "Exit Install"
case $ANSWER_OPTION in
"1")
- execute worker select_source; ret=$?; [ $ret -eq 0 -a "$var_PKG_SOURCE_TYPE" = net ] && execute worker select_source_extras_menu
- [ $ret -eq 0 ] && execute worker runtime_packages && NEXTITEM=2 ;;
+ execute worker select_source; local ret=$?; [ $ret -eq 0 -a "$var_PKG_SOURCE_TYPE" = net ] && execute worker select_source_extras_menu
+ [ $ret -eq 0 ] && execute worker runtime_packages && NEXTITEM=2 ;;
"2")
execute worker set_clock && NEXTITEM=3 ;;