blob: cdd9713113cc7b11ed07565f53043103e54e9ba0 (
plain) (
blame)
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
|
function () {
__EGET_LOCATION="$HOME/.local/bin/eget"
__EGET_CONFIG="$HOME/.eget.toml"
__EGET_CONFIG_LOCAL="$HOME/.eget.local.toml"
if [ -x "$__EGET_LOCATION" ] ; then
function eget() {
config="$__EGET_CONFIG"
if [ -f "$__EGET_CONFIG_LOCAL" ] ; then
config=$(mktemp -t eget.config.XXXXX --suffix .toml)
trap "rm '$config'" EXIT
cat "$__EGET_CONFIG" "$__EGET_CONFIG_LOCAL" >"$config" 2>/dev/null
fi
(export EGET_CONFIG="$config" && "$__EGET_LOCATION" "$@")
}
fi
if [ ! -x "$__EGET_LOCATION" ] ; then
function eget() {
local EGET_SCRIPT_URL="https://zyedidia.github.io/eget.sh"
local EGET_SCRIPT_CHECKSUM="0e64b8a3c13f531da005096cc364ac77835bda54276fedef6c62f3dbdc1ee919"
vared -p 'No eget found, install it?: (y/N) ' -c answer
case "$answer" in
y|Y)
unset -f eget
temp_file=$(mktemp)
trap 'rm -f "$temp_file"' EXIT
mkdir -p "$(dirname "$__EGET_LOCATION")"
curl -o "$temp_file" "$EGET_SCRIPT_URL"
echo "$EGET_SCRIPT_CHECKSUM $temp_file" | shasum --algorithm 256 --check --quiet
(cd $(dirname "$__EGET_LOCATION") && sh "$temp_file")
;;
*)
return
;;
esac
answer=""
vared -p 'Download all by eget?: (y/N) ' -c answer
case "$answer" in
y|Y)
eget --download-all
;;
esac
}
fi
}
# vim: ft=zsh
|