What about this: Write the output of "rpm -qa --provides" to file "a". In this file are now the capabilities of all packages. Write the output of "rpm -q --whatprovides "n-th line of fila "a"" to file "b" If list "a" has n entries, the above commad has to be run n-times. In file "b" are now all packages that other packages depend on. We have to delete entries that occur more than once. Now we have to generate a file "c" which contains all package names. Finally file "b" and "c" have to be compared. The packages that are in "c" but not in "b" are not needed for any dependency and can thus be uninstalled. After thess packages have been uninstalled the script has to be run again
Actually YaST is doing almost the same, just vice versa. When you install a package it installs all needed packages itself. Fabian