--- trunk/apt-iselect 2004/07/27 09:08:17 3 +++ trunk/apt-iselect 2006/06/24 15:01:09 25 @@ -22,8 +22,11 @@ # to Tobias Gruetzmacher who reported this bug) # 2003-09-04 moved do_sudo before first call (fixes bug when trying to # install iselect) -# 2003-10-09 allow multi-selection of packages to view and install +# 2003-10-09 allow multi-selection of packages to view details # 2003-11-13 fix for RedHat 9.0 mktemp bug suggested by Dobes Vandermeer +# 2004-07-27 allow multi-selection of packages to install +# 2004-12-04 add quick install options +# 2004-12-06 fixed multi-word search # # I know it's ugly, but it's still faster than aptitude :-) # @@ -70,6 +73,7 @@ rmtemp() { rm -f $res rm -f $res2 + test -f $sel && rm -f $sel rm -f $pkg } @@ -79,19 +83,21 @@ trap 'rmtemp; exit 1' INT QUIT TERM SEGV apt_cache_search() { - search_words="$@" + search_words="$*" echo "Searching apt-cache for \"$search_words\"..." - apt-cache search "$search_words" | head -1020 > $res + apt-cache search "$@" | head -1020 > $res nr=`wc -l $res | sed 's/^ *//' | cut -d" " -f1` if [ $nr = 0 ] ; then echo "No results for \"$search_words\"" > $res2 - nr="no" + nr=0 else echo "$nr results for \"$search_words\", enter new search {s:search=%[Search for]S}" > $res2 echo >> $res2 cat $res | sed 's/^/{s}/' >> $res2 + echo >> $res2 + echo "{s:_quick_install_}Install all selected" >> $res2 fi echo >> $res2 echo "Enter new apt-cache search {s:search=%[Search for]S}" >> $res2 @@ -112,6 +118,9 @@ elif tmp=`grep search= <$sel 2>/dev/null` ; then apt_cache_search `echo $tmp | grep search= | cut -d= -f2` loop=1 + elif tmp=`grep -i ':_quick_install_' $sel` ; then + debs=`grep -v ':_quick_install_' $sel | cut -d: -f2 | cut -d" " -f1 | xargs echo` + do_sudo "Installing '$debs'" apt-get install $debs else # not search, find packages info @@ -131,11 +140,11 @@ done echo '{s}Back to search results' >> $pkg - tmp=`iselect -d '{,}' -n "Packages: $pkg_list" < $pkg` + tmp=`iselect -d '{,}' -n "Packages: $pkg_list" -m < $pkg` if echo $tmp | grep -i back >/dev/null ; then loop=1 elif echo $tmp | grep '^Package: ' >/dev/null ; then - deb=`echo $tmp | sed 's,{b/*},,g' | cut -d: -f2 | sed 's/^ *//'` + deb=`echo $tmp | sed -e 's,{b/*},,g' -e 's,Package: *,,g'` do_sudo "Installing '$deb'" apt-get install $deb elif [ -z "$tmp" ] ; then loop=1