71 lines
1.9 KiB
Bash
Executable File
71 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
source "$(cd "$(dirname "$0")/.." && pwd)/lib/common.sh"
|
|
|
|
require_cmd bash
|
|
require_cmd dpkg-deb
|
|
require_cmd git
|
|
|
|
load_build_config
|
|
|
|
work_root="$(ci_work_root)"
|
|
helper_dir="$work_root/hercules-helper"
|
|
artifacts_dir="$work_root/artifacts"
|
|
helper_entrypoint="$helper_dir/create-package-hyperion.sh"
|
|
compat_template_dir="$helper_dir/packagers/debian/hyperion-4.4"
|
|
build_path="/home/bill/hyperion-build-package"
|
|
raw_package_path="$build_path/hyperion-4.4.deb"
|
|
metadata_file="$artifacts_dir/package.env"
|
|
|
|
log "Preparing CI work root at $work_root"
|
|
rm -rf "$work_root"
|
|
mkdir -p "$artifacts_dir"
|
|
|
|
log "Cloning helper repo $REPO (branch: $BRANCH)"
|
|
git clone --depth 1 --branch "$BRANCH" "$REPO" "$helper_dir"
|
|
|
|
if [[ ! -e "$helper_entrypoint" ]]; then
|
|
ln -s "packagers/debian/create-package-hyperion.sh" "$helper_entrypoint"
|
|
fi
|
|
|
|
if [[ ! -e "$compat_template_dir" ]]; then
|
|
ln -s "hercules-hyperion" "$compat_template_dir"
|
|
fi
|
|
|
|
mkdir -p /home/bill
|
|
rm -rf "$build_path"
|
|
mkdir -p "$build_path"
|
|
|
|
log "Invoking helper repo Debian package script"
|
|
(
|
|
cd "$helper_dir"
|
|
env \
|
|
opt_prompts=false \
|
|
opt_beeps=false \
|
|
opt_verbose=true \
|
|
TRACE=false \
|
|
bash "$helper_entrypoint"
|
|
)
|
|
|
|
[[ -f "$raw_package_path" ]] || die "Expected package was not created: $raw_package_path"
|
|
|
|
package_name="$(dpkg-deb -f "$raw_package_path" Package)"
|
|
package_version="$(dpkg-deb -f "$raw_package_path" Version)"
|
|
package_arch="$(dpkg-deb -f "$raw_package_path" Architecture)"
|
|
artifact_path="$artifacts_dir/${package_name}_${package_version}_${package_arch}.deb"
|
|
|
|
cp "$raw_package_path" "$artifact_path"
|
|
|
|
cat >"$metadata_file" <<EOF
|
|
PACKAGE_FILE=$artifact_path
|
|
PACKAGE_NAME=$package_name
|
|
PACKAGE_VERSION=$package_version
|
|
PACKAGE_ARCHITECTURE=$package_arch
|
|
PACKAGE_DISTRIBUTION=${DEBIAN_DISTRIBUTION:-$DEFAULT_DEBIAN_DISTRIBUTION}
|
|
PACKAGE_COMPONENT=${DEBIAN_COMPONENT:-$DEFAULT_DEBIAN_COMPONENT}
|
|
EOF
|
|
|
|
log "Built package artifact: $artifact_path"
|