-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathinstall.sh
executable file
·96 lines (75 loc) · 2.36 KB
/
install.sh
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
91
92
93
94
95
96
#! /usr/bin/env bash
set -euo pipefail
cat << EOF
|_ _ _ _ _|
| |(_)(_|| (_|
command organizer
hoard setup
https://github.com/hyde46/hoard
Please create an issue if you encounter any problems!
===============================================================================
EOF
__hoard_install_with_cargo(){
echo "Building from source..."
## Check if cargo is installed
if ! command -v cargo &> /dev/null
then
echo "cargo not found"
if command -v rustup &> /dev/null
then
echo "rustup was found, but cargo wasn't. Something is up with your installation"
exit 1
fi
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -q
echo "rustup installed! Attempting cargo install"
cargo install hoard-rs
fi
}
__hoard_install_ubuntu(){
echo "Assuming Ubuntu distro. Trying to install .deb package"
ARTIFACT_URL="https://github.com/hyde46/hoard/releases/download/v2.0.0/hoard_2.0.0.deb"
TEMP_DEB="$(mktemp)" &&
wget -O "$TEMP_DEB" "$ARTIFACT_URL"
sudo dpkg -i "$TEMP_DEB"
rm -f "$TEMP_DEB"
}
__hoard_install_mac(){
echo "MacOS detected."
echo "Not yet supported by installer.sh"
echo "please install hoard from source with cargo or with brew"
echo "brew tap add Hyde46/hoard"
echo "brew install hoard"
echo "To install as zshell plug, run:"
echo 'echo "hoard shell_config zsh | source" >> ~/.zshrc'
}
__hoard_detect_os(){
case "$OSTYPE" in
linux*) __hoard_install_ubuntu ;;
#linux*) __hoard_install_linux ;;
darwin*) __hoard_install_mac ;;
#*) __hoard_install_unsupported ;;
esac
}
PS3='How do you wish to install hoard: '
foods=("From Source with cargo" "OS-Specific" "Not at all, bye")
select fav in "${foods[@]}"; do
case $fav in
"From Source with cargo")
__hoard_install_with_cargo
break
;;
"OS-Specific")
__hoard_detect_os
break
;;
"Not at all, bye")
echo "Bye!"
break
;;
*) echo "invalid option $REPLY";;
esac
done
# TODO: Properly check which shell is installed
echo 'hoard shell-config --shell zsh | source' >> ~/.zshrc
echo 'hoard shell-config --shell bash | source' >> ~/.bashrc
echo 'source your .bashrc/.zshrc and press <Ctrl-H> to get started with the interactive hoard UI'