Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 06-18-2009, 01:23 AM   #1
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Lightbulb Slack-11: script lists installed pkgs, out-of-tree packages, compares versions...

I finally got around to making/finishing a somewhat simple little script that compiles a list of all packages installed on the system, and cross-references it with the package list from your slackpkg-configured remote server, to show you which versions you have that are older/newer as well as what packages you have installed that are out-of-tree, which you need to do updates for on your own.
It also shows what official packages you do NOT have installed, for the heck of it.

Maybe/probably/possibly there's something else around that does the same basic thing, I don't know, but this is my version. Maybe someone else will find it helpful too. Here is:
# Slackware 11 Out-Of-Tree Package-lister
# Filename: '/var/lib/slackpkg/list-out-of-tree.runme'
# Author: Sasha Alexandr / GrapefruiTgirl
# License: GPL (Use at own risk, do what you like with it)
# Version 1.01 Date: June 21 2009
# Tested on Slackware 11 w/slackpkg 2.60 and I have no idea
# if it will work as-is on any other Slackware releases.
# This script is intended to be located in /var/lib/slackpkg
# (obviously assuming 'slackpkg' installed and configured.)
# It provides a breakdown of Slackware packages that you
# have installed on your machine which are OUT-OF-TREE
# meaning they are not part of the official Slackware release
# and therefore you need to maintain/update them yourself.
# (I have a lot of those installed, which is why I wrote this.)
# This script also shows you a list of official Slackware
# packages on the remote server which are NOT installed on
# your machine (FYI), as well as indicating if your locally
# installed official packages are the same or a different
# version as the remote packages. It's not rocket science
# but it helps with keeping those extra things you install
# along the way, up to date.
# If you want this script to update your slackpkg package-list
# when you execute it, be sure to make the accompanying tiny
# script ('list-out-of-tree.update' ) that goes with this one,
# and save it in the same directory; then uncomment the next line:

# echo "no" | list-out-of-tree.update

# Or just update slackpkg yourself before executing this.
# Here's what goes into the accompanying script (3 lines).
# Copy/paste the three lines from inside this unused function
# to a new file, and save it as 'list-out-of-tree.update'
three_line_file () {

/sbin/slackpkg update
exit 0

# Now execute this in a shell and wait a while. When it is done
# you will have a file called 'local.vs.remote.list' and a file
# called 'no.remote.version' for your reading pleasure.
# begin:


rm -f ./final ./local.vs.remote.list ./no.remote.version 2>&1 >/dev/null
ls /var/log/packages > ./local.list
cat ./pkglist | grep "tgz" | gawk '{print $6}' | sed 's/.tgz//' > ./remote.list
local_list="`cat ./local.list`"
remote_list="`cat ./remote.list`"

butcher () {
return=`echo "$1" | cut -f1 -d . | gawk '{ gsub (/-.$/,"",$0) ; print }'`

echo -e "    Status & Local Package Name%%Remote Status & Package Name\n\n" >> ./final
let counter=0
for local_item in `echo -e "$local_list"`; do
	let counter++ ; unset is_on_remote version
	butcher "$local_item"
	for remote_item in `echo -e "$remote_list"`; do
		butcher "$remote_item"
		if [ "$short_remote_item_name" = "$short_local_item_name" ]; then
		 [ "$local_item" = "$remote_item" ] && version='Same.' || version="$remote_item"
		 echo "$counter: Installed: $local_item%%$counter: Remote-version: $version" >> ./final
		[ "$is_on_remote" ] && break;
	[ ! "$is_on_remote" ] && echo "$counter: Installed: $local_item%%$counter: Remote-version: NO REMOTE VERSION" >> ./final
let counter=0
echo -e "-Remote packages that are NOT installed locally (FYI)-" >> ./final
for remote_item in `echo -e "$remote_list"`; do
	let counter++ ; unset is_installed
	butcher "$remote_item"
	for local_item in `echo -e "$local_list"`; do
		butcher "$local_item"
		[ "$short_local_item_name" = "$short_remote_item_name" ] && is_installed='1'
		[ "$is_installed" ] && break;
	[ ! "$is_installed" ] && echo "$counter: Not Installed locally:%%$counter: $remote_item" >> ./final

$column -tx -s %% ./final > ./local.vs.remote.list
cat ./local.vs.remote.list | grep "NO REMOTE VERSION" > ./no.remote.version
rm -f ./final
exit 0

Sample output:

43: Installed: cdrdao-1.2.1-i486-1                            43: REMOTE-VERSION: Same.
44: Installed: cdrtools-2.01.01a23-i486-1                     44: REMOTE-VERSION: cdrtools-2.01-i486-1
45: Installed: cg-2.0-jan2008-x86                             45: REMOTE-VERSION: NO REMOTE VERSION
46: Installed: chkrootkit-0.47-i486-1                         46: REMOTE-VERSION: NO REMOTE VERSION
47: Installed: clisp-2.39-i486-1                              47: REMOTE-VERSION: Same.
48: Installed: cmake-2.6-i686-0                               48: REMOTE-VERSION: NO REMOTE VERSION
49: Installed: coreutils-5.97-i486-1                          49: REMOTE-VERSION: Same.
50: Installed: cpio-2.5-i486-3                                50: REMOTE-VERSION: cpio-2.5-i386-1
51: Installed: cscope-15.5-i486-2                             51: REMOTE-VERSION: Same.
52: Installed: ctl-1.4.1-i686-0                               52: REMOTE-VERSION: NO REMOTE VERSION
53: Installed: cups-1.1.23-i486-5_slack11.0                   53: REMOTE-VERSION: Same.
54: Installed: curl-7.15.5-i486-2_slack11.0                   54: REMOTE-VERSION: Same.
55: Installed: cvs-1.11.22-i486-1                             55: REMOTE-VERSION: Same.
56: Installed: cxxlibs-6.0.8-i486-3                           56: REMOTE-VERSION: cxxlibs-6.0.3-i486-1
57: Installed: cyrus-sasl-2.1.23-i486-1_slack11.0             57: REMOTE-VERSION: Same.
58: Installed: db42-4.2.52-i486-3                             58: REMOTE-VERSION: Same.
59: Installed: db44-4.4.20-i486-1                             59: REMOTE-VERSION: Same.
60: Installed: dbus-1.1.20-i686-0                             60: REMOTE-VERSION: NO REMOTE VERSION
61: Installed: dbus-glib-0.73-i686-0                          61: REMOTE-VERSION: NO REMOTE VERSION
62: Installed: dcron-2.3.3-i486-6                             62: REMOTE-VERSION: dcron-2.3.3-i486-5
63: Installed: dejavu-ttf-2.10-noarch-1                       63: REMOTE-VERSION: Same.
64: Installed: desktop-file-utils-0.11-i486-1                 64: REMOTE-VERSION: Same.
65: Installed: devs-2.3.1-noarch-25                           65: REMOTE-VERSION: Same.
66: Installed: dhcp-3.1.2-i686-0                              66: REMOTE-VERSION: dhcp-3.0.4-i486-2
67: Installed: dhcpcd-2.0.4-i486-2                            67: REMOTE-VERSION: Same.
68: Installed: dialog-1.1_20070528-i486-1                     68: REMOTE-VERSION: NO REMOTE VERSION
69: Installed: diffstat-1.43-i486-1                           69: REMOTE-VERSION: Same.
70: Installed: diffutils-2.8.1-i486-3                         70: REMOTE-VERSION: Same.
Sample output:

1: Installed: P7zip-4.57-i686-0                               1: Remote-version: NO REMOTE VERSION
8: Installed: acpica-20080213-i686-1                          8: Remote-version: NO REMOTE VERSION
35: Installed: boost-1.38.0-i686-0                            35: Remote-version: NO REMOTE VERSION
45: Installed: cg-2.0-jan2008-x86                             45: Remote-version: NO REMOTE VERSION
46: Installed: chkrootkit-0.47-i486-1                         46: Remote-version: NO REMOTE VERSION
48: Installed: cmake-2.6-i686-0                               48: Remote-version: NO REMOTE VERSION
52: Installed: ctl-1.4.1-i686-0                               52: Remote-version: NO REMOTE VERSION
60: Installed: dbus-1.1.20-i686-0                             60: Remote-version: NO REMOTE VERSION
61: Installed: dbus-glib-0.73-i686-0                          61: Remote-version: NO REMOTE VERSION
68: Installed: dialog-1.1_20070528-i486-1                     68: Remote-version: NO REMOTE VERSION
73: Installed: dmidecode-2.9-i486-1                           73: Remote-version: NO REMOTE VERSION
95: Installed: flash-player-plugin-            95: Remote-version: NO REMOTE VERSION

UPDATE: See 'reason for editing' below.

Last edited by GrapefruiTgirl; 06-21-2009 at 02:10 PM. Reason: added a line at end of script to GREP the packages with no remote version to a separate file.


packages, slackware

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Does script exist that automates slack install with pre-selectable pkgs? linus72 Slackware 5 05-31-2009 11:38 AM
Is there a file that lists all installed packages in Ubuntu Gethyn Linux - Software 8 11-03-2007 10:58 AM
Multiple versions of packages installed bakwas_internet Fedora 7 06-01-2007 02:04 PM
Compare installed RPM versions using Bash script jimwelc Linux - Newbie 6 01-28-2005 11:40 AM
if 4.0 is installed can 4.0 soho pkgs be installed?? bosewicht VectorLinux 2 11-22-2003 12:05 PM

All times are GMT -5. The time now is 06:23 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration