70 lines
1.6 KiB
Bash
70 lines
1.6 KiB
Bash
|
#!/bin/bash
|
||
|
#
|
||
|
# gen_target_lists.sh
|
||
|
#
|
||
|
# Generates a prospect of the files for a given target
|
||
|
#
|
||
|
# Copyright (c) 2005 by Silvan Calarco - QiLinux distribution
|
||
|
|
||
|
#
|
||
|
# %1: Makefile target
|
||
|
# %2 - %n: other makefile options
|
||
|
#
|
||
|
. ./defs.inc.sh
|
||
|
. ./functions.inc.sh
|
||
|
|
||
|
TARGET=$1
|
||
|
shift
|
||
|
REPORT_FILE=$LOCALSTATEDIR/report-$TARGET-$arch.txt
|
||
|
|
||
|
#RPMSDIR=/var/makedist/SOURCE/RPMS/i586/
|
||
|
#SRPMSDIR=/var/makedist/SOURCE/SRPMS/
|
||
|
#OUTDIR=/var/makedist/SOURCE
|
||
|
#RPMOUT=$OUTDIR/rpms-list
|
||
|
#SRPMOUT=$OUTDIR/srpms-list
|
||
|
|
||
|
#alltargets=`sed -n '/^qilinux-[^ ]*:/{s/:.*//g;p}' $MAKEFILEDIR/Makefile`
|
||
|
#echo $alltargets
|
||
|
#read
|
||
|
toinstall=`make -C $UTILSDIR TARGET=$TARGET $@ -s 2>/dev/null`
|
||
|
|
||
|
> $REPORT_FILE
|
||
|
for pkg in $toinstall; do
|
||
|
set --
|
||
|
line=`grep "^$pkg " $UTILSDIR/pkglist-$arch`
|
||
|
set -- $line
|
||
|
PKGNAME=$1
|
||
|
PKGSIZE=$3
|
||
|
echo "$PKGNAME $PKGSIZE" >> $REPORT_FILE
|
||
|
TOTALPKGSIZE=`expr $TOTALPKGSIZE + $PKGSIZE`
|
||
|
done
|
||
|
echo >> $REPORT_FILE
|
||
|
echo "===============================" >> $REPORT_FILE
|
||
|
echo "Total packages size: $TOTALPKGSIZE" >> $REPORT_FILE
|
||
|
exit 1
|
||
|
#echo $toinstall
|
||
|
|
||
|
[ $? -ne 0 ] && { echo "Error in Makefile"; exit 1; }
|
||
|
rpms=`expand_rpm_names "$toinstall"`
|
||
|
srpms=`expand_srpm_names "$toinstall"`
|
||
|
|
||
|
rpmsfilesum=0
|
||
|
> $RPMOUT
|
||
|
for rpm in $rpms; do
|
||
|
filesize=`du -b $RPMSDIR$rpm | gawk '{ print $1 }'`
|
||
|
echo $rpm $filesize >> $RPMOUT
|
||
|
rpmsfilesum=`expr $rpmsfilesum + $filesize`
|
||
|
done
|
||
|
|
||
|
srpmsfilesum=0
|
||
|
> $SRPMOUT
|
||
|
for srpm in $srpms; do
|
||
|
filesize=`du -b $SRPMSDIR$srpm | gawk '{ print $1 }'`
|
||
|
echo $srpm $filesize >> $SRPMOUT
|
||
|
srpmsfilesum=`expr $srpmsfilesum + $filesize`
|
||
|
done
|
||
|
|
||
|
echo "Total: RPMS=$rpmsfilesum bytes SRPMS=$srpmsfilesum bytes"
|
||
|
|
||
|
#(cd $RPMSDIR && du -c -h $rpms | tail -n 1)
|