Install Dosh binaries atomically
ci / test (push) Has been cancelled
ci / fuzz-smoke (push) Has been cancelled
ci / windows-client (push) Has been cancelled
ci / package-release (linux-x86_64, ubuntu-latest) (push) Has been cancelled
ci / package-release (macos-aarch64, macos-14) (push) Has been cancelled
ci / package-release (macos-x86_64, macos-13) (push) Has been cancelled
ci / package-release (windows-x86_64, windows-latest) (push) Has been cancelled
ci / remote-bench (push) Has been cancelled
ci / test (push) Has been cancelled
ci / fuzz-smoke (push) Has been cancelled
ci / windows-client (push) Has been cancelled
ci / package-release (linux-x86_64, ubuntu-latest) (push) Has been cancelled
ci / package-release (macos-aarch64, macos-14) (push) Has been cancelled
ci / package-release (macos-x86_64, macos-13) (push) Has been cancelled
ci / package-release (windows-x86_64, windows-latest) (push) Has been cancelled
ci / remote-bench (push) Has been cancelled
This commit is contained in:
+19
-6
@@ -226,13 +226,26 @@ find_extracted_binary() {
|
||||
find "$1" -type f -name "$2" 2>/dev/null | sed -n '1p'
|
||||
}
|
||||
|
||||
install_binary() {
|
||||
src="$1"
|
||||
dst="$2"
|
||||
dst_dir="$(dirname "$dst")"
|
||||
dst_base="$(basename "$dst")"
|
||||
tmp="$dst_dir/.$dst_base.tmp.$$"
|
||||
install -m 0755 "$src" "$tmp"
|
||||
if ! mv -f "$tmp" "$dst"; then
|
||||
rm -f "$tmp"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
install_extracted_binary() {
|
||||
found="$(find_extracted_binary "$1" "$2")"
|
||||
if [ -z "$found" ]; then
|
||||
echo "prebuilt archive missing $2" >&2
|
||||
return 1
|
||||
fi
|
||||
install -m 0755 "$found" "$3"
|
||||
install_binary "$found" "$3"
|
||||
}
|
||||
|
||||
sha256_file() {
|
||||
@@ -329,7 +342,7 @@ try_install_prebuilt() {
|
||||
install_extracted_binary "$tmpdir/extract" dosh-auth "$bindir/dosh-auth" || return 1
|
||||
fi
|
||||
if found_bench="$(find_extracted_binary "$tmpdir/extract" dosh-bench)" && [ -n "$found_bench" ]; then
|
||||
install -m 0755 "$found_bench" "$bindir/dosh-bench"
|
||||
install_binary "$found_bench" "$bindir/dosh-bench"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@@ -388,14 +401,14 @@ install_from_source() {
|
||||
fi
|
||||
fi
|
||||
|
||||
install -m 0755 target/release/dosh-client "$bindir/dosh-client"
|
||||
install_binary target/release/dosh-client "$bindir/dosh-client"
|
||||
ln -sf dosh-client "$bindir/dosh"
|
||||
if [ "$role" = "server" ] || [ "$role" = "both" ]; then
|
||||
install -m 0755 target/release/dosh-server "$bindir/dosh-server"
|
||||
install -m 0755 target/release/dosh-auth "$bindir/dosh-auth"
|
||||
install_binary target/release/dosh-server "$bindir/dosh-server"
|
||||
install_binary target/release/dosh-auth "$bindir/dosh-auth"
|
||||
fi
|
||||
if [ -f target/release/dosh-bench ]; then
|
||||
install -m 0755 target/release/dosh-bench "$bindir/dosh-bench"
|
||||
install_binary target/release/dosh-bench "$bindir/dosh-bench"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user