From 2cd5131e83ba364fa09d5633ad514ddefe684e8a Mon Sep 17 00:00:00 2001 From: Dave Woodfall Date: Sat, 20 Feb 2021 19:16:11 +0000 Subject: Fix new-config dialog --- files/core-functions.sh | 2 +- files/post-functions.sh | 65 +++++++++++++++++++++++++++++++------------------ 2 files changed, 42 insertions(+), 25 deletions(-) diff --git a/files/core-functions.sh b/files/core-functions.sh index 3fecfb3..224692f 100644 --- a/files/core-functions.sh +++ b/files/core-functions.sh @@ -821,7 +821,7 @@ function answer() { ANSWER="$DEFAULT_ANSWER" echo $DEFAULT_ANSWER else - read ANSWER + read -p "> " ANSWER fi } diff --git a/files/post-functions.sh b/files/post-functions.sh index 593c47b..9fd483a 100644 --- a/files/post-functions.sh +++ b/files/post-functions.sh @@ -133,39 +133,55 @@ looknew() { ONLY_NEW_DOTNEW="" fi - echo -e "\nSearching for NEW configuration files" - FILES=$(find ${ROOT}/etc ${ROOT}/var/yp ${ROOT}/usr/share/vim -name "*.new" ${ONLY_NEW_DOTNEW} \ + SIZE=$( stty size ) + ROWS=${SIZE% *} + LISTMAX=$(( ROWS - 10 )) + + printf "%s\n" "Searching for NEW configuration files..." + + FILES=$( find \ + ${ROOT}/etc \ + ${ROOT}/var/yp \ + ${ROOT}/usr/share/vim \ + -name "*.new" \ + ${ONLY_NEW_DOTNEW} \ -not -name "rc.inet1.conf.new" \ -not -name "group.new" \ -not -name "passwd.new" \ -not -name "shadow.new" \ - -not -name "gshadow.new" 2>/dev/null | sort 2>/dev/null) - if [ "$FILES" != "" ]; then - newcount=$(echo "$FILES" | wc -l) - echo -ne "\n\ -Some packages had new configuration files installed ($newcount new files):\n\n" + -not -name "gshadow.new" 2>/dev/null | + sort -V 2>/dev/null ) + + if [ -n "$FILES" ]; then + newcount=$( echo "$FILES" | wc -l ) - SIZE=$(stty size) - ROWS=${SIZE% *} - LISTMAX=$((ROWS-20)) + printf "%s %s\n\n" "Some packages had new configuration" \ + "files installed ($newcount new files):" if [ $newcount -le $LISTMAX ]; then - echo -e "$FILES" + echo "$FILES" else F=0 + N=0 for FN in $FILES; do - F=$((F+1)) - echo "$FN" + F=$(( F + 1 )) + N=$(( N + 1 )) + echo "$N $FN" - if [ $F -ge $LISTMAX ]; then + if [ $F -ge $(( ROWS - 5 )) ]; then F=0 - echo -ne "\nPress SPACE for more, ENTER to skip" - IFS=$'\n' read -rn 1 junk - echo -e "\n" + IFS=$( printf "\n" ) read -rn 1 \ + -p " +Press SPACE for more, ENTER to skip" junk + printf "\n" + tput -S <