This repository has been archived on 2020-01-17. You can view files and clone it, but cannot push or open issues or pull requests.
vn-repo/vn-debuild

46 lines
919 B
Bash
Executable File

#!/bin/bash
set -e
if [ "$#" -eq "0" ]; then
srcDir="$PWD"
else
srcDir="$1"
fi
buildDir="$srcDir/.."
repreproDir="/var/cache/reprepro"
codename="stable"
owner=`stat -c '%G' "$repreproDir/pool"`
if [ "$owner" != "$USER" ]; then
(>&2 echo "You must start this script with '$owner' user")
exit 1
fi
if [ -f "$srcDir/debian/changelog" ]; then
echo -e "\n# Cleaning last build\n"
rm -f $buildDir/*.deb
rm -f $buildDir/*.changes
rm -f $buildDir/*.build
(cd "$srcDir" && debian/rules clean)
echo -e "\n# Building Debian packages\n"
(cd "$srcDir" && debuild -uc -us -b)
echo -e "\n# Adding packages to repository\n"
cut -d" " -f1 "$srcDir/debian/files" |
while read debFile; do
if [[ ! "$debFile" =~ .*\.deb$ ]]; then
continue
fi
echo " * Adding $debFile"
reprepro -b "$repreproDir" includedeb $codename "$buildDir/$debFile"
done
else
echo "$0: Invalid source directory: $srcDir"
exit 2
fi