revert: Makefile buff-ification (#3700) (#3848)

This caused the following issues:
- Slim binaries weren't being updated.
- The coder.tar.ztd was misplaced.
- There is no coder.sha1 file with proper filenames.

This should be reintroduced in a future change with those fixes.
This commit is contained in:
Kyle Carberry
2022-09-02 14:46:58 -05:00
committed by GitHub
parent d350d9033c
commit e490bdd531
16 changed files with 709 additions and 517 deletions
+21 -29
View File
@@ -1,21 +1,22 @@
#!/usr/bin/env bash
# This script creates a Linux package for the given binary.
# This script creates Linux packages for the given binary. It will output a
# .rpm, .deb and .apk file in the same directory as the input file with the same
# filename (except the package format suffix).
#
# ./package.sh --arch amd64 --format "(apk|deb|rpm)" --output "path/to/coder.apk" [--version 1.2.3] path/to/coder
# ./package.sh --arch amd64 [--version 1.2.3] path/to/coder
#
# If no version is specified, defaults to the version from ./version.sh.
# The --arch parameter is required. If no version is specified, defaults to the
# version from ./version.sh.
set -euo pipefail
# shellcheck source=scripts/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
arch=""
format=""
output_path=""
version=""
arch=""
args="$(getopt -o "" -l arch:,format:,output:,version: -- "$@")"
args="$(getopt -o "" -l arch:,version: -- "$@")"
eval set -- "$args"
while true; do
case "$1" in
@@ -23,15 +24,6 @@ while true; do
arch="$2"
shift 2
;;
--format)
format="$2"
shift 2
;;
--output)
mkdir -p "$(dirname "$2")"
output_path="$(realpath "$2")"
shift 2
;;
--version)
version="$2"
shift 2
@@ -49,12 +41,6 @@ done
if [[ "$arch" == "" ]]; then
error "--arch is a required parameter"
fi
if [[ "$format" != "apk" ]] && [[ "$format" != "deb" ]] && [[ "$format" != "rpm" ]]; then
error "--format is a required parameter and must be one of 'apk', 'deb', or 'rpm'"
fi
if [[ "$output_path" == "" ]]; then
error "--output is a required parameter"
fi
if [[ "$#" != 1 ]]; then
error "Exactly one argument must be provided to this script, $# were supplied"
@@ -88,12 +74,18 @@ ln "$(realpath coder.service)" "$temp_dir/"
ln "$(realpath preinstall.sh)" "$temp_dir/"
ln "$(realpath scripts/nfpm.yaml)" "$temp_dir/"
pushd "$temp_dir"
GOARCH="$arch" CODER_VERSION="$version" nfpm package \
-f nfpm.yaml \
-p "$format" \
-t "$output_path" \
1>&2
popd
cd "$temp_dir"
formats=(apk deb rpm)
for format in "${formats[@]}"; do
output_path="$input_file.$format"
log "--- Building $format package ($output_path)"
GOARCH="$arch" CODER_VERSION="$version" nfpm package \
-f nfpm.yaml \
-p "$format" \
-t "$output_path"
done
cdroot
rm -rf "$temp_dir"