You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scripts/cloudflared-ssh.sh
+65-47Lines changed: 65 additions & 47 deletions
Original file line number
Diff line number
Diff line change
@@ -179,66 +179,84 @@ ensureBasicDeps() {
179
179
}
180
180
ensureBasicDeps
181
181
182
-
# @description This function ensures Homebrew is installed and available in the `PATH`. It handles the installation of Homebrew on both **Linux and macOS**.
183
-
# It will attempt to bypass sudo password entry if it detects that it can do so. The function also has some error handling in regards to various
184
-
# directories falling out of the correct ownership and permission states. Finally, it loads Homebrew into the active profile (allowing other parts of the script
185
-
# to use the `brew` command).
186
-
#
187
-
# With Homebrew installed and available, the script finishes by installing the `gcc` Homebrew package which is a very common dependency.
188
-
ensureHomebrew() {
182
+
### Ensure Homebrew is loaded
183
+
loadHomebrew() {
189
184
if!command -v brew > /dev/null;then
190
-
if [ -d /home/linuxbrew/.linuxbrew/bin ];then
191
-
logg info "Sourcing from /home/linuxbrew/.linuxbrew/bin/brew"&&eval"$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
192
-
if!command -v brew > /dev/null;then
193
-
logg error "The /home/linuxbrew/.linuxbrew directory exists but something is not right. Try removing it and running the script again."&&exit 1
194
-
fi
195
-
elif [ -d"$HOME/.linuxbrew" ];then
196
-
logg info "Sourcing from $HOME/.linuxbrew/bin/brew"&&eval"$($HOME/.linuxbrew/bin/brew shellenv)"
197
-
if!command -v brew > /dev/null;then
198
-
logg error "The $HOME/.linuxbrew directory exists but something is not right. Try removing it and running the script again."&&exit 1
199
-
fi
185
+
if [ -f /usr/local/bin/brew ];then
186
+
logg info "Using /usr/local/bin/brew"&&eval"$(/usr/local/bin/brew shellenv)"
187
+
if [ -f"${HOMEBREW_PREFIX:-/opt/homebrew}/bin/brew" ];then
188
+
logg info "Using ${HOMEBREW_PREFIX:-/opt/homebrew}/bin/brew"&&eval"$("${HOMEBREW_PREFIX:-/opt/homebrew}/bin/brew" shellenv)"
189
+
if [ -d"$HOME/.linuxbrew" ];then
190
+
logg info "Using $HOME/.linuxbrew/bin/brew"&&eval"$("$HOME/.linuxbrew/bin/brew" shellenv)"
191
+
elif [ -d"/home/linuxbrew/.linuxbrew" ];then
192
+
logg info 'Using /home/linuxbrew/.linuxbrew/bin/brew'&&eval"(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
200
193
else
201
-
### Installs Homebrew and addresses a couple potential issues
logg warn 'Homebrew was installed but part of the installation failed to complete successfully.'
229
+
fixHomebrewPermissions
230
+
fi
231
231
fi
232
+
}
232
233
233
-
### Ensure GCC is installed via Homebrew
234
+
### Ensures gcc is installed
235
+
ensureGcc() {
234
236
ifcommand -v brew > /dev/null;then
235
237
if! brew list | grep gcc > /dev/null;then
236
-
logg info "Installing Homebrew gcc"&& brew install --quiet gcc
238
+
logg info 'Installing Homebrew gcc'&& brew install --quiet gcc
239
+
else
240
+
logg info 'Homebrew gcc is available'
237
241
fi
238
242
else
239
-
logg error "Failed to initialize Homebrew"&&exit2
243
+
logg error 'Failed to initialize Homebrew'&&exit1
240
244
fi
241
245
}
246
+
247
+
# @description This function ensures Homebrew is installed and available in the `PATH`. It handles the installation of Homebrew on both **Linux and macOS**.
248
+
# It will attempt to bypass sudo password entry if it detects that it can do so. The function also has some error handling in regards to various
249
+
# directories falling out of the correct ownership and permission states. Finally, it loads Homebrew into the active profile (allowing other parts of the script
250
+
# to use the `brew` command).
251
+
#
252
+
# With Homebrew installed and available, the script finishes by installing the `gcc` Homebrew package which is a very common dependency.
253
+
ensureHomebrew() {
254
+
loadHomebrew
255
+
ensurePackageManagerHomebrew
256
+
loadHomebrew
257
+
fixHomebrewPermissions
258
+
ensureGcc
259
+
}
242
260
ensureHomebrew
243
261
244
262
# @description Ensures `cloudflared` is installed via Homebrew
Copy file name to clipboardExpand all lines: scripts/homebrew.sh
+65-47Lines changed: 65 additions & 47 deletions
Original file line number
Diff line number
Diff line change
@@ -148,64 +148,82 @@ ensureBasicDeps() {
148
148
}
149
149
ensureBasicDeps
150
150
151
-
# @description This function ensures Homebrew is installed and available in the `PATH`. It handles the installation of Homebrew on both **Linux and macOS**.
152
-
# It will attempt to bypass sudo password entry if it detects that it can do so. The function also has some error handling in regards to various
153
-
# directories falling out of the correct ownership and permission states. Finally, it loads Homebrew into the active profile (allowing other parts of the script
154
-
# to use the `brew` command).
155
-
#
156
-
# With Homebrew installed and available, the script finishes by installing the `gcc` Homebrew package which is a very common dependency.
157
-
ensureHomebrew() {
151
+
### Ensure Homebrew is loaded
152
+
loadHomebrew() {
158
153
if!command -v brew > /dev/null;then
159
-
if [ -d /home/linuxbrew/.linuxbrew/bin ];then
160
-
logg info "Sourcing from /home/linuxbrew/.linuxbrew/bin/brew"&&eval"$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
161
-
if!command -v brew > /dev/null;then
162
-
logg error "The /home/linuxbrew/.linuxbrew directory exists but something is not right. Try removing it and running the script again."&&exit 1
163
-
fi
164
-
elif [ -d"$HOME/.linuxbrew" ];then
165
-
logg info "Sourcing from $HOME/.linuxbrew/bin/brew"&&eval"$($HOME/.linuxbrew/bin/brew shellenv)"
166
-
if!command -v brew > /dev/null;then
167
-
logg error "The $HOME/.linuxbrew directory exists but something is not right. Try removing it and running the script again."&&exit 1
168
-
fi
154
+
if [ -f /usr/local/bin/brew ];then
155
+
logg info "Using /usr/local/bin/brew"&&eval"$(/usr/local/bin/brew shellenv)"
156
+
if [ -f"${HOMEBREW_PREFIX:-/opt/homebrew}/bin/brew" ];then
157
+
logg info "Using ${HOMEBREW_PREFIX:-/opt/homebrew}/bin/brew"&&eval"$("${HOMEBREW_PREFIX:-/opt/homebrew}/bin/brew" shellenv)"
158
+
if [ -d"$HOME/.linuxbrew" ];then
159
+
logg info "Using $HOME/.linuxbrew/bin/brew"&&eval"$("$HOME/.linuxbrew/bin/brew" shellenv)"
160
+
elif [ -d"/home/linuxbrew/.linuxbrew" ];then
161
+
logg info 'Using /home/linuxbrew/.linuxbrew/bin/brew'&&eval"(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
169
162
else
170
-
### Installs Homebrew and addresses a couple potential issues
logg warn 'Homebrew was installed but part of the installation failed to complete successfully.'
198
+
fixHomebrewPermissions
199
+
fi
200
200
fi
201
+
}
201
202
202
-
### Ensure GCC is installed via Homebrew
203
+
### Ensures gcc is installed
204
+
ensureGcc() {
203
205
ifcommand -v brew > /dev/null;then
204
206
if! brew list | grep gcc > /dev/null;then
205
-
logg info "Installing Homebrew gcc"&& brew install --quiet gcc
207
+
logg info 'Installing Homebrew gcc'&& brew install --quiet gcc
208
+
else
209
+
logg info 'Homebrew gcc is available'
206
210
fi
207
211
else
208
-
logg error "Failed to initialize Homebrew"&&exit2
212
+
logg error 'Failed to initialize Homebrew'&&exit1
209
213
fi
210
214
}
215
+
216
+
# @description This function ensures Homebrew is installed and available in the `PATH`. It handles the installation of Homebrew on both **Linux and macOS**.
217
+
# It will attempt to bypass sudo password entry if it detects that it can do so. The function also has some error handling in regards to various
218
+
# directories falling out of the correct ownership and permission states. Finally, it loads Homebrew into the active profile (allowing other parts of the script
219
+
# to use the `brew` command).
220
+
#
221
+
# With Homebrew installed and available, the script finishes by installing the `gcc` Homebrew package which is a very common dependency.
0 commit comments