diff options
author | Toby Vincent <tobyv13@gmail.com> | 2021-09-08 14:31:03 -0500 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2021-09-08 14:31:03 -0500 |
commit | 8c16029d554250097ec7c0f159727184d3450668 (patch) | |
tree | e99040801d4cb35219f84ecd18df0a1bf6d0ec64 /bat | |
parent | a972e43ee1bcbb799db1dc93f7c60c5e3d9bb819 (diff) |
fix: fixed bat install
Diffstat (limited to 'bat')
-rwxr-xr-x | bat/install | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/bat/install b/bat/install index e3ce8e0..d5f3ecc 100755 --- a/bat/install +++ b/bat/install @@ -26,7 +26,7 @@ else echo "$app: found $current_version" fi -latest_version=$(curl -s "https://github.com/sharkdp/$app/releases/latest" | grep -oE '[0-9]+.[0-9\.]+') +latest_version=$(curl -s "https://github.com/sharkdp/${app}/releases/latest" | grep -oE '[0-9]+.[0-9\.]+') if [ "$2" ]; then latest_version=$2 @@ -38,9 +38,22 @@ else echo "$app: new version found $latest_version" echo "$app: downloading..." - arch="$(dpkg --print-architecture)" - - curl -fsSLo ${app}_${arch}.deb "https://github.com/sharkdp/$app/releases/download/v$latest_version/${app}_${latest_version}_${arch}.deb" - sudo dpkg -i ${app}_${arch}.deb - rm ${app}_${arch}.deb + + if [ `whoami` != root ]; then + arch="$(uname -m)" + + filename="${app}-v${latest_version}-${arch}-unknown-linux-musl" + curl -fsSLo "${filename}.tar.gz" "https://github.com/sharkdp/${app}/releases/download/v${latest_version}/${filename}.tar.gz" + tar -zxvf "${filename}.tar.gz" "${filename}/${app}" + mv "${filename}/${app}" "${HOME}/.local/bin/" + rm -r "${filename}" + rm "${filename}.tar.gz" + else + arch="$(dpkg --print-architecture)" + + filename="${app}_v${latest_version}_${arch}" + curl -fsSLo ${filename}.deb "https://github.com/sharkdp/${app}/releases/download/v${latest_version}/${filename}.deb" + sudo dpkg -i ${filename}.deb + rm ${filename}.deb + fi fi |