stop if git tags were updated, allow non-force autoconf, enhanced build speed, include autostart instruction in postinst and adjusted start hint to systemd

This commit is contained in:
john30
2017-12-30 13:26:02 +01:00
parent 60a18d15e2
commit 88e4c7eec7
3 changed files with 69 additions and 13 deletions
+5
View File
@@ -4,5 +4,10 @@ test -n "$srcdir" || srcdir=.
mkdir -p "$srcdir/build" mkdir -p "$srcdir/build"
if [ "x$1" = "x--dontforce" ]; then
shift
autoreconf --install --verbose "$srcdir"
else
autoreconf --force --install --verbose "$srcdir" autoreconf --force --install --verbose "$srcdir"
fi
test -n "$NOCONFIGURE" || "$srcdir/configure" "--prefix=/usr" "--sysconfdir=/etc" "--localstatedir=/var" "$@" test -n "$NOCONFIGURE" || "$srcdir/configure" "--prefix=/usr" "--sysconfdir=/etc" "--localstatedir=/var" "$@"
+9 -2
View File
@@ -1,3 +1,10 @@
#!/bin/sh #!/bin/sh
./make_debian.sh tags=`git fetch -t`
./make_debian.sh --without-mqtt if [ -n "$tags" ]; then
echo "tags were updated:"
echo $tags
echo "git pull is recommended. stopped."
exit 1
fi
./make_debian.sh --keepbuilddir $@
./make_debian.sh --reusebuilddir --dontforce --without-mqtt $@
+49 -5
View File
@@ -15,26 +15,55 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
keepbuilddir=
if [ "x$1" = "x--keepbuilddir" ]; then
keepbuilddir=1
shift
fi
reusebuilddir=
if [ "x$1" = "x--reusebuilddir" ]; then
reusebuilddir=1
shift
fi
echo "*************" echo "*************"
echo " prepare" echo " prepare"
echo "*************" echo "*************"
echo echo
tags=`git fetch -t`
if [ -n "$tags" ]; then
echo "tags were updated:"
echo $tags
echo "git pull is recommended. stopped."
exit 1
fi
VERSION=`head -n 1 VERSION` VERSION=`head -n 1 VERSION`
ARCH=`dpkg --print-architecture` ARCH=`dpkg --print-architecture`
BUILD="build-$ARCH" BUILD="build-$ARCH"
RELEASE="ebusd-$VERSION" RELEASE="ebusd-$VERSION"
PACKAGE="${RELEASE}_${ARCH}" PACKAGE="${RELEASE}_${ARCH}"
if [ -n "$reusebuilddir" ]; then
echo "reusing build directory $BUILD"
else
if [ -n "$keepbuilddir" ]; then
./autogen.sh $@ || exit 1
fi
rm -rf "$BUILD" rm -rf "$BUILD"
fi
mkdir -p "$BUILD" || exit 1 mkdir -p "$BUILD" || exit 1
cd "$BUILD" || exit 1 cd "$BUILD" || exit 1
if [ -z "$reusebuilddir" ]; then
(tar cf - -C .. "--exclude=./$BUILD" --exclude=./.* "--exclude=*.o" "--exclude=*.a" .| tar xf -) || exit 1 (tar cf - -C .. "--exclude=./$BUILD" --exclude=./.* "--exclude=*.o" "--exclude=*.a" .| tar xf -) || exit 1
fi
echo echo
echo "*************" echo "*************"
echo " build" echo " build"
echo "*************" echo "*************"
echo echo
if [ -n "$reusebuilddir" ] || [ -z "$keepbuilddir" ]; then
./autogen.sh $@ || exit 1 ./autogen.sh $@ || exit 1
fi
make DESTDIR="$PWD/$RELEASE" install-strip || exit 1 make DESTDIR="$PWD/$RELEASE" install-strip || exit 1
extralibs= extralibs=
ldd $RELEASE/usr/bin/ebusd | egrep -q libmosquitto.so.0 ldd $RELEASE/usr/bin/ebusd | egrep -q libmosquitto.so.0
@@ -89,10 +118,6 @@ cat <<EOF > $RELEASE/DEBIAN/dirs
EOF EOF
if [ -d /run/systemd/system ]; then if [ -d /run/systemd/system ]; then
echo /lib/systemd/system >> $RELEASE/DEBIAN/dirs echo /lib/systemd/system >> $RELEASE/DEBIAN/dirs
else
echo /etc/init.d >> $RELEASE/DEBIAN/dirs
fi
cat <<EOF > $RELEASE/DEBIAN/postinst cat <<EOF > $RELEASE/DEBIAN/postinst
#!/bin/sh #!/bin/sh
echo "Instructions:" echo "Instructions:"
@@ -100,9 +125,24 @@ echo "1. Edit /etc/default/ebusd if necessary"
echo " (especially if your device is not /dev/ttyUSB0)" echo " (especially if your device is not /dev/ttyUSB0)"
echo "2. Place CSV configuration files in /etc/ebusd/" echo "2. Place CSV configuration files in /etc/ebusd/"
echo " (see https://github.com/john30/ebusd-configuration)" echo " (see https://github.com/john30/ebusd-configuration)"
echo "3. To start the daemon, enter 'service ebusd start'" echo "3. Start the daemon with 'systemctl start ebusd'"
echo "4. Check the log file /var/log/ebusd.log" echo "4. Check the log file /var/log/ebusd.log"
echo "5. Make the daemon autostart with 'systemctl enable ebusd'"
EOF EOF
else
echo /etc/init.d >> $RELEASE/DEBIAN/dirs
cat <<EOF > $RELEASE/DEBIAN/postinst
#!/bin/sh
echo "Instructions:"
echo "1. Edit /etc/default/ebusd if necessary"
echo " (especially if your device is not /dev/ttyUSB0)"
echo "2. Place CSV configuration files in /etc/ebusd/"
echo " (see https://github.com/john30/ebusd-configuration)"
echo "3. Start the daemon with 'service ebusd start'"
echo "4. Check the log file /var/log/ebusd.log"
echo "5. Make the daemon autostart with 'update-rc.d ebusd enable'"
EOF
fi
chmod 755 $RELEASE/DEBIAN/postinst chmod 755 $RELEASE/DEBIAN/postinst
dpkg -b $RELEASE || exit 1 dpkg -b $RELEASE || exit 1
@@ -114,7 +154,11 @@ echo " cleanup"
echo "*************" echo "*************"
echo echo
cd .. cd ..
if [ -n "$keepbuilddir" ]; then
echo "keeping build directory $BUILD"
else
rm -rf "$BUILD" rm -rf "$BUILD"
fi
echo echo
echo "Package created: ${PACKAGE}.deb" echo "Package created: ${PACKAGE}.deb"