mirror of
https://github.com/luchina-gabriel/OSX-PROXMOX.git
synced 2026-09-25 20:47:01 +00:00
Compare commits
4
Commits
52433409c3
...
b3d2b2b9f4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3d2b2b9f4 | ||
|
|
d0eb22b5ff | ||
|
|
978dbee98d | ||
|
|
b0b88d8986 |
Binary file not shown.
+28
-4
@@ -65,10 +65,34 @@ log_message "Installing git..."
|
|||||||
apt-get install -y git >> "$LOG_FILE" 2>&1
|
apt-get install -y git >> "$LOG_FILE" 2>&1
|
||||||
check_status "Failed to install git"
|
check_status "Failed to install git"
|
||||||
|
|
||||||
# Clone repository
|
# Download repository (latest version only, without full history)
|
||||||
log_message "Cloning OSX-PROXMOX repository..."
|
REPO_URL="https://github.com/luchina-gabriel/OSX-PROXMOX.git"
|
||||||
git clone --recurse-submodules https://github.com/luchina-gabriel/OSX-PROXMOX.git /root/OSX-PROXMOX >> "$LOG_FILE" 2>&1
|
REPO_DIR="/root/OSX-PROXMOX"
|
||||||
check_status "Failed to clone repository"
|
|
||||||
|
# Shallow + partial + sparse checkout: fetches only the files the setup needs.
|
||||||
|
# The OpenCore ISO is left out on purpose - the setup downloads it into the ISO
|
||||||
|
# storage on its own, so checking it out here would just duplicate ~96 MB.
|
||||||
|
clone_latest_only() {
|
||||||
|
git clone --depth 1 --filter=blob:none --sparse "$REPO_URL" "$REPO_DIR" &&
|
||||||
|
git -C "$REPO_DIR" sparse-checkout set tools
|
||||||
|
}
|
||||||
|
|
||||||
|
log_message "Downloading OSX-PROXMOX repository (latest version only)..."
|
||||||
|
if ! clone_latest_only >> "$LOG_FILE" 2>&1; then
|
||||||
|
log_message "Partial clone unavailable. Falling back to shallow clone..."
|
||||||
|
rm -rf "$REPO_DIR"
|
||||||
|
git clone --depth 1 "$REPO_URL" "$REPO_DIR" >> "$LOG_FILE" 2>&1
|
||||||
|
check_status "Failed to clone repository"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Download submodules (GenSMBIOS) at their pinned revision only
|
||||||
|
log_message "Downloading submodules..."
|
||||||
|
if ! git -C "$REPO_DIR" submodule update --init --depth 1 >> "$LOG_FILE" 2>&1; then
|
||||||
|
log_message "Shallow submodule fetch failed. Retrying with full history..."
|
||||||
|
git -C "$REPO_DIR" submodule deinit -f --all >> "$LOG_FILE" 2>&1 || true
|
||||||
|
git -C "$REPO_DIR" submodule update --init --force >> "$LOG_FILE" 2>&1
|
||||||
|
check_status "Failed to download submodules"
|
||||||
|
fi
|
||||||
|
|
||||||
# Ensure directory exists and setup is executable
|
# Ensure directory exists and setup is executable
|
||||||
if [ -f "/root/OSX-PROXMOX/setup" ]; then
|
if [ -f "/root/OSX-PROXMOX/setup" ]; then
|
||||||
|
|||||||
@@ -220,6 +220,16 @@ ensure_base64_xxd_dependency() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to ensure wget is installed
|
||||||
|
ensure_wget_dependency() {
|
||||||
|
local logfile="${LOGDIR}/wget-dependency.log"
|
||||||
|
if ! command -v wget >/dev/null 2>&1; then
|
||||||
|
display_and_log "Installing wget..." "$logfile"
|
||||||
|
apt-get update >>"$logfile" 2>&1 || log_and_exit "Failed to update apt" "$logfile"
|
||||||
|
apt-get install -y wget >>"$logfile" 2>&1 || log_and_exit "Failed to install wget" "$logfile"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to set ISODIR based on selected ISO storage
|
# Function to set ISODIR based on selected ISO storage
|
||||||
set_isodir() {
|
set_isodir() {
|
||||||
local logfile="${LOGDIR}/iso-storage-detection.log"
|
local logfile="${LOGDIR}/iso-storage-detection.log"
|
||||||
@@ -325,10 +335,27 @@ detect_cpu_platform() {
|
|||||||
lscpu | grep -qi "Vendor ID.*AMD" && echo "AMD" || echo "INTEL"
|
lscpu | grep -qi "Vendor ID.*AMD" && echo "AMD" || echo "INTEL"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to detect the Intel microarchitecture (CPUID family/model)
|
||||||
|
detect_intel_uarch() {
|
||||||
|
local family model
|
||||||
|
family=$(awk -F': ' '/^cpu family/ {print $2; exit}' /proc/cpuinfo)
|
||||||
|
model=$(awk -F': ' '/^model[[:space:]]*:/ {print $2; exit}' /proc/cpuinfo)
|
||||||
|
if [[ "$family" == "6" ]]; then
|
||||||
|
case "$model" in
|
||||||
|
60|69|70) echo "HASWELL" ;; # Core i5/i7 4xxx Desktop/Mobile (Haswell DT, ULT, GT3e)
|
||||||
|
63) echo "HASWELL_HEDT" ;; # Xeon E5 v3 / Core i7 HEDT (Haswell-E/EP)
|
||||||
|
79|86) echo "BROADWELL_HEDT" ;; # Xeon E5 v4 / Core i7 HEDT (Broadwell-E/EP), Xeon D (Broadwell-DE)
|
||||||
|
*) echo "GENERIC" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "GENERIC"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to setup prerequisites
|
# Function to setup prerequisites
|
||||||
setup_prerequisites() {
|
setup_prerequisites() {
|
||||||
local logfile="${LOGDIR}/prerequisites-setup.log"
|
local logfile="${LOGDIR}/prerequisites-setup.log"
|
||||||
cp "${SCRIPT_DIR}/EFI/"*.iso "$ISODIR" || log_and_exit "Failed to copy EFI files" "$logfile"
|
# The OpenCore ISO is already provisioned in ISODIR by update_opencore_iso at startup
|
||||||
printf "alias osx-setup='%s/setup'\n" "$SCRIPT_DIR" >> /root/.bashrc
|
printf "alias osx-setup='%s/setup'\n" "$SCRIPT_DIR" >> /root/.bashrc
|
||||||
printf "LANG=en_US.UTF-8\nLC_ALL=en_US.UTF-8\n" > /etc/environment
|
printf "LANG=en_US.UTF-8\nLC_ALL=en_US.UTF-8\n" > /etc/environment
|
||||||
printf "set mouse-=a\n" > ~/.vimrc
|
printf "set mouse-=a\n" > ~/.vimrc
|
||||||
@@ -411,7 +438,20 @@ create_vm() {
|
|||||||
cpu_args="-cpu Penryn,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+ssse3,+sse4.2,+popcnt,+avx,+avx2,+aes,+fma,+bmi1,+bmi2,+xsave,+xsaveopt,check"
|
cpu_args="-cpu Penryn,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+ssse3,+sse4.2,+popcnt,+avx,+avx2,+aes,+fma,+bmi1,+bmi2,+xsave,+xsaveopt,check"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
cpu_args="-cpu Skylake-Client-v4,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+vmx,vmware-cpuid-freq=on"
|
case "$OSX_INTEL_UARCH" in
|
||||||
|
HASWELL)
|
||||||
|
cpu_args="-cpu Haswell-noTSX,stepping=3,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+vmx,vmware-cpuid-freq=on"
|
||||||
|
;;
|
||||||
|
HASWELL_HEDT)
|
||||||
|
cpu_args="-cpu Haswell-noTSX,model=158,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+vmx,vmware-cpuid-freq=on"
|
||||||
|
;;
|
||||||
|
BROADWELL_HEDT)
|
||||||
|
cpu_args="-cpu Broadwell-noTSX,model=158,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+vmx,vmware-cpuid-freq=on"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
cpu_args="-cpu Skylake-Client-v4,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+vmx,vmware-cpuid-freq=on"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check QEMU version and append hotplug fix if 6.1 or newer
|
# Check QEMU version and append hotplug fix if 6.1 or newer
|
||||||
@@ -862,6 +902,7 @@ update_opencore_iso() {
|
|||||||
iso_path="${ISODIR}/${OPENCORE_ISO}"
|
iso_path="${ISODIR}/${OPENCORE_ISO}"
|
||||||
oc_json_path="${ISODIR}/.smbios.json"
|
oc_json_path="${ISODIR}/.smbios.json"
|
||||||
|
|
||||||
|
ensure_wget_dependency
|
||||||
rm -f "$iso_path" >>"$logfile" 2>&1
|
rm -f "$iso_path" >>"$logfile" 2>&1
|
||||||
if ! wget -q -O "$iso_path" "$iso_url" >>"$logfile" 2>&1; then
|
if ! wget -q -O "$iso_path" "$iso_url" >>"$logfile" 2>&1; then
|
||||||
log_and_exit "Failed to download OpenCore ISO" "$logfile"
|
log_and_exit "Failed to download OpenCore ISO" "$logfile"
|
||||||
@@ -1470,5 +1511,6 @@ if [ ! -f "${ISODIR}/${OPENCORE_ISO}" ]; then
|
|||||||
update_opencore_iso "0"
|
update_opencore_iso "0"
|
||||||
fi
|
fi
|
||||||
OSX_PLATFORM=$(detect_cpu_platform)
|
OSX_PLATFORM=$(detect_cpu_platform)
|
||||||
|
OSX_INTEL_UARCH=$(detect_intel_uarch)
|
||||||
[[ ! -e /etc/pve/qemu-server/.osx-proxmox ]] && setup_prerequisites
|
[[ ! -e /etc/pve/qemu-server/.osx-proxmox ]] && setup_prerequisites
|
||||||
main_menu
|
main_menu
|
||||||
|
|||||||
Reference in New Issue
Block a user