52 lines
1023 B
Bash
Executable File
52 lines
1023 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
if [ "$#" -eq "0" ]; then
|
|
srcDir="$PWD"
|
|
else
|
|
srcDir="$1"
|
|
fi
|
|
|
|
|
|
buildDir="$srcDir/.."
|
|
repreproDir="/usr"
|
|
codename="stable"
|
|
|
|
owner=`stat -c '%U' "$repreproDir"`
|
|
|
|
if [ "$owner" != "$USER" ]; then
|
|
echo "You must start this script with '$owner' user"
|
|
exit 1
|
|
fi
|
|
|
|
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
|