I came across this useful thread too (many thanks to prior contributors: excellent stuff!). However I wanted something more sophisticated: given a wish-list of dependent packages, could I have utility to hunt them down in the various raspbian distributions?
I have created a couple of scripts that others may find useful (you can save these to your pi user home folder (or wherever)). Remember to chmod +x script-name.sh after you have created them or you will have trouble running them.
The first one is get-available.sh:
#!/bin/bash
dist=jessie
[ ${#1} -gt 0 ] && dist=$1
[ ! -e /home/pi/${dist} ] && mkdir /home/pi/${dist}
pushd /home/pi/${dist} &> /dev/null
[ ! -e ./Packages ] && echo Fetching Packages list for ${dist}...
[ ! -e ./Packages ] && wget http://archive.raspbian.org/raspbian/dists/${dist}/main/binary-armhf/Packages
grep -P '^Package:' Packages | cut -d' ' -f2 > available
[ ! -e ./wishlist ] && touch ./wishlist
popd &> /dev/null
You run this and it fetches the package list for a given distribution (defaults to jessie):
./get-available.sh [<distribution-name>]
It also creates an empty wishlist text file within a newly created distribution folder (check first that you do not already have folders of these names in your home folder or you could overwrite something): you can edit this as a line separated packages list which are those that you hope to find are included in the distribution you are searching.
The second script is check-available.sh:
#!/bin/bash
dist=jessie
[ ${#1} -gt 0 ] && dist=$1
[ ! -e /home/pi/${dist}/available ] && echo You need to run ./get-available.sh ${dist} first!
[ ! -e /home/pi/${dist}/available ] && exit
pushd /home/pi/${dist} &> /dev/null
[ -e ./availability ] && rm ./availability
mlen=7
function check-len () {
[ ${#1} -gt ${mlen} ] && mlen=${#1}
}
function check-available () {
matches=$(grep -o "^$1$" ./available | wc -l)
if [ ${matches} -eq 0 ]
then
printf "%-${mlen}s :NO (%s)\n" $1 ${dist} >> ./availability
else
printf "%-${mlen}s :YES (%s)\n" $1 ${dist} >> ./availability
fi
}
readarray packages < ./wishlist
for p in "${packages[@]}"
do
pw=$(echo ${p}|tr -d '\n')
check-len "${pw}"
done
for p in "${packages[@]}"
do
pw=$(echo ${p}|tr -d '\n')
check-available "${pw}"
done
[ -e ./availability ] && cat ./availability
popd &> /dev/null
Once you have setup your wishlist you run this and it scans the package list for those packages (defaults to jessie):
./check-available.sh [<distribution-name>]
As well as outputting to the console is saves the search output to an availability file in the distribution search sub folder.
Here is (my) example wishlist:
vim
wget
software-properties-common
python3.5
libsodium13
python3-pip
oracle-java8-installer
oracle-java8-set-default
libgmp3-dev
libssl-dev
flex
bison
Here is what I found for wheezy package availability:
vim :YES (wheezy)
wget :YES (wheezy)
software-properties-common :YES (wheezy)
python3.5 :NO (wheezy)
libsodium13 :NO (wheezy)
python3-pip :YES (wheezy)
oracle-java8-installer :NO (wheezy)
oracle-java8-set-default :NO (wheezy)
libgmp3-dev :YES (wheezy)
libssl-dev :YES (wheezy)
flex :YES (wheezy)
bison :YES (wheezy)
Here is what I found for jessie package availability:
vim :YES (jessie)
wget :YES (jessie)
software-properties-common :YES (jessie)
python3.5 :NO (jessie)
libsodium13 :YES (jessie)
python3-pip :YES (jessie)
oracle-java8-installer :NO (jessie)
oracle-java8-set-default :NO (jessie)
libgmp3-dev :YES (jessie)
libssl-dev :YES (jessie)
flex :YES (jessie)
bison :YES (jessie)
And here is what I found for stretch package availability:
vim :YES (stretch)
wget :YES (stretch)
software-properties-common :YES (stretch)
python3.5 :YES (stretch)
libsodium13 :NO (stretch)
python3-pip :YES (stretch)
oracle-java8-installer :NO (stretch)
oracle-java8-set-default :NO (stretch)
libgmp3-dev :YES (stretch)
libssl-dev :YES (stretch)
flex :YES (stretch)
bison :YES (stretch)
If your list is longer it is a cinch to use grep to filter the :YES or :NO lines to query the availability files.
I hope some others find this useful!
curl -s http://archive.raspbian.org/raspbian/dists/stable/main/binary-armhf/Packages.xz | xz -d | grep '^Package:' | cut -d ' ' -f 2
– gioele Sep 24 '17 at 10:34