#!/bin/bash # Used to compile a package and copy it to the correct repository location. # all arguments are passed to makepkg # # . /etc/makepkg.conf . PKGBUILD PKGHOME=/data/pkg_repo/packages SRCPKGHOME=/data/pkg_repo/src_packages mydir=`pwd` TOTALPKG="$pkgname"-"$pkgver"-"$pkgrel"-"$CARCH".pkg.tar.gz SRCPKG="$pkgname"-"$pkgver"-"$pkgrel".src.tar.gz if [ x`basename $0` = xmpr ] then PFIX="" else PFIX="-testing" fi function find_repo { dirname=`dirname $mydir` echo $dirname|grep -q "extra" if [ $? = 0 ] then REPO=extra${PFIX} else REPO=core${PFIX} fi echo $dirname|grep -q "chroot-devel" if [ $? = 0 ] then REPO=chroot-devel fi echo $dirname|grep -q "mv-core" if [ $? = 0 ] then REPO=mv-core fi if [ x`basename $0` = xmpl ] then REPO="local" fi DOCROOT=/data/pkg_repo/$CARCH/$REPO if [ ! -e $DOCROOT ] then mkdir -p $DOCROOT fi } function update-repo { cd $DOCROOT echo echo "DOCROOT=$DOCROOT" echo #remove old package from local copy DELPKG="$pkgname"-"$pkgver"-*-"$CARCH".pkg.tar.gz #echo $DOCROOT #echo $DELPKG echo "Removing old packages from:" rm -fvI $DELPKG #copy in new package echo echo "Updating $CARCH/$REPO with $TOTALPKG" cp -f $PKGDEST/$TOTALPKG . repo-add $DOCROOT/$REPO.db.tar.gz $DOCROOT/$TOTALPKG cd - } function update-src-pkg { DELPKG="$pkgname"-"$pkgver"-*.src.tar.gz echo "Removing old src pkg" if [ ! -d $PKGHOME/$REPO/$SRCPKG ] then echo "Creating src_pkg directory" mkdir -p $SRCPKGHOME/$REPO fi rm -vf $SRCPKGHOME/$REPO/$DELPKG echo "copying src_pkg to $SRCPKGHOME/$REPO" cp -f $PKGHOME/$SRCPKG $SRCPKGHOME/$REPO } #MAIN PROGRAM find_repo makepkg --asroot $@ || exit 1 echo "---------updating database ----------" update-repo #&& pacman -Sy echo "----------creating source package---------" makepkg -f --hold-ver --asroot --source && update-src-pkg