| 1 |
operz |
1 |
#!/bin/ksh |
| 2 |
|
|
# |
| 3 |
|
|
# $Id: gencatalog 2484 2008-12-09 10:20:31Z dmichelsen $ |
| 4 |
|
|
# |
| 5 |
|
|
# Copyright 2006 Cory Omand <comand@blastwave.org> |
| 6 |
|
|
# All rights reserved. Use is subject to license terms. |
| 7 |
|
|
# |
| 8 |
|
|
# Redistribution and/or use, with or without modification, is |
| 9 |
|
|
# permitted. This software is without warranty of any kind. The |
| 10 |
|
|
# author(s) shall not be liable in the event that use of the |
| 11 |
|
|
# software causes damage. |
| 12 |
|
|
# |
| 13 |
|
|
# gencatalog - generate a v1 style catalog and description file. |
| 14 |
|
|
# |
| 15 |
|
|
|
| 16 |
|
|
cp catalog catalog.old |
| 17 |
|
|
cp descriptions descriptions.old |
| 18 |
|
|
|
| 19 |
|
|
for pkg in `ls -1 *.pkg *.pkg.gz 2>/dev/null` ; do |
| 20 |
|
|
eval `gzcat $pkg | perl -lne ' |
| 21 |
|
|
if (/PKG=(\S+)/) { print "PKG=$1" } |
| 22 |
|
|
elsif (/NAME=((\S+).+$)/) { print "NAME=$2\nDESC=\"$1\"" } |
| 23 |
|
|
elsif (/VERSION=(\S+)/) { print "VERSION=$1" ; exit }'` |
| 24 |
|
|
|
| 25 |
|
|
print "$DESC" |
| 26 |
|
|
print "$NAME $VERSION $PKG $pkg $(md5sum $pkg | awk '{print $1}')" >> catalog.new |
| 27 |
|
|
print "$DESC" >> descriptions.new |
| 28 |
|
|
done |
| 29 |
|
|
|
| 30 |
|
|
if [ -f catalog.new ]; then |
| 31 |
|
|
mv catalog.new catalog |
| 32 |
|
|
else |
| 33 |
|
|
cp /dev/null catalog |
| 34 |
|
|
fi |
| 35 |
|
|
|
| 36 |
|
|
if [ -f descriptions.new ]; then |
| 37 |
|
|
mv descriptions.new descriptions |
| 38 |
|
|
else |
| 39 |
|
|
cp /dev/null descriptions |
| 40 |
|
|
fi |
| 41 |
|
|
|
| 42 |
|
|
rm -f catalog.old descriptions.old |
| 43 |
|
|
|