-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
66 lines (58 loc) · 1.84 KB
/
install.sh
File metadata and controls
66 lines (58 loc) · 1.84 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
#!/usr/bin/env bash
set -euo pipefail
REPO_URL="https://github.com/aayushbhaskar/OpenCouncil.git"
INSTALL_DIR="${HOME}/.open-council-app"
VENV_DIR="${INSTALL_DIR}/venv"
BIN_DIR="${HOME}/.local/bin"
EXECUTABLE="${BIN_DIR}/council"
echo "Installing Open Council..."
if [[ -d "${INSTALL_DIR}/.git" ]]; then
echo "Updating existing installation in ${INSTALL_DIR}"
git -C "${INSTALL_DIR}" fetch --quiet origin
git -C "${INSTALL_DIR}" checkout --quiet main
git -C "${INSTALL_DIR}" pull --quiet --ff-only origin main
else
echo "Cloning Open Council into ${INSTALL_DIR}"
rm -rf "${INSTALL_DIR}"
git clone --quiet "${REPO_URL}" "${INSTALL_DIR}"
fi
echo "Creating virtual environment..."
python3 -m venv "${VENV_DIR}"
echo "Installing package in editable mode..."
"${VENV_DIR}/bin/pip" install --quiet -e "${INSTALL_DIR}"
echo "Linking executable..."
mkdir -p "${BIN_DIR}"
ln -sf "${VENV_DIR}/bin/council" "${EXECUTABLE}"
if [[ ":${PATH}:" != *":${BIN_DIR}:"* ]]; then
echo
echo "Add ${BIN_DIR} to PATH to use council globally."
echo "Run now (current shell):"
echo " export PATH=\"${BIN_DIR}:\$PATH\""
echo
echo "Or run council directly without PATH:"
echo " ${EXECUTABLE} --mode odin"
echo
if [[ -n "${SHELL:-}" ]]; then
case "${SHELL}" in
*/zsh)
echo "Persist for future sessions:"
echo " echo 'export PATH=\"${BIN_DIR}:\$PATH\"' >> ~/.zshrc"
;;
*/bash)
echo "Persist for future sessions:"
echo " echo 'export PATH=\"${BIN_DIR}:\$PATH\"' >> ~/.bashrc"
;;
*)
echo "Persist for your shell by adding this to your shell rc file:"
echo " export PATH=\"${BIN_DIR}:\$PATH\""
;;
esac
fi
fi
echo
echo "Open Council installed."
if [[ ":${PATH}:" == *":${BIN_DIR}:"* ]]; then
echo "Run: council --mode odin"
else
echo "Run: ${EXECUTABLE} --mode odin"
fi