inspkg - list and install packages from sid

Submitted scripts and programs
Forum rules
Your own work only.
machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

inspkg - list and install packages from sid

Unread post by machinebacon »

Search for a package by string and install from the Unstable repos.

Code: Select all

#!/bin/bash
. /usr/share/doc/dialog/examples/setup-vars
. /usr/share/doc/dialog/examples/setup-tempfile

cat /var/lib/apt/lists/*unstable*_Packages | grep "Package:" | awk -F ' ' '{ print $2 }' | sort > ~/.pkglist1

ar=()
while read n s ; do
	ar+=($n "$s" "\n")
done < ~/.pkglist1

dialog --clear --title "Package search" --inputbox "Enter the string to grep all unstable packages for:" 0 0 2> $tempfile
retval=$?

grep `cat $tempfile` ~/.pkglist1 > ~/.pkglist2
while read n s ; do
        arr+=($n "$s" "\n")
done < ~/.pkglist2


dialog --clear --backtitle "Install Sid packages"  --title "Search string: `cat $tempfile`" --checklist "Select Sid packages to install" 26 45 30 "${arr[@]}" 2> $tempfile
retval=$?
case $retval in
	$DIALOG_CANCEL)
		rm ~/.pkglist* &>/dev/null
		reset
		clear
		exit 0;;
esac
sudo apt-get -y install `cat $tempfile`
rm ~/.pkglist* &>/dev/null
Attachments
install.png
..gnutella..
Post Reply