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

52 lines
1.0 KiB
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
2018-05-02 10:43:10 +00:00
2018-04-19 10:35:41 +00:00
buildDir="$srcDir/.."
repreproDir="/var/cache/reprepro"
codename="stable"
2018-05-02 10:43:10 +00:00
owner=`stat -c '%U' "$repreproDir"`
if [ "$onwer" -ne "$USER" ]; then
echo "You must start this script with '$onwer' user"
exit 1
fi
2018-05-02 06:32:19 +00:00
if [ -f "$srcDir/package.json" ]; then
2018-04-19 12:05:16 +00:00
echo -e "\n# Installing Node dependencies\n"
2018-04-19 10:35:41 +00:00
(cd "$srcDir" && npm --silent install)
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