-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
setup-util-teip
executable file
·90 lines (82 loc) · 2.36 KB
/
setup-util-teip
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env bash
# https://github.com/greymd/teip
# cut alternative
# https://github.com/greymd/teip/releases
# teip-2.3.2.aarch64-apple-darwin.tar.gz
# teip-2.3.2.aarch64-unknown-linux-musl.deb
# teip-2.3.2.aarch64-unknown-linux-musl.rpm
# teip-2.3.2.aarch64-unknown-linux-musl.tar.gz
# teip-2.3.2.arm-unknown-linux-gnueabihf.deb
# teip-2.3.2.arm-unknown-linux-gnueabihf.tar.gz
# teip-2.3.2.x86_64-apple-darwin.tar.gz
# teip-2.3.2.x86_64-unknown-linux-musl.deb
# teip-2.3.2.x86_64-unknown-linux-musl.rpm
# teip-2.3.2.x86_64-unknown-linux-musl.tar.gz
# teip_installer-2.3.2-x86_64-pc-windows-msvc.exe
# arm64
# https://github.com/greymd/teip/issues/23
# https://repology.org/project/teip/versions
function setup_util_teip() (
source "$DOROTHY/sources/bash.bash"
# improve performance for detectable utilities with conditional assets
if setup-util "$@" --check --cli=teip; then
return 0
fi
# aur is outddated
local arch options=(
--cli='teip'
"$@"
BREW='greymd/tools/teip'
CARGO='teip'
NIX='teip'
)
function get_github_asset_url {
github-download \
--dry \
--slug='greymd/teip' \
--latest \
--asset-regexp="$(echo-escape-regexp -- "$1")$" | echo-first-line || :
}
function add_download_option {
options+=(
DOWNLOAD="$(get_github_asset_url "$1")"
DOWNLOAD_ARCHIVE_GLOB='bin/teip'
)
}
function add_deb_option {
options+=(
DEB="$(get_github_asset_url "$1")"
)
}
function add_rpm_option {
options+=(
RPM="$(get_github_asset_url "$1")"
)
}
arch="$(get-arch)"
if is-mac; then
if test "$arch" = 'a64'; then
add_download_option '.aarch64-apple-darwin.tar.gz'
elif test "$arch" = 'x64'; then
add_download_option '.x86_64-apple-darwin.tar.gz'
fi
elif is-linux; then
if test "$arch" = 'a64'; then
add_rpm_option '.aarch64-unknown-linux-musl.rpm'
add_deb_option '.aarch64-unknown-linux-musl.deb'
add_download_option '.aarch64-unknown-linux-musl.tar.gz'
elif test "$arch" = 'a32'; then
add_deb_option '.arm-unknown-linux-gnueabihf.deb'
add_download_option '.arm-unknown-linux-gnueabihf.tar.gz'
elif test "$arch" = 'x64'; then
add_rpm_option '.x86_64-unknown-linux-musl.rpm'
add_deb_option '.x86_64-unknown-linux-musl.deb'
add_download_option '.x86_64-unknown-linux-musl.tar.gz'
fi
fi
setup-util "${options[@]}"
)
# fire if invoked standalone
if test "$0" = "${BASH_SOURCE[0]}"; then
setup_util_teip "$@"
fi