#!/bin/sh
#Barry Kauler, May 2010
#this script removes the package names that are in the "devx" SFS file, not in
#the live-CD. On stdout is printed the package name and version on each line,
#of files in the live-CD.
#this script works for all puppies built with Woof.

. /root/.packages/DISTRO_PKGS_SPECS

DEVXONLY="`echo "$PKGS_SPECS_TABLE" | grep 'exe>dev' | grep '^yes' | cut -f 2 -d '|'`"

# cat /root/.packages/woof-installed-packages |
cp -f /root/.packages/woof-installed-packages /tmp/woof-installed-packages
for ONEDEVX in $DEVXONLY
do
 dPATTERN="|${ONEDEVX}|"
 grep -v "$dPATTERN" /tmp/woof-installed-packages > /tmp/woof-installed-packages2
 mv -f /tmp/woof-installed-packages2 /tmp/woof-installed-packages
done

grep -v -i '_dev' /tmp/woof-installed-packages > /tmp/woof-installed-packages2
mv -f /tmp/woof-installed-packages2 /tmp/woof-installed-packages
#grep -v '^gcc' /tmp/woof-installed-packages > /tmp/woof-installed-packages2
#mv -f /tmp/woof-installed-packages2 /tmp/woof-installed-packages
sort -u /tmp/woof-installed-packages > /tmp/woof-installed-packages2
mv -f /tmp/woof-installed-packages2 /tmp/woof-installed-packages

LIVECDPKGS="`cat /tmp/woof-installed-packages | cut -f 2,3 -d '|' | tr '|' ' ' | sed -e 's%\-q1$%%' -e 's%\-p4$%%'`"
echo "$LIVECDPKGS"
