-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
83 lines (71 loc) · 2.24 KB
/
install.sh
File metadata and controls
83 lines (71 loc) · 2.24 KB
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
#!/usr/bin/env sh
set -eu
# Downloads the latest tarball from https://atom-factory.com/xen/releases and
# unpacks it into ~/.local/xen. If you'd prefer to do this manually, instructions
# can be found at https://atom-factory.com/xen/get-started.html
main() {
platform="$(uname -s)"
arch="$(uname -m)"
if [ -n "${TMPDIR:-}" ] && [ -d "${TMPDIR}" ]; then
temp="$(mktemp -d "$TMPDIR/xen-XXXXXX")"
else
temp="$(mktemp -d "/tmp/xen-XXXXXX")"
fi
if [ "$platform" = "Linux" ]; then
platform="linux"
else
echo "Unsupported platform $platform"
exit 1
fi
case "$platform-$arch" in
linux-x86* | linux-i686*)
arch="x86_64"
;;
*)
echo "Unsupported platform or architecture"
exit 1
;;
esac
if command -v curl >/dev/null 2>&1; then
curl () {
command curl -fL "$@"
}
elif command -v wget >/dev/null 2>&1; then
curl () {
wget -O- "$@"
}
else
echo "Could not find 'curl' or 'wget' in your path"
exit 1
fi
"$platform" "$@"
if [ "$(command -v xen)" = "$HOME/.local/xen/bin/xen" ]; then
echo "Xen has been installed. Run with 'xen'"
else
echo "To run Xen from your terminal, you must add ~/.local/xen/bin to your PATH"
echo "Run:"
case "$SHELL" in
*zsh)
echo " echo 'export PATH=\$HOME/.local/xen/bin:\$PATH' >> ~/.zshrc"
echo " source ~/.zshrc"
;;
*fish)
echo " fish_add_path -U $HOME/.local/bin"
;;
*)
echo " echo 'export PATH=\$HOME/.local/xen/bin:\$PATH' >> ~/.bashrc"
echo " source ~/.bashrc"
;;
esac
echo "To run Xen now, '~/.local/xen/bin/xen'"
fi
}
linux() {
echo "Downloading Xen"
curl "https://github.com/jakerieger/Xen/releases/download/v0.5.5/Xen-0.5.5-linux-x64.tar.gz" > "$temp/Xen-0.5.5-linux-x64.tar.gz"
rm -rf "$HOME/.local/xen"
mkdir -p "$HOME/.local/xen"
tar -xzf "$temp/Xen-0.5.5-linux-x64.tar.gz" -C "$HOME/.local/xen/"
rm -f "$temp/Xen-0.5.5-linux-x64.tar.gz"
}
main "$@"