# chown valtri:users /home/valtri/.pbuilderrc
 #
 
+KEY_ID=${KEY_ID:-'7157882F'}
+DEBREPO=~/debian
 
 OS=`cat /etc/issue | head -n 1`
 ARCH=`uname -i`
        touch $REPORTS/fail.$BASENAME
        (cd $DIR; dpkg-source -x "`basename $FILE`")
        SUBDIR=`find $DIR -maxdepth 1 -type d -name ${BASENAME}-\* | head -n 1`
-       (cd $SUBDIR; pdebuild --buildresult $BASEDIR/results/pbuilder --auto-debsign --debsign-k 7157882F -- --hookdir $LAUNCHDIR/pbuilder)
+       (cd $SUBDIR; pdebuild --buildresult $BASEDIR/results/pbuilder --auto-debsign --debsign-k $KEY_ID -- --hookdir $LAUNCHDIR/pbuilder)
        mv $DIR/*.build results/reports
        CHANGES=`find results/pbuilder -type f -name ${BASENAME}_\*.changes | head -n 1`
        # buggy mini-dinstall?
-       rm -f ~/debian/*.db
+       rm -f $DEBREPO/*.db
        dput -U local $CHANGES
        rm -f $REPORTS/fail.$BASENAME
        echo $BASENAME >> $REPORTS/success.log
 
 while test -n "$1"; do
        case "$1" in
+       clean)
+               sudo rm -rf results
+               rm -rf $DEBREPO/stable $DEBREPO/unstable $DEBREPO/*.db
+               mkdir $DEBREPO/stable
+               touch$DEBREPO/stable/Packages
+               ;;
+
        gridsite|grids)
                if test "$CONF" = "pbuilder"; then
                        file=`find org.gridsite.core/RPMTMP -type f -name gridsite_\*.dsc | head -n 1`