icinga-build-package 1022 Bytes
Newer Older
Markus Frosch's avatar
Markus Frosch committed
1 2 3
#!/bin/bash

# detecting files
4
FILES_SPEC="$(ls ./*.spec 2>/dev/null)"
5
FILES_DEBIAN="$(ls -d ./debian ./*/debian 2>/dev/null)"
Markus Frosch's avatar
Markus Frosch committed
6 7 8 9

if [ -n "${FILES_SPEC}" ]; then
  echo "Detected RPM source: ${FILES_SPEC}"
  echo
Markus Frosch's avatar
Markus Frosch committed
10
  echo "[ running source build ]"
11
  if ! icinga-build-rpm-source; then
Markus Frosch's avatar
Markus Frosch committed
12 13 14 15 16 17
    echo "[ source build failed! ]"
    exit 1
  fi
  echo "[ source build completed ]"
  echo
  echo "[ running binary build ]"
18
  if ! icinga-build-rpm-binary; then
Markus Frosch's avatar
Markus Frosch committed
19 20 21 22
    echo "[ binary build failed! ]"
    exit 1
  fi
  echo "[ binary build completed ]"
Markus Frosch's avatar
Markus Frosch committed
23
elif [ -n "${FILES_DEBIAN}" ]; then
24
  echo "Detected Debian packaging paths: ${FILES_DEBIAN}"
Markus Frosch's avatar
Markus Frosch committed
25 26
  echo
  echo "[ running source build ]"
27
  if ! icinga-build-deb-source; then
Markus Frosch's avatar
Markus Frosch committed
28 29 30 31 32 33 34
    echo "[ source build failed! ]"
    exit 1
  fi
  echo "[ source build completed ]"
  echo

  echo "[ running binary build ]"
35
  if ! icinga-build-deb-binary; then
Markus Frosch's avatar
Markus Frosch committed
36 37 38 39 40 41 42 43
    echo "[ binary build failed! ]"
    exit 1
  fi
  echo "[ binary build completed ]"
else
  echo "Could not detect build type!" >&2
  exit 1
fi