[Slapt-get-user] PACKAGES.TXT generator

David Lütolf slapt-get at pg21.org
Sun Jul 12 15:31:03 EDT 2009


hello

don't know if this of any use, but since I coulnd't find this straight
away on the net I hacked a little script to generate PACKAGES.TXT and
CHECKSUMS.md5 from a dir filled with slackware packages

-D
-------------- next part --------------
#!/bin/bash

# generates PACKAGES.TXT and CHECKSUMS.md5 from slackware .tgz packages

# author	david at lutolf.net
# licence	gpl
# date		2009-07-12
# bugs		slapt-get needs --no-md5 flag

PACKAGES=PACKAGES.TXT
CHECKSUMS=CHECKSUMS.md5
PKGDIR=/var/packages		# where your packages are stored

cd $PKGDIR

echo -ne "\nPACKAGES.TXT; " > $PACKAGES
date >> $PACKAGES

echo -e "\nThis file provides details on the Slackware packages found\nin the ./slackware/ directory.\n" >> $PACKAGES

TOTAL_COMPRESSED=0
TOTAL_UNCOMPRESSED=0

for f in *.tgz
do
	LINE=`ls -l $f | tr -s ' '`
	SIZE=`echo $LINE | cut -f 5 -d ' '`
	TOTAL_COMPRESSED=$((TOTAL_COMPRESSED+SIZE))
done

echo "Total size of all packages (compressed):  $((TOTAL_COMPRESSED/1024)) K" >> $PACKAGES
echo -e "Total size of all packages (uncompressed):  unknown\n\n" >> $PACKAGES

for f in *.tgz
do
	LINE=`ls -l $f | tr -s ' '`
	SIZE=`echo $LINE | cut -f 5 -d ' '`
	LONGNAME=`echo $LINE | cut -f 8 -d ' ' | sed s/\\\.tgz//`
	NAME=`echo $LONGNAME | cut -f 1 -d '-'`

	md5sum $f >> $CHECKSUMS
	#md5sum $f > $f.md5
	#cat $f.md5 >> $CHECKSUMS

	echo "PACKAGE NAME:  $f" >> $PACKAGES
	echo "PACKAGE LOCATION:  ." >> $PACKAGES
	echo "PACKAGE SIZE (compressed):  $((SIZE/1024)) K" >> $PACKAGES
	echo "PACKAGE SIZE (uncompressed):  $((SIZE/1024)) K" >> $PACKAGES
	echo "PACKAGE DESCRIPTION:" >> $PACKAGES
	tar xf $f install/slack-desc
	grep -v -e "^#" -e "-handy-ruler-" -e "^$" install/slack-desc > $f.txt
	cat $f.txt >> $PACKAGES
	echo "" >> $PACKAGES
done

rm install/slack-desc
rmdir install

cd


More information about the Slapt-get-user mailing list