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

48 lines
904 B
Plaintext
Raw Normal View History

2018-04-19 10:35:41 +00:00
#!/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
2018-04-19 11:58:21 +00:00
echo -e "\n# Installing Node dependencies.\n"
2018-04-19 10:35:41 +00:00
(cd "$srcDir" && npm --silent install)
fi
if [ -f "$srcDir/debian/changelog" ]
then
2018-04-19 11:58:21 +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 11:58:21 +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 11:58:21 +00:00
echo -e "\n# Adding packages to repository.\n"
2018-04-19 10:35:41 +00:00
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