Skip to content

Commit 765ac2b

Browse files
bestapspeterbarker
authored andcommitted
Update Sphinxsetup.sh
Adding update for script to run on MacOS. additions added from Line 24 to Line 44. The code checks for MacOS and checks for homebrew and uses brew to install relevant scripts
1 parent 96d71ba commit 765ac2b

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

Sphinxsetup.sh

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,42 @@ if [ "$UID" -eq 0 ]; then
77
exit 1
88
fi
99

10-
DISTRIBUTION_ID=$(lsb_release -i -s)
10+
# Check for lsb_release and set distribution variables safely
11+
if command -v lsb_release &> /dev/null; then
12+
DISTRIBUTION_ID=$(lsb_release -i -s)
13+
DISTRIBUTION_CODENAME=$(lsb_release -c -s)
14+
else
15+
DISTRIBUTION_ID=""
16+
DISTRIBUTION_CODENAME=""
17+
fi
18+
1119
if [ ${DISTRIBUTION_ID} = 'Ubuntu' ]; then
12-
DISTRIBUTION_CODENAME=$(lsb_release -c -s)
1320
if [ ${DISTRIBUTION_CODENAME} = 'focal' ] || [ ${DISTRIBUTION_CODENAME} = 'bionic' ]; then
1421
sudo add-apt-repository universe
1522
fi
1623
fi
1724

25+
# Check for macOS
26+
if [[ "$(uname)" == "Darwin" ]]; then
27+
echo "Detected macOS. Installing dependencies using Homebrew."
28+
# Check for Homebrew and install if missing
29+
if ! command -v brew &> /dev/null; then
30+
echo "Homebrew not found. Installing Homebrew."
31+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
32+
export PATH="/usr/local/bin:/opt/homebrew/bin:$PATH"
33+
fi
34+
brew update
35+
brew install git imagemagick curl wget make python3 unzip
36+
# Ensure pip is available
37+
if ! command -v pip3 &> /dev/null; then
38+
python3 -m ensurepip --upgrade || true
39+
fi
40+
SCRIPT_DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
41+
python3 -m pip install --user --upgrade -r "$SCRIPT_DIR"/requirements.txt
42+
echo "Setup completed successfully for macOS!"
43+
exit 0
44+
fi
45+
1846
sudo apt-get -y update
1947
sudo apt-get install -y unzip git imagemagick curl wget make python3
2048

0 commit comments

Comments
 (0)