update upstream to 9084a3cbc0a55422beea4a55b530c1f03a910617 feb 2024
[automated-distro-installer] / fai / config / class / 40-parse-profiles.sh
index 0fed6ee25c633e0d284ff5459874a11849033948..cb11c176f45a4c7f5474f41e81777e5ae2af69b3 100755 (executable)
@@ -2,7 +2,7 @@
 
 # parse *.profile and build a curses menu, so the user can select a profile
 #
-# (c) 2015 by Thomas Lange, lange@informatik.uni-koeln.de
+# (c) 2015 by Thomas Lange, lange@cs.uni-koeln.de
 # Universitaet zu Koeln
 
 if [ X$FAI_ACTION = Xinstall -o X$FAI_ACTION = Xdirinstall -o X$FAI_ACTION = X ]; then
@@ -14,6 +14,8 @@ fi
 [ "$flag_menu" ] || return 0
 
 out=$(tty)
+# save stdout and redirect stdout to tty
+exec 4>&1 > $out
 tempfile=$(mktemp)
 tempfile2=$(mktemp)
 trap "rm -f $tempfile $tempfile2" EXIT INT QUIT
@@ -147,8 +149,7 @@ while true; do
     dialog --clear --item-help --title "FAI - Fully Automatic Installation" --help-button \
        --default-item "$default" \
        --menu "\nSelect your FAI profile\n\nThe profile will define a list of classes,\nwhich are used by FAI.\n\n\n"\
-       15 70 0 "${par[@]}" 2> $tempfile  1> $out
-
+       15 70 0 "${par[@]}" 2> $tempfile
     _retval=$?
     case $_retval in
        0)
@@ -158,8 +159,10 @@ while true; do
            echo "No profile selected."
            break ;;
        2)
-           dialog --title "Description of all profiles" --textbox $tempfile2 0 0 1> $out;;
+           dialog --title "Description of all profiles" --textbox $tempfile2 0 0 ;;
     esac
 
 done
 unset par ardesc arshort arlong arclasses list tempfile tempfile2 _parsed _retval line
+
+exec 1>&4 # restore stdout