Skip to content

Commit 4e243dc

Browse files
committed
Fix cwd
1 parent 6efb317 commit 4e243dc

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

scripts/distribute.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727

2828
set -eEuo pipefail
2929

30-
source "$(git rev-parse --show-toplevel)/scripts/lib.sh"
30+
ROOT_DIR="$(git rev-parse --show-toplevel)"
31+
cd "${ROOT_DIR}"
32+
33+
source "${ROOT_DIR}/scripts/lib.sh"
3134

3235
log_info "Using shared library functions for enhanced logging and utilities."
3336

@@ -79,10 +82,10 @@ function build_binary() {
7982

8083
local build_flags="-ldflags=-s -w -X main.version=${version} -X main.commit=${full_sha}"
8184

82-
go build "${build_flags}" -o "distribute/${arch}/${binary_name}" ./cmd/cache_apt_pkgs
85+
go build "${build_flags}" -o "./distribute/${arch}/${binary_name}" ./cmd/cache_apt_pkgs
8386

8487
# Make executable (no-op on Windows but harmless)
85-
chmod +x "distribute/${arch}/${binary_name}"
88+
chmod +x "./distribute/${arch}/${binary_name}"
8689
}
8790

8891
# Generate checksums for binaries
@@ -101,10 +104,10 @@ function generate_checksums() {
101104
# Verify build output
102105
function verify_build() {
103106
local arch="$1"
104-
ls -la "distribute/${arch}/"
105-
if [[ -f "distribute/${arch}/cache_apt_pkgs" ]]; then
107+
ls -la "./distribute/${arch}/"
108+
if [[ -f "./distribute/${arch}/cache_apt_pkgs" ]]; then
106109
log_info "Binary built successfully"
107-
file "distribute/${arch}/cache_apt_pkgs"
110+
file "./distribute/${arch}/cache_apt_pkgs"
108111
else
109112
log_error "Binary not found!"
110113
exit 1
@@ -113,18 +116,18 @@ function verify_build() {
113116

114117
# Reorganize artifacts
115118
function reorganize_artifacts() {
116-
mkdir -p distribute
117-
for arch_dir in distribute-artifacts/cache-apt-pkgs-*; do
119+
mkdir -p ./distribute
120+
for arch_dir in ./distribute-artifacts/cache-apt-pkgs-*; do
118121
if [[ -d ${arch_dir} ]]; then
119122
local arch_name
120123
arch_name=$(basename "${arch_dir}" | sed 's/cache-apt-pkgs-\(.*\)-[a-f0-9]*/\1/')
121-
cp -r "${arch_dir}"/* "distribute/${arch_name}/" 2>/dev/null || mkdir -p "distribute/${arch_name}"
122-
cp "${arch_dir}"/* "distribute/${arch_name}/" 2>/dev/null || true
124+
cp -r "${arch_dir}"/* "./distribute/${arch_name}/" 2>/dev/null || mkdir -p "./distribute/${arch_name}"
125+
cp "${arch_dir}"/* "./distribute/${arch_name}/" 2>/dev/null || true
123126
fi
124127
done
125128

126129
log_info "Final distribute structure:"
127-
find distribute -type f -exec ls -la {} \;
130+
find ./distribute -type f -exec ls -la {} \;
128131
}
129132

130133
# Main script logic

0 commit comments

Comments
 (0)