@@ -7,7 +7,7 @@ set -o allexport
77readonly githubRepository=' sst/opencode'
88readonly binaryName=' opencode'
99readonly versionArgument=' --version'
10- readonly downloadUrlTemplate=' https://github.com/${githubRepository}/releases/download/v${version}/${name}-linux-${architecture}.zip '
10+ readonly downloadUrlTemplate=' https://github.com/${githubRepository}/releases/download/v${version}/${name}-linux-${architecture}.tar.gz '
1111readonly binaryTargetFolder=' /usr/local/bin'
1212readonly name=" ${githubRepository##*/ } "
1313apt_get_update () {
@@ -40,8 +40,8 @@ check_curl_envsubst_file_unzip_installed() {
4040 if ! command -v file > /dev/null 2>&1 ; then
4141 requiredAptPackagesMissing+=(' file' )
4242 fi
43- if ! command -v unzip > /dev/null 2>&1 ; then
44- requiredAptPackagesMissing+=(' unzip ' )
43+ if ! command -v tar > /dev/null 2>&1 ; then
44+ requiredAptPackagesMissing+=(' tar ' )
4545 fi
4646 declare -i requiredAptPackagesMissingCount=${# requiredAptPackagesMissing[@]}
4747 if [ $requiredAptPackagesMissingCount -gt 0 ]; then
@@ -68,14 +68,12 @@ curl_download_stdout() {
6868 --connect-timeout 5 \
6969 " $url "
7070}
71- curl_download_unzip () {
71+ curl_download_tarball () {
7272 local url=$1
73- local strip=$2
74- local target=$3
75- local bin_path=$4
73+ local target=$2
7674 local temp_file=$( mktemp)
7775 curl_download_stdout " $url " > | " $temp_file "
78- unzip -j " $temp_file " " $bin_path " -d " $target "
76+ tar -xzf " $temp_file " -C " $target "
7977 rm " $temp_file "
8078}
8179debian_get_arch () {
@@ -127,10 +125,8 @@ install() {
127125 readonly version=" ${VERSION:? } "
128126 readonly downloadUrl=" $( echo -n " $downloadUrlTemplate " | envsubst) "
129127 curl_check_url " $downloadUrl "
130- readonly binaryPathInArchive=" $binaryName "
131- readonly stripComponents=" $( echo -n " $binaryPathInArchive " | awk -F' /' ' {print NF-1}' ) "
132128 readonly binaryTargetPath=" $( echo -n " $binaryTargetPathTemplate " | envsubst) "
133- curl_download_unzip " $downloadUrl " " $stripComponents " " $ binaryTargetFolder" " $binaryPathInArchive "
129+ curl_download_tarball " $downloadUrl " " $binaryTargetFolder "
134130 chmod 755 " $binaryTargetPath "
135131}
136132echo_banner " devcontainer.community"
0 commit comments