-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathCreate_macOS_ISO.command
More file actions
executable file
·34 lines (31 loc) · 959 Bytes
/
Create_macOS_ISO.command
File metadata and controls
executable file
·34 lines (31 loc) · 959 Bytes
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
#!/usr/bin/env bash
# Simple launcher for mkmaciso
set -e
MKMACISO_URL="https://raw.githubusercontent.com/LongQT-sea/mkmaciso/main/mkmaciso"
LOCAL_BIN="$HOME/.local/bin"
TARGET="$LOCAL_BIN/mkmaciso"
EXPORT_LINE='export PATH="$HOME/.local/bin:$PATH"'
# Check kernel version and set curl options accordingly
KERNEL_VERSION=$(uname -r | cut -d. -f1)
if [[ "$KERNEL_VERSION" -ge 15 ]]; then
CURL_OPTS="-fsSL"
else
CURL_OPTS="-fsSL --insecure"
fi
# Install mkmaciso if missing
if [[ ! -f "$TARGET" ]]; then
mkdir -p "$LOCAL_BIN"
curl $CURL_OPTS "$MKMACISO_URL" -o "$TARGET"
chmod +x "$TARGET"
fi
# Ensure ~/.local/bin is in PATH
if [[ ":$PATH:" != *":$LOCAL_BIN:"* ]]; then
case "$SHELL" in
*/zsh) RC="$HOME/.zprofile" ;;
*/bash) RC="$HOME/.bash_profile" ;;
*) RC="$HOME/.profile" ;;
esac
touch "$RC"
grep -qxF "$EXPORT_LINE" "$RC" || printf '\n%s\n' "$EXPORT_LINE" >> "$RC"
fi
exec "$TARGET" "$@"