2018-04-19 10:35:41 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [ "$#" -eq "0" ]; then
|
|
|
|
srcDir="$PWD"
|
|
|
|
else
|
|
|
|
srcDir="$1"
|
|
|
|
fi
|
|
|
|
|
|
|
|
buildDir="$srcDir/.."
|
2018-05-02 10:53:47 +00:00
|
|
|
repreproDir="/var/cache/reprepro"
|
2018-04-19 10:35:41 +00:00
|
|
|
codename="stable"
|
|
|
|
|
2018-05-02 10:56:33 +00:00
|
|
|
owner=`stat -c '%G' "$repreproDir/pool"`
|
2018-05-02 10:43:10 +00:00
|
|
|
|
2018-05-02 10:50:47 +00:00
|
|
|
if [ "$owner" != "$USER" ]; then
|
2018-08-29 13:09:21 +00:00
|
|
|
(>&2 echo "You must start this script with '$owner' user")
|
2018-05-02 10:43:10 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-05-02 06:32:19 +00:00
|
|
|
if [ -f "$srcDir/debian/changelog" ]; then
|
2018-04-19 12:05:16 +00:00
|
|
|
echo -e "\n# Cleaning last build\n"
|
2018-04-19 10:35:41 +00:00
|
|
|
rm -f $buildDir/*.deb
|
|
|
|
rm -f $buildDir/*.changes
|
|
|
|
rm -f $buildDir/*.build
|
|
|
|
(cd "$srcDir" && debian/rules clean)
|
|
|
|
|
2018-04-19 12:05:16 +00:00
|
|
|
echo -e "\n# Building Debian packages\n"
|
2018-04-19 10:35:41 +00:00
|
|
|
(cd "$srcDir" && debuild -uc -us -b)
|
|
|
|
|
2018-04-19 12:05:16 +00:00
|
|
|
echo -e "\n# Adding packages to repository\n"
|
2018-04-19 10:35:41 +00:00
|
|
|
|
|
|
|
cut -d" " -f1 "$srcDir/debian/files" |
|
2018-05-02 06:32:19 +00:00
|
|
|
while read debFile; do
|
|
|
|
if [[ ! "$debFile" =~ .*\.deb$ ]]; then
|
2018-04-19 10:35:41 +00:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo " * Adding $debFile"
|
|
|
|
reprepro -b "$repreproDir" includedeb $codename "$buildDir/$debFile"
|
|
|
|
done
|
|
|
|
else
|
|
|
|
echo "$0: Invalid source directory: $srcDir"
|
|
|
|
exit 2
|
|
|
|
fi
|