diff --git a/update-kernel b/update-kernel index ff5b1c6..9fa60c2 100755 --- a/update-kernel +++ b/update-kernel @@ -541,6 +541,7 @@ fi # actual selection process, appends to modules_to_install variable sel_prev= modules_to_show= +declare -i modules=0 for modname in $(echo "$ALLNAMES" | sort -u); do module=$(echo "$ALLMODULES" | grep "^[[:space:]]*kernel-modules-$modname-$kernel_flavour#" | sort -r -u -V | head -1) module_pkgname="${module%%#*}" @@ -574,6 +575,7 @@ for modname in $(echo "$ALLNAMES" | sort -u); do sel_prev=$sel_mode modules_to_show+=" $modname" modules_to_install+=" $module" + modules+=1 done [ -n "$modules_to_show" ] && { echo "The following extra modules will be installed:" @@ -592,24 +594,31 @@ if [ -z "$needwork" ]; then exit 0 fi -# ask user -echo -n "Try to install new kernel ${BRIGHT}kernel-image-$kernel_flavour-$userkmaxver${NORM}" -[ -n "$modules_to_show" ] && echo -n " and update its modules" -echo -n " [Y/n]? " -if [ -n "$force" ]; then - echo "yes" -else - while true; do - read -r || { echo "Aborting"; exit 1; } - shopt -s nocasematch - case "$REPLY" in - n|no|0|q) exit 0 ;; - y|ye|yes|'') break ;; - *) ;; - esac - echo -n "[Y/n] " - shopt -u nocasematch - done +if [ -z "$dryrun" ]; then + # ask user + [ -n "$download_only" ] && action="download" || action="${reinstall:+re}install" + echo -n "Try to $action" + echo -n " kernel ${BRIGHT}kernel-image-$kernel_flavour-$userkmaxver${NORM}" + if [ -n "$modules_to_show" ]; then + echo -n " and $modules module$([ "$modules" -gt 1 ] && echo s)" + fi + echo -n " [Y/n]? " + if [ -n "$force" ]; then + echo "yes (forced)" + else + while true; do + read -r || { echo "Aborting"; exit 1; } + shopt -s nocasematch + case "$REPLY" in + n|no|0|q) exit 0 ;; + y|ye|yes|'') break ;; + *) ;; + esac + echo -n "[Y/n] " + shopt -u nocasematch + done + fi + unset action fi # now install everything at once