make list_packages() loop

Wrap list_packages()'s main dialog widget in a while loop so the user
can return to deletion selection after reading readmes. Also correct the
text in the widget (s/uninstall/remove./).
This commit is contained in:
slakmagik 2011-03-07 01:26:32 +00:00
parent c3eb9de996
commit 2adf86f041

View File

@ -450,30 +450,36 @@ list_packages() {
-printf "%P\n" 2> /dev/null | sort > $PKG_LIST -printf "%P\n" 2> /dev/null | sort > $PKG_LIST
if [[ -s $PKG_LIST ]]; then if [[ -s $PKG_LIST ]]; then
if [[ $DIAG ]]; then if [[ $DIAG ]]; then
sed 's/$/ "" OFF/' $PKG_LIST > $PKG_CHECKLIST while :; do
dialog --separate-output --title "Installed $REPO_NAME Packages" \ sed 's/$/ "" OFF/' $PKG_LIST > $PKG_CHECKLIST
--extra-button --extra-label "View READMEs" \ dialog --separate-output --title "Installed $REPO_NAME Packages" \
--checklist "Check any packages you wish to uninstall" \ --extra-button --extra-label "View READMEs" \
20 65 13 --file $PKG_CHECKLIST 2> $REMOVE_LIST --checklist "Check any packages you wish to remove." \
case $? in 20 65 13 --file $PKG_CHECKLIST 2> $REMOVE_LIST
0) case $? in
if [[ -s $REMOVE_LIST ]]; then 0)
sed 's/$/ "" ON/' $REMOVE_LIST > $CONFIRM_LIST if [[ -s $REMOVE_LIST ]]; then
dialog --separate-output --defaultno \ sed 's/$/ "" ON/' $REMOVE_LIST > $CONFIRM_LIST
--title "Removepkg confirmation" \ dialog --separate-output --defaultno \
--checklist "Remove the following packages?" 20 65 13 \ --title "Removepkg confirmation" \
--file $CONFIRM_LIST 2> $REMOVE_LIST --checklist "Remove the following packages?" 20 65 13 \
if [[ $? == 0 ]]; then --file $CONFIRM_LIST 2> $REMOVE_LIST
removepkg $(cat $REMOVE_LIST) if [[ $? == 0 ]]; then
read -n1 -ep "Press any key to continue: " removepkg $(cat $REMOVE_LIST)
read -n1 -ep "Press any key to continue: "
break
fi
else
break
fi fi
fi ;;
;; 3)
3) nvabt2n $PKG_LIST $README_LIST
nvabt2n $PKG_LIST $README_LIST view_readmes "Installed packages:" $README_LIST
view_readmes "Installed packages:" $README_LIST ;;
;; *) break ;;
esac esac
done
else else
$PAGER $PKG_LIST $PAGER $PKG_LIST
fi fi