|
Size: 2061
Comment: Adjust awk and find process
|
← Revision 4 as of 2018-12-15 00:18:18 ⇥
Size: 2019
Comment: modernise dpkg calls
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 43: | Line 43: |
| pkgend=`dpkg -I $SRCDIR/$srcfile | awk '/Architecture:/ { print $2 }'` | pkgend=$(dpkg-deb --field $SRCDIR/$srcfile Architecture) |
| Line 46: | Line 46: |
| pkgver=`dpkg -I $SRCDIR/$srcfile | awk '/Version:/ { print $2 }'` | pkgver=$(dpkg-deb --field $SRCDIR/$srcfile Version) |
| Line 48: | Line 48: |
| pooldir=`dpkg -I $SRCDIR/$srcfile | awk '/Source:/ { print $2 }'` | pooldir=$(dpkg-deb --field $SRCDIR/$srcfile Source) |
A script for moving udebs from a single directory (such as the directory used when building the DebianInstaller
#!/bin/bash
function print_usage {
echo
echo "move-installer-udebs source-directory destination-directory"
echo
echo "paths must be absolute"
echo "source-directory is the directory containing the udebs"
echo "destination-directory is the directory containing the pool directory"
}
if [ -z "$1" ]; then
print_usage
exit
fi
if [ -z "$2" ]; then
print_usage
exit
fi
SRCDIR=$1
DESTDIR=$2
echo "Copying from $SRCDIR to $DESTDIR"
TMPFILE=`tempfile`
pushd $SRCDIR
find -name '*.udeb' -a -type f | sort >$TMPFILE
srcbase=$SRCDIR
destbase=$DESTDIR
cd -
for srcfile in `cat $TMPFILE`; do
pkgfullname=`basename $srcfile .udeb`
pkgname=`echo $pkgfullname | cut -f1 -d_`
pkgver=`echo $pkgfullname | cut -f2 -d_`
pkgend=`echo $pkgfullname | cut -f3 -d_`
if [ "$pkgend" = $pkgname ]; then
pkgend=$(dpkg-deb --field $SRCDIR/$srcfile Architecture)
fi
if [ "$pkgver" = $pkgname ]; then
pkgver=$(dpkg-deb --field $SRCDIR/$srcfile Version)
fi
pooldir=$(dpkg-deb --field $SRCDIR/$srcfile Source)
if [ -z "$pooldir" ] ; then
pooldir=$pkgname
fi
poolprefix=`expr substr $pooldir 1 1`
if [ "$poolprefix" = "l" ]; then
poolpref2=`expr substr $pooldir 1 3`
if [ "$poolpref2" = "lib" ] ; then
poolprefix=`expr substr $pooldir 1 4`
else
poolprefix="l"
fi
fi
echo "Copying $pkgname\__$pkgver\__$pkgend.udeb to $DESTDIR/pool/main/$poolprefix/$pooldir"
install -d $DESTDIR/pool/main/$poolprefix/$pooldir
cp $SRCDIR/$srcfile $DESTDIR/pool/main/$poolprefix/$pooldir/$pkgname\__$pkgver\__$pkgend.udeb
done
rm -f $TMPFILE
popd