update-kernel: Improve informativeness of confirmation dialog
Confirmation is skipped on --dry-run this is like apt-get behaves. Link: https://bugzilla.altlinux.org/show_bug.cgi?id=49340#c2 Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
This commit is contained in:
parent
54a7f23677
commit
4abe66e3c5
@ -541,6 +541,7 @@ fi
|
|||||||
# actual selection process, appends to modules_to_install variable
|
# actual selection process, appends to modules_to_install variable
|
||||||
sel_prev=
|
sel_prev=
|
||||||
modules_to_show=
|
modules_to_show=
|
||||||
|
declare -i modules=0
|
||||||
for modname in $(echo "$ALLNAMES" | sort -u); do
|
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=$(echo "$ALLMODULES" | grep "^[[:space:]]*kernel-modules-$modname-$kernel_flavour#" | sort -r -u -V | head -1)
|
||||||
module_pkgname="${module%%#*}"
|
module_pkgname="${module%%#*}"
|
||||||
@ -574,6 +575,7 @@ for modname in $(echo "$ALLNAMES" | sort -u); do
|
|||||||
sel_prev=$sel_mode
|
sel_prev=$sel_mode
|
||||||
modules_to_show+=" $modname"
|
modules_to_show+=" $modname"
|
||||||
modules_to_install+=" $module"
|
modules_to_install+=" $module"
|
||||||
|
modules+=1
|
||||||
done
|
done
|
||||||
[ -n "$modules_to_show" ] && {
|
[ -n "$modules_to_show" ] && {
|
||||||
echo "The following extra modules will be installed:"
|
echo "The following extra modules will be installed:"
|
||||||
@ -592,24 +594,31 @@ if [ -z "$needwork" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ask user
|
if [ -z "$dryrun" ]; then
|
||||||
echo -n "Try to install new kernel ${BRIGHT}kernel-image-$kernel_flavour-$userkmaxver${NORM}"
|
# ask user
|
||||||
[ -n "$modules_to_show" ] && echo -n " and update its modules"
|
[ -n "$download_only" ] && action="download" || action="${reinstall:+re}install"
|
||||||
echo -n " [Y/n]? "
|
echo -n "Try to $action"
|
||||||
if [ -n "$force" ]; then
|
echo -n " kernel ${BRIGHT}kernel-image-$kernel_flavour-$userkmaxver${NORM}"
|
||||||
echo "yes"
|
if [ -n "$modules_to_show" ]; then
|
||||||
else
|
echo -n " and $modules module$([ "$modules" -gt 1 ] && echo s)"
|
||||||
while true; do
|
fi
|
||||||
read -r || { echo "Aborting"; exit 1; }
|
echo -n " [Y/n]? "
|
||||||
shopt -s nocasematch
|
if [ -n "$force" ]; then
|
||||||
case "$REPLY" in
|
echo "yes (forced)"
|
||||||
n|no|0|q) exit 0 ;;
|
else
|
||||||
y|ye|yes|'') break ;;
|
while true; do
|
||||||
*) ;;
|
read -r || { echo "Aborting"; exit 1; }
|
||||||
esac
|
shopt -s nocasematch
|
||||||
echo -n "[Y/n] "
|
case "$REPLY" in
|
||||||
shopt -u nocasematch
|
n|no|0|q) exit 0 ;;
|
||||||
done
|
y|ye|yes|'') break ;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
echo -n "[Y/n] "
|
||||||
|
shopt -u nocasematch
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
unset action
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# now install everything at once
|
# now install everything at once
|
||||||
|
Loading…
Reference in New Issue
Block a user