forked from JoshuaJewell/MetaManifold-WebUI
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·123 lines (106 loc) · 3.5 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·123 lines (106 loc) · 3.5 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/usr/bin/env bash
# SPDX-License-Identifier: AGPL-3.0-only
#
# Bootstrap installer for MetabarcodingPipeline
#
# Checks for Julia and R, installs Julia via juliaup if missing,
# then hands off to install.jl for all further dependency setup.
#
# Usage:
# bash install.sh [--update] [--modify] [--sysimage]
#
# Options:
# --update Abort any in-progress merge, sync tracked files to origin/main,
# clean generated build artifacts, then re-assert the pinned tool
# versions in bin/ (see config/defaults/tool_versions.yml). This
# re-fetches the pins; it does not advance them.
# --modify Revisit configured tool paths instead of silently reusing them
# --sysimage Pass through to install.jl to build the Julia sysimage
set -euo pipefail
UPDATE_MODE=false
for arg in "$@"; do
if [ "$arg" = "--update" ]; then
UPDATE_MODE=true
break
fi
done
# OS detection
OS="$(uname -s)"
case "$OS" in
Linux*) OS_TYPE="Linux" ;;
Darwin*) OS_TYPE="macOS" ;;
*)
echo "Unsupported OS: $OS"
echo "This installer supports Linux and macOS only."
exit 1
;;
esac
echo "Detected OS: $OS_TYPE"
echo ""
update_checkout() {
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "--update requested, but this directory is not a Git worktree."
echo "Skipping checkout sync."
echo ""
return
fi
if ! git remote get-url origin >/dev/null 2>&1; then
echo "--update requested, but no 'origin' remote is configured."
echo "Skipping checkout sync."
echo ""
return
fi
echo "Syncing checkout to origin/main..."
git merge --abort >/dev/null 2>&1 || true
git fetch origin
git reset --hard origin/main
echo ""
}
if [ "$UPDATE_MODE" = true ]; then
update_checkout
fi
# Julia check and install
if command -v julia &>/dev/null; then
echo "Found Julia: $(julia --version)"
else
echo "Julia not found. Installing via juliaup..."
curl -fsSL --proto '=https' --proto-redir '=https' https://install.julialang.org | sh -s -- --yes
# juliaup installs to ~/.juliaup; source the env file if present
if [ -f "$HOME/.juliaup/env" ]; then
# shellcheck disable=SC1091
source "$HOME/.juliaup/env"
fi
export PATH="$HOME/.juliaup/bin:$PATH"
if command -v julia &>/dev/null; then
echo "Julia installed: $(julia --version)"
else
echo ""
echo "Julia was installed but is not yet in PATH."
echo "Please open a new terminal and re-run this script, or install Julia"
echo "manually from https://julialang.org/downloads/ and try again."
exit 1
fi
fi
# R check and politely ask user to do it for us
if command -v Rscript &>/dev/null; then
echo "Found R: $(Rscript --version 2>&1 | head -1)"
else
echo ""
echo "R is not installed. Please install R for your system and re-run this script."
echo ""
if [ "$OS_TYPE" = "Linux" ]; then
echo " Ubuntu/Debian: https://cran.r-project.org/bin/linux/ubuntu/"
echo " Fedora/RHEL: https://cran.r-project.org/bin/linux/fedora/"
echo " Quick install: sudo apt install r-base (Debian/Ubuntu)"
elif [ "$OS_TYPE" = "macOS" ]; then
echo " macOS pkg: https://cran.r-project.org/bin/macosx/"
echo " Homebrew: brew install r"
fi
echo ""
exit 1
fi
# Dependency installs by Julia
echo ""
echo "Running install.jl..."
echo ""
julia --project=. install.jl "$@"