#!/bin/sh -e

usermod -u `stat -c %u /work/src` aptly >/dev/null
chown -R `stat -c %u /work/src` /var/lib/aptly

if [ -z "$@" ]; then
    echo Error: no make target specified
    exit 1
fi

cd /work/src
su aptly -c "GOPATH=$PWD/.go make $@"
