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

44 lines
901 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"
if [ -f "$srcDir/package.json" ]; then
echo -e "\n# Installing Node dependencies\n"
(cd "$srcDir" && npm --silent install)
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