mirror of
https://github.com/anomalyco/opencode.git
synced 2026-02-01 22:48:16 +00:00
make install script use tmp dir (#5601)
This commit is contained in:
15
install
15
install
@@ -240,22 +240,23 @@ download_with_progress() {
|
|||||||
|
|
||||||
download_and_install() {
|
download_and_install() {
|
||||||
print_message info "\n${MUTED}Installing ${NC}opencode ${MUTED}version: ${NC}$specific_version"
|
print_message info "\n${MUTED}Installing ${NC}opencode ${MUTED}version: ${NC}$specific_version"
|
||||||
mkdir -p opencodetmp && cd opencodetmp
|
local tmp_dir="${TMPDIR:-/tmp}/opencode_install_$$"
|
||||||
|
mkdir -p "$tmp_dir"
|
||||||
|
|
||||||
if [[ "$os" == "windows" ]] || ! download_with_progress "$url" "$filename"; then
|
if [[ "$os" == "windows" ]] || ! download_with_progress "$url" "$tmp_dir/$filename"; then
|
||||||
# Fallback to standard curl on Windows or if custom progress fails
|
# Fallback to standard curl on Windows or if custom progress fails
|
||||||
curl -# -L -o "$filename" "$url"
|
curl -# -L -o "$tmp_dir/$filename" "$url"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$os" = "linux" ]; then
|
if [ "$os" = "linux" ]; then
|
||||||
tar -xzf "$filename"
|
tar -xzf "$tmp_dir/$filename" -C "$tmp_dir"
|
||||||
else
|
else
|
||||||
unzip -q "$filename"
|
unzip -q "$tmp_dir/$filename" -d "$tmp_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mv opencode "$INSTALL_DIR"
|
mv "$tmp_dir/opencode" "$INSTALL_DIR"
|
||||||
chmod 755 "${INSTALL_DIR}/opencode"
|
chmod 755 "${INSTALL_DIR}/opencode"
|
||||||
cd .. && rm -rf opencodetmp
|
rm -rf "$tmp_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_version
|
check_version
|
||||||
|
|||||||
Reference in New Issue
Block a user