Merge pull request #50 from jaminmc/Refactored

Refactored the code to make it more maintainable.
This commit is contained in:
Gabriel Luchina
2025-07-09 16:11:51 -03:00
committed by GitHub
6 changed files with 1021 additions and 2092 deletions

View File

@@ -61,6 +61,7 @@ sudo spctl --master-disable
## ☁️ Cloud Support (Run Hackintosh in the Cloud!) ## ☁️ Cloud Support (Run Hackintosh in the Cloud!)
- [🌍 VultR](https://www.vultr.com/?ref=9035565-8H) - [🌍 VultR](https://www.vultr.com/?ref=9035565-8H)
- [📺 Video Tutorial](https://youtu.be/8QsMyL-PNrM) (Enable captions for better understanding) - [📺 Video Tutorial](https://youtu.be/8QsMyL-PNrM) (Enable captions for better understanding)
- Now has configurable bridges, and can add as many bridges and sprcify the subnet for them.
--- ---

View File

@@ -3,45 +3,80 @@
######################################################################################################################### #########################################################################################################################
# #
# Script: install # Script: install
# # Purpose: Install OSX-PROXMOX
# https://luchina.com.br # Source: https://luchina.com.br
# #
######################################################################################################################### #########################################################################################################################
clear # Exit on any error
set -e
if [ -e /root/OSX-PROXMOX ]; then rm -rf /root/OSX-PROXMOX; fi; # Check if running as root
if [ -e /etc/apt/sources.list.d/pve-enterprise.list ]; then rm -rf /etc/apt/sources.list.d/pve-enterprise.list; fi; if [ "$EUID" -ne 0 ]; then
if [ -e /etc/apt/sources.list.d/ceph.list ]; then rm -rf /etc/apt/sources.list.d/ceph.list; fi; echo "This script must be run as root."
# Is this better? exit 1
echo "Waiting to install OSX-PROXMOX..."
echo " "
apt update > /tmp/install-osx-proxmox.log 2>> /tmp/install-osx-proxmox.log
if [ $? -ne 0 ]
then
echo " "
echo "Error with 'apt-get update' ..."
echo "Trying to change /etc/apt/sources.list"
echo " "
# Always using a Brazilian server will not be fast...
# I suggest using the users home country, As it will always be faster.
Country=$(curl -s https://ipinfo.io/country | tr '[:upper:]' '[:lower:]')
sed -i "s/ftp.$Country.debian.org/ftp.debian.org/g" /etc/apt/sources.list
echo "Retrying 'apt-get update' ..."
echo " "
apt-get update >> /tmp/install-osx-proxmox.log 2>> /tmp/install-osx-proxmox.log
if [ $? -ne 0 ]; then echo "Error with 'apt-get update' ..."; exit; fi
fi fi
apt install git -y >> /tmp/install-osx-proxmox.log 2>> /tmp/install-osx-proxmox.log # Define log file
LOG_FILE="/root/install-osx-proxmox.log"
git clone https://github.com/luchina-gabriel/OSX-PROXMOX.git >> /tmp/install-osx-proxmox.log 2>> /tmp/install-osx-proxmox.log # Function to log messages
log_message() {
echo "$1" | tee -a "$LOG_FILE"
}
if [ ! -e /root/OSX-PROXMOX ]; then mkdir -p /root/OSX-PROXMOX; fi; # Function to check command success
check_status() {
if [ $? -ne 0 ]; then
log_message "Error: $1"
exit 1
fi
}
/root/OSX-PROXMOX/setup # Clear screen
clear
# Clean up existing files
log_message "Cleaning up existing files..."
[ -d "/root/OSX-PROXMOX" ] && rm -rf "/root/OSX-PROXMOX"
[ -f "/etc/apt/sources.list.d/pve-enterprise.list" ] && rm -f "/etc/apt/sources.list.d/pve-enterprise.list"
[ -f "/etc/apt/sources.list.d/ceph.list" ] && rm -f "/etc/apt/sources.list.d/ceph.list"
log_message "Preparing to install OSX-PROXMOX..."
# Update package lists
log_message "Updating package lists..."
apt-get update >> "$LOG_FILE" 2>&1
if [ $? -ne 0 ]; then
log_message "Initial apt-get update failed. Attempting to fix sources..."
# Use main Debian mirror instead of country-specific
sed -i 's/ftp\.[a-z]\{2\}\.debian\.org/ftp.debian.org/g' /etc/apt/sources.list
log_message "Retrying apt-get update..."
apt-get update >> "$LOG_FILE" 2>&1
check_status "Failed to update package lists after source modification"
fi
# Install git
log_message "Installing git..."
apt-get install -y git >> "$LOG_FILE" 2>&1
check_status "Failed to install git"
# Clone repository
log_message "Cloning OSX-PROXMOX repository..."
git clone https://github.com/luchina-gabriel/OSX-PROXMOX.git /root/OSX-PROXMOX >> "$LOG_FILE" 2>&1
check_status "Failed to clone repository"
# Ensure directory exists and setup is executable
if [ -f "/root/OSX-PROXMOX/setup" ]; then
chmod +x "/root/OSX-PROXMOX/setup"
log_message "Running setup script..."
/root/OSX-PROXMOX/setup 2>&1 | tee -a "$LOG_FILE"
check_status "Failed to run setup script"
else
log_message "Error: Setup script not found in /root/OSX-PROXMOX"
exit 1
fi
log_message "Installation completed successfully"

2957
setup

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +1,20 @@
#!/bin/bash #!/bin/bash
# #
# Script: check-iommu-enabled.sh # Script: check-iommu-enabled.sh
# Goal: Check if IOMMU are Enabled in your system # Goal: Check if IOMMU is enabled on your system
# #
# Author: Gabriel Luchina # Author: Gabriel Luchina
# https://luchina.com.br # https://luchina.com.br
# 20220128T1112 # 20220128T1112
if [ `dmesg | grep -e DMAR -e IOMMU | wc -l` -gt 0 ] # Check for IOMMU or DMAR messages in dmesg
then iommu_check=$(dmesg | grep -E 'DMAR|IOMMU')
if [ -n "$iommu_check" ]; then
echo "IOMMU Enabled" echo "IOMMU Enabled"
else else
echo "IOMMU NOT Enabled" echo "IOMMU NOT Enabled"
echo "Check file /etc/default/grub contains 'intel_iommu=on' in 'GRUB_CMDLINE_LINUX_DEFAULT' line" echo "Ensure 'intel_iommu=on' or 'amd_iommu=on' is present in the 'GRUB_CMDLINE_LINUX_DEFAULT' line of /etc/default/grub"
exit 1
fi fi

View File

@@ -7,6 +7,8 @@
# https://luchina.com.br # https://luchina.com.br
# 20211116T2245 # 20211116T2245
set -e
clear clear
echo -e "\nAutomate script for create \"ISO\" file of macOS Install in Proxmox VE Environament" echo -e "\nAutomate script for create \"ISO\" file of macOS Install in Proxmox VE Environament"
@@ -14,21 +16,27 @@ echo -e "BY: https://luchina.com.br"
echo -e "SUPPORT: https://osx-proxmox.com" echo -e "SUPPORT: https://osx-proxmox.com"
echo -n -e "\nPath to temporary files (work dir): " echo -n -e "\nPath to temporary files (work dir): "
read TEMPDIR read -r TEMPDIR
echo -n -e "Path to macOS Installation (.app) file: " echo -n -e "Path to macOS Installation (.app) file: "
read APPOSX read -r APPOSX
echo " " echo " "
## Core ## Core
cd ${TEMPDIR} > /dev/null 2> /dev/null if [ -d "$TEMPDIR" ]; then
rm -rf macOS-install* > /dev/null 2> /dev/null cd "$TEMPDIR" || exit 1
hdiutil create -o macOS-install -size 16g -layout GPTSPUD -fs HFS+J > /dev/null 2> /dev/null rm -rf macOS-install* > /dev/null 2> /dev/null
hdiutil attach -noverify -mountpoint /Volumes/install_build macOS-install.dmg > /dev/null 2> /dev/null hdiutil create -o macOS-install -size 16g -layout GPTSPUD -fs HFS+J > /dev/null 2> /dev/null
sudo "${APPOSX}/Contents/Resources/createinstallmedia" --volume /Volumes/install_build --nointeraction hdiutil attach -noverify -mountpoint /Volumes/install_build macOS-install.dmg > /dev/null 2> /dev/null
hdiutil detach -force "/Volumes/Install macOS"* > /dev/null 2> /dev/null && sleep 3s > /dev/null 2> /dev/null sudo "${APPOSX}/Contents/Resources/createinstallmedia" --volume /Volumes/install_build --nointeraction
hdiutil detach -force "/Volumes/Shared Support"* > /dev/null 2> /dev/null hdiutil detach -force "/Volumes/Install macOS"* > /dev/null 2> /dev/null && sleep 3s > /dev/null 2> /dev/null
mv macOS-install.dmg macOS-install.iso > /dev/null 2> /dev/null hdiutil detach -force "/Volumes/Shared Support"* > /dev/null 2> /dev/null
mv macOS-install.dmg macOS-install.iso > /dev/null 2> /dev/null
else
echo "The temporary directory does not exist!"
exit 1
fi
echo " " echo " "

View File

@@ -5,15 +5,15 @@
# #
# Author: Gabriel Luchina # Author: Gabriel Luchina
# https://luchina.com.br # https://luchina.com.br
# 20211118T0010 # 20250627T2331
#!/bin/bash
shopt -s nullglob shopt -s nullglob
for group in `ls /sys/kernel/iommu_groups/ | sort -V` for iommu_group in $(ls /sys/kernel/iommu_groups/ | sort -V); do
do echo "IOMMU Group ${iommu_group}:"
echo "IOMMU Group ${group##*/}:" for pci_device in /sys/kernel/iommu_groups/$iommu_group/devices/*; do
for device in /sys/kernel/iommu_groups/$group/devices/* echo -e "\t$(lspci -nns ${pci_device##*/})"
do
echo -e "\t$(lspci -nns ${device##*/})"
done done
done done