-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
system-setup.sh
executable file
·162 lines (140 loc) · 4.63 KB
/
system-setup.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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/bin/bash
SCRIPTS_DIR="${BASH_SOURCE%/*}"
source "${SCRIPTS_DIR}/lib"
_DEV_SETUP=${DEV_SETUP:=1}
_CHECK_CARGO=${CHECK_CARGO:=1}
_CHECK_NODE=${CHECK_NODE:=1}
_CHECK_DAV1D=${CHECK_DAV1D:=0}
_FORCE_INSTALL_YARN=${INSTALL_YARN:=0}
dev_setup() {
set -ex; \
cargo install cargo-watch; \
cargo install cargo-workspaces; \
yarn run setup; \
set +x
}
if [ "$name" == "nix-shell" ]; then
echo "Running nix-shell"
exit 0
fi
if [ ${_CHECK_CARGO} == 1 ]; then
which cargo &> /dev/null
if [ $? -ne 0 ]; then
log_error "Rust could not be found on your system. Visit https://www.rust-lang.org/tools/install"
fi
fi
if [ ${_CHECK_NODE} == 1 ]; then
which node &> /dev/null
if [ $? -eq 1 ]; then
log_error "Node could not be found on your system. Visit https://nodejs.org/en/download/"
fi
which yarn &> /dev/null
if [ $? -eq 1 ]; then
if [ ${_FORCE_INSTALL_YARN} == 1 ]; then
echo "Attempting to install 'yarn'..."
npm install -g yarn
else
echo "Yarn could not be found on your system. Would you like for this script to attempt to install 'yarn'? (y/n)"
can_continue=false
until [ $can_continue = true ]; do
read -p "Choice: " choice
case $choice in
y)
echo "Attempting to install 'yarn'..."
npm install -g yarn
if [ $? -eq 0 ]; then
echo "yarn installed successfully."
can_continue=true
else
can_continue=false
log_error "yarn could not be installed. Please ensure you have node and npm installed."
fi
;;
n)
echo "Skipping 'yarn' installation. Exiting."
can_continue=false
exit 1
;;
*)
echo "Invalid choice. Please enter 'y' or 'n'."
can_continue=false
;;
esac
echo
echo "Would you like for this script to attempt to install 'yarn'? (y/n)"
done
fi
else
echo "yarn requirement met!"
fi
fi
ASK_FOR_CONTRIB="Please consider helping to expand support for your system: https://github.com/stumpapp/stump/issues"
# https://tauri.app/v1/guides/getting-started/prerequisites/#1-system-dependencies
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
UNSUPPORTED_DISTRO="Your distro '$(lsb_release -s -d)' is not supported by this script. $ASK_FOR_CONTRIB"
# Note: If running ubuntu 24, see https://github.com/bambulab/BambuStudio/issues/3973#issuecomment-2085476683
if which apt-get &> /dev/null; then
sudo apt-get -y update
sudo apt-get -y install \
libwebkit2gtk-4.0-dev \
pkg-config \
build-essential \
curl \
wget \
file \
openssl \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
javascriptcoregtk-4.0 \
librsvg2-dev \
libvips42
elif which pacman &> /dev/null; then
sudo pacman -Syu
sudo pacman -S --needed webkit2gtk \
base-devel \
curl \
wget \
openssl \
appmenu-gtk-module \
gtk3 \
dav1d \
libappindicator-gtk3 librsvg libvips
elif which dnf &> /dev/null; then
sudo dnf check-update
sudo dnf install openssl-devel webkit2gtk4.0-devel curl wget libappindicator-gtk3 librsvg2-devel dav1d
sudo dnf group install "C Development Tools and Libraries"
else
log_error $UNSUPPORTED_DISTRO
fi
if [ {$_DEV_SETUP} == 1 ]; then
dev_setup
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
if ! which brew &> /dev/null; then
log_error "Homebrew is not installed. Visit https://brew.sh/ to install Homebrew."
fi
HOMEBREW_NO_AUTO_UPDATE=1 brew install dav1d
if [ {$_DEV_SETUP} == 1 ]; then
dev_setup
fi
else
log_error "Your OS '$OSTYPE' is not supported by the system-setup script. $ASK_FOR_CONTRIB"
fi
if [ ${_CHECK_DAV1D} == 1 ]; then
which dav1d &> /dev/null
if [ $? -ne 0 ]; then
echo "Dav1d requirement is not met. Visit https://code.videolan.org/videolan/dav1d"
else
curver="$(dav1d --version)"
cutoffver="1.3.0"
# Note: We sort -V and take the first line to get the highest version, so we need to assert that the first
# _isn't_ the threshold version
if [ "$(printf '%s\n' "$cutoffver" "$curver" | sort -V | head -n1)" != "$cutoffver" ]; then
echo "Dav1d requirement met!"
else
echo "Dav1d requirement is not met (version must be greater than 1.3.0). Visit https://code.videolan.org/videolan/dav1d"
fi
fi
fi
echo "Setup completed!"