From 98fdb52d1dace7b8ea0cb33c14987f611541cf89 Mon Sep 17 00:00:00 2001 From: "chess.griffin" Date: Tue, 12 Aug 2008 03:23:21 +0000 Subject: [PATCH] add while loop in the search results display page so that after viewing a search item, the user is returned to the search results --- src/usr/bin/sbopkg | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/usr/bin/sbopkg b/src/usr/bin/sbopkg index 4537230..133f5f4 100755 --- a/src/usr/bin/sbopkg +++ b/src/usr/bin/sbopkg @@ -580,26 +580,29 @@ gen_search_package () { # interface, jump to selected package. cd $LOCALREPO/$SLACKVER PKG=$1 -RESULTS=$(find . -mindepth 2 -type d | grep $PKG | sed -e 's/.\///') +RESULTS=$(find . -mindepth 2 -maxdepth 2 -type d | grep $PKG | sed -e 's/.\///') if [ -n "$RESULTS" ]; then if [ "$DIAG" = 1 ]; then for i in $RESULTS; do DESC=$(grep -hZm1 ^$(echo "$i" | cut -d/ -f2) ./$i/slack-desc* | cut -d\( -f2- | cut -d\) -f1) echo "\"$i\" \"$DESC\"" >> $TMP/sbopkg_search_results done - dialog --title "Matches for $PKG" --menu "Please select an \ + while [ -f $TMP/sbopkg_search_results ]; do + dialog --title "Matches for $PKG" --menu "Please select an \ item you wish to view." 20 70 14 --file \ - $TMP/sbopkg_search_results 2>$TMP/sbopkg_search_choice - if [ ! $? = 1 ]; then - SRCHPICK="$(cat $TMP/sbopkg_search_choice)" - SRCHCAT=$(echo $SRCHPICK | sed -e 's/\/.*$//') - SRCHPKG=$(echo $SRCHPICK | sed -e 's/^.*\///') - echo $SRCHCAT > $TMP/sbopkg_category_selection - echo $SRCHPKG > $TMP/sbopkg_item_selection - cd $LOCALREPO/$SLACKVER - info_item - fi - rm -rf $TMP/sbopkg_search_results + $TMP/sbopkg_search_results 2>$TMP/sbopkg_search_choice + if [ ! $? = 1 ]; then + SRCHPICK="$(cat $TMP/sbopkg_search_choice)" + SRCHCAT=$(echo $SRCHPICK | sed -e 's/\/.*$//') + SRCHPKG=$(echo $SRCHPICK | sed -e 's/^.*\///') + echo $SRCHCAT > $TMP/sbopkg_category_selection + echo $SRCHPKG > $TMP/sbopkg_item_selection + cd $LOCALREPO/$SLACKVER + info_item + else + rm -rf $TMP/sbopkg_search_results + fi + done continue else echo "Found the following matches for $PKG:"