github.com/google/fleetspeak@v0.1.15-0.20240426164851-4f31f62c1aea/fleetspeak/build-pkgs.sh (about)

     1  #!/bin/bash
     2  # Copyright 2019 Google LLC.
     3  #
     4  # Licensed under the Apache License, Version 2.0 (the "License");
     5  # you may not use this file except in compliance with the License.
     6  # You may obtain a copy of the License at
     7  #
     8  #     https://www.apache.org/licenses/LICENSE-2.0
     9  #
    10  # Unless required by applicable law or agreed to in writing, software
    11  # distributed under the License is distributed on an "AS IS" BASIS,
    12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  # See the License for the specific language governing permissions and
    14  # limitations under the License.
    15  
    16  set -e
    17  
    18  /bin/echo >&2 ""
    19  /bin/echo >&2 "Building binaries"
    20  
    21  export BINDIR="$(mktemp -d)"
    22  trap "rm -rf ${BINDIR}" EXIT
    23  
    24  cd ..
    25  CGO_ENABLED=0 GOBIN="${BINDIR}" go install ./cmd/...
    26  cd -
    27  
    28  /bin/echo >&2 ""
    29  /bin/echo >&2 "Building server.deb"
    30  
    31  export DEB_DEST="server-pkg/debian/fleetspeak-server"
    32  export DEB_VERSION=$(cat ../VERSION)
    33  
    34  fakeroot bash -c '
    35    set -e
    36    rm -rf server-pkg
    37    cp -r server-pkg-tmpl server-pkg
    38  
    39    chmod 755 server-pkg/*
    40  
    41    cd server-pkg
    42    debchange --create \
    43      --newversion "${DEB_VERSION}" \
    44      --package fleetspeak-server \
    45      --urgency low \
    46      --controlmaint \
    47      --distribution unstable \
    48      "Built by GitHub Actions at ${GITHUB_SHA}"
    49    cd -
    50  
    51    mkdir -p server-pkg/usr/bin
    52    install -o root -g root "${BINDIR}/fleetspeak_server" server-pkg/usr/bin/fleetspeak-server
    53    install -o root -g root "${BINDIR}/fleetspeak_config" server-pkg/usr/bin/fleetspeak-config
    54    install -o root -g root "${BINDIR}/fleetspeak_admin" server-pkg/usr/bin/fleetspeak-admin
    55  
    56    cd server-pkg
    57    dpkg-buildpackage -us -uc
    58    cd -
    59  '
    60  
    61  /bin/echo >&2 ""
    62  /bin/echo >&2 "Building client.deb"
    63  fakeroot bash -c '
    64    set -e
    65    rm -rf client-pkg
    66    cp -r client-pkg-tmpl client-pkg
    67  
    68    chmod 755 client-pkg/*
    69  
    70    cd client-pkg
    71    debchange --create \
    72      --newversion "${DEB_VERSION}" \
    73      --package fleetspeak-client \
    74      --urgency low \
    75      --controlmaint \
    76      --distribution unstable \
    77      "Built by GitHub Actions at ${GITHUB_SHA}"
    78    cd -
    79  
    80    mkdir -p client-pkg/usr/bin
    81    install -o root -g root "${BINDIR}/fleetspeak_client" client-pkg/usr/bin/fleetspeak-client
    82  
    83    cd client-pkg
    84    dpkg-buildpackage -us -uc
    85    cd -
    86  '