/[scripts]/trunk/apt-iselect
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/apt-iselect

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3 by dpavlin, Tue Jul 27 09:08:17 2004 UTC revision 9 by dpavlin, Tue Dec 7 23:36:41 2004 UTC
# Line 22  Line 22 
22  #               to Tobias Gruetzmacher who reported this bug)  #               to Tobias Gruetzmacher who reported this bug)
23  # 2003-09-04 moved do_sudo before first call (fixes bug when trying to  # 2003-09-04 moved do_sudo before first call (fixes bug when trying to
24  #               install iselect)  #               install iselect)
25  # 2003-10-09 allow multi-selection of packages to view and install  # 2003-10-09 allow multi-selection of packages to view details
26  # 2003-11-13 fix for RedHat 9.0 mktemp bug suggested by Dobes Vandermeer  # 2003-11-13 fix for RedHat 9.0 mktemp bug suggested by Dobes Vandermeer
27    # 2004-07-27 allow multi-selection of packages to install
28    # 2004-12-04 add quick install options
29    # 2004-12-06 fixed multi-word search
30  #  #
31  # I know it's ugly, but it's still faster than aptitude :-)  # I know it's ugly, but it's still faster than aptitude :-)
32  #  #
# Line 70  pkg=`mktemp /tmp/tmp-pkg.XXXXXX` || ( ec Line 73  pkg=`mktemp /tmp/tmp-pkg.XXXXXX` || ( ec
73  rmtemp() {  rmtemp() {
74          rm -f $res          rm -f $res
75          rm -f $res2          rm -f $res2
76            test -f $sel && rm -f $sel
77          rm -f $pkg          rm -f $pkg
78  }  }
79    
# Line 79  LANG=C apt-cache stats 2>&1 | grep "^W: Line 83  LANG=C apt-cache stats 2>&1 | grep "^W:
83  trap 'rmtemp; exit 1' INT QUIT TERM SEGV  trap 'rmtemp; exit 1' INT QUIT TERM SEGV
84    
85  apt_cache_search() {  apt_cache_search() {
86          search_words="$@"          search_words="$*"
87    
88          echo "Searching apt-cache for \"$search_words\"..."          echo "Searching apt-cache for \"$search_words\"..."
89    
90          apt-cache search "$search_words" | head -1020 > $res          apt-cache search "$@" | head -1020 > $res
91          nr=`wc -l $res | sed 's/^ *//' | cut -d" " -f1`          nr=`wc -l $res | sed 's/^ *//' | cut -d" " -f1`
92          if [ $nr = 0 ] ; then          if [ $nr = 0 ] ; then
93                  echo "No results for \"$search_words\"" > $res2                  echo "No results for \"$search_words\"" > $res2
# Line 93  apt_cache_search() { Line 97  apt_cache_search() {
97                  echo >> $res2                  echo >> $res2
98                  cat $res | sed 's/^/{s}/' >> $res2                  cat $res | sed 's/^/{s}/' >> $res2
99          fi          fi
100            if [ $nr -gt 0 ] ; then
101                    echo >> $res2
102                    echo "{s:_quick_install_}Install all selected" >> $res2
103            fi
104          echo >> $res2          echo >> $res2
105          echo "Enter new apt-cache search {s:search=%[Search for]S}" >> $res2          echo "Enter new apt-cache search {s:search=%[Search for]S}" >> $res2
106  }  }
# Line 112  while [ $loop = 1 ] ; do Line 120  while [ $loop = 1 ] ; do
120          elif tmp=`grep search= <$sel 2>/dev/null` ; then          elif tmp=`grep search= <$sel 2>/dev/null` ; then
121                  apt_cache_search `echo $tmp | grep search= | cut -d= -f2`                  apt_cache_search `echo $tmp | grep search= | cut -d= -f2`
122                  loop=1                  loop=1
123            elif tmp=`grep -i ':_quick_install_' $sel` ; then
124                    debs=`grep -v ':_quick_install_' $sel | cut -d: -f2 | cut -d" " -f1 | xargs echo`
125                    do_sudo "Installing '$debs'" apt-get install $debs
126          else          else
127                  # not search, find packages info                  # not search, find packages info
128    
# Line 131  while [ $loop = 1 ] ; do Line 142  while [ $loop = 1 ] ; do
142                  done                  done
143                  echo '{s}Back to search results' >> $pkg                  echo '{s}Back to search results' >> $pkg
144    
145                  tmp=`iselect -d '{,}' -n "Packages: $pkg_list" < $pkg`                  tmp=`iselect -d '{,}' -n "Packages: $pkg_list" -m < $pkg`
146                  if echo $tmp | grep -i back >/dev/null ; then                  if echo $tmp | grep -i back >/dev/null ; then
147                          loop=1                          loop=1
148                  elif echo $tmp | grep '^Package: ' >/dev/null ; then                  elif echo $tmp | grep '^Package: ' >/dev/null ; then
149                          deb=`echo $tmp | sed 's,{b/*},,g' | cut -d: -f2 | sed 's/^ *//'`                          deb=`echo $tmp | sed -e 's,{b/*},,g' -e 's,Package: *,,g'`
150                          do_sudo "Installing '$deb'" apt-get install $deb                          do_sudo "Installing '$deb'" apt-get install $deb
151                  elif [ -z "$tmp" ] ; then                  elif [ -z "$tmp" ] ; then
152                          loop=1                          loop=1

Legend:
Removed from v.3  
changed lines
  Added in v.9

  ViewVC Help
Powered by ViewVC 1.1.26