Compare commits

...

8 Commits

Author SHA1 Message Date
Statik DK Smoke 7d26402452
Merge 9a9b0e18a1 into 6cf56dd2d1 2025-09-08 00:36:26 -05:00
Statik DK Smoke 9a9b0e18a1
Update download selection to auto-choose version 7 2025-09-08 00:34:27 -05:00
Statik DK Smoke 2d728a3033
Revise installation instructions for Ubuntu and Fedora 2025-09-08 00:25:47 -05:00
statikfintechllc bb8591faa7 Fighting with the install 2025-09-08 00:11:14 -05:00
statikfintechllc 0c7293296c debugging 2025-09-07 23:45:22 -05:00
Statik DK Smoke f193460e0c
updated ubuntun, found bug 2025-09-07 23:27:28 -05:00
Statik DK Smoke cbf0fd015e
Update README.md 2025-09-07 23:08:29 -05:00
Statik DK Smoke d27e6b3d86
Change installation script URLs for Ubuntu and Fedora 2025-09-07 23:06:54 -05:00
3 changed files with 147 additions and 109 deletions

View File

@ -2,21 +2,12 @@
### Ubuntu 22.04 Quick Install ### Ubuntu 22.04 Quick Install
- Full install and activation uses wget and curl commands to run the full sequence so you dont have to manually configure everything. - Full install and activation uses wget and curl commands to run the full sequence so you dont have to manually configure everything.
**Automatic Installation (one-liner)**: **Automatic Installation (one-liner) `wget` install**:
``` ```
sudo curl -fsSL https://raw.githubusercontent.com/kholia/OSX-KVM/master/wget.install.script | bash sudo wget https://raw.githubusercontent.com/kholia/OSX-KVM/master/wget.ubuntu.install.script -O wget.ubuntu.install.script && ./wget.ubuntu.install.script
```
**Or `wget` install**:
```
sudo wget https://raw.githubusercontent.com/kholia/OSX-KVM/master/wget.install.script -O wget.install.script
``` ```
#### macOS Recovery and Installation Chooses 7 from:
- Once OpenCore boots, you can download the macOS installer:
```
$ ./fetch-macOS-v2.py
```
Choose from:
```shell ```shell
1. High Sierra (10.13) 1. High Sierra (10.13)
2. Mojave (10.14) 2. Mojave (10.14)
@ -27,7 +18,7 @@ Choose from:
7. Sonoma (14) 7. Sonoma (14)
8. Sequoia (15) 8. Sequoia (15)
Select a product to download (1-8): 6 Select a product to download (1-8): Auto-Chooses 7
``` ```
#### Disk Setup #### Disk Setup
1. Select **Disk Utility** from the OpenCore menu. 1. Select **Disk Utility** from the OpenCore menu.
@ -48,28 +39,23 @@ Select a product to download (1-8): 6
- Boot the VM and macOS should start with OpenCore managing the EFI environment. - Boot the VM and macOS should start with OpenCore managing the EFI environment.
- Optionally, you can keep `fetch-macOS-v2.py` handy to upgrade or reinstall newer macOS versions. - Optionally, you can keep `fetch-macOS-v2.py` handy to upgrade or reinstall newer macOS versions.
#### macOS Recovery and Installation
- Once OpenCore boots, you can download the macOS installer:
```
$ ./fetch-macOS-v2.py
```
--- ---
### Fedora 38+ Quick Install ### Fedora 38+ Quick Install
- Full install and activation uses wget and curl commands to run the full sequence so you dont have to manually configure packages or dependencies. - Full install and activation uses wget and curl commands to run the full sequence so you dont have to manually configure packages or dependencies.
**Automatic Installation**: **Automatic Installation with `wget` install**:
``` ```
sudo curl -fsSL https://raw.githubusercontent.com/kholia/OSX-KVM/master/wget.fedora.install.script | bash sudo wget https://raw.githubusercontent.com/kholia/OSX-KVM/master/wget.fedora.install.script -O wget.fedora.install.script && wget.fedora.install.script
```
**Or `wget` install**:
```
sudo wget https://raw.githubusercontent.com/kholi
a/OSX-KVM/master/wget.fedora.install.script -O wget.fedora.install.script
``` ```
#### macOS Recovery and Installation Chooses 7 from:
- Once OpenCore boots, you can download the macOS installer using:
```
$ ./fetch-macOS-v2.py
```
Choose from:
``` ```
1. High Sierra (10.13) 1. High Sierra (10.13)
2. Mojave (10.14) 2. Mojave (10.14)
@ -80,7 +66,7 @@ Choose from:
7. Sonoma (14) 7. Sonoma (14)
8. Sequoia (15) 8. Sequoia (15)
Select a product to download (1-8): 6 Select a product to download (1-8): Auto-Chooses 7
``` ```
#### Disk Setup #### Disk Setup
1. Open **Disk Utility** in the OpenCore menu. 1. Open **Disk Utility** in the OpenCore menu.
@ -101,6 +87,12 @@ Select a product to download (1-8): 6
- Boot the VM; OpenCore handles the EFI environment and macOS should load. - Boot the VM; OpenCore handles the EFI environment and macOS should load.
- Keep `fetch-macOS-v2.py` available for future upgrades or reinstallations. - Keep `fetch-macOS-v2.py` available for future upgrades or reinstallations.
#### macOS Recovery and Installation
- Once OpenCore boots, you can download the macOS installer using:
```
$ ./fetch-macOS-v2.py
```
--- ---
#### Notes #### Notes

Binary file not shown.

View File

@ -1,33 +1,38 @@
#!/usr/bin/bash #!/usr/bin/bash
# macOS KVM Installation Script for a brand-new Linux system
# Quick Install: curl -fsSL <URL> | bash # macOS KVM Installation Script with wget/curl support
#
# Quick Install (one-liner):
# curl -fsSL https://raw.githubusercontent.com/yourusername/OSX-KVM/master/install-macos-kvm.sh | bash
#
# Usage: ./install-macos-kvm.sh [OPTIONS]
# Options:
# --use-curl Use curl instead of wget for downloads
# --help Show this help message
set -e # Exit on any error set -e # Exit on any error
# Default settings # Default settings
USE_CURL=false USE_CURL=true
INSTALL_DIR="$HOME/OSX-KVM" INSTALL_DIR="$HOME/OSX-KVM"
# Function to display help # Function to display help
show_help() { show_help() {
cat <<EOF echo "macOS KVM Installation Script"
macOS KVM Installation Script echo ""
echo "Usage: $0 [OPTIONS]"
Usage: $0 [OPTIONS] echo ""
echo "Options:"
Options: echo " --use-curl Use curl instead of wget for downloads"
--use-curl Use curl instead of wget for downloads echo " --help Show this help message"
--help Show this help message echo ""
echo "This script will:"
This script will: echo " 1. Clone the OSX-KVM repository"
1. Install all required packages echo " 2. Download macOS recovery image"
2. Clone the OSX-KVM repository echo " 3. Convert BaseSystem.dmg to raw format"
3. Download macOS recovery image echo " 4. Create macOS disk image (100GB)"
4. Convert BaseSystem.dmg to raw format echo " 5. Set proper permissions for libvirt"
5. Create macOS disk image (100GB) echo " 6. Launch macOS VM"
6. Set proper permissions for libvirt
7. Launch macOS VM
EOF
} }
# Function to check if command exists # Function to check if command exists
@ -35,25 +40,21 @@ command_exists() {
command -v "$1" >/dev/null 2>&1 command -v "$1" >/dev/null 2>&1
} }
# Function to install packages via apt # Function to download with fallback
install_package() {
local pkg="$1"
if ! dpkg -s "$pkg" >/dev/null 2>&1; then
echo "Installing missing package: $pkg"
sudo apt-get install -y "$pkg"
fi
}
# Function to download files
download_file() { download_file() {
local url="$1" local url="$1"
local output="$2" local output="$2"
echo "Downloading: $url" echo "Downloading: $url"
if [ "$USE_CURL" = true ] && command_exists curl; then if [ "$USE_CURL" = true ] && command_exists curl; then
echo "Using curl for download..."
curl -L -o "$output" "$url" curl -L -o "$output" "$url"
elif command_exists wget; then elif command_exists wget; then
echo "Using wget for download..."
wget -O "$output" "$url" wget -O "$output" "$url"
elif command_exists curl; then elif command_exists curl; then
echo "wget not found, falling back to curl..."
curl -L -o "$output" "$url" curl -L -o "$output" "$url"
else else
echo "Error: Neither wget nor curl found. Please install one of them." echo "Error: Neither wget nor curl found. Please install one of them."
@ -74,65 +75,68 @@ while [[ $# -gt 0 ]]; do
;; ;;
*) *)
echo "Unknown option: $1" echo "Unknown option: $1"
show_help echo "Use --help for usage information"
exit 1 exit 1
;; ;;
esac esac
done done
echo "Updating package list..." # Check for required commands
sudo apt-get update -y echo "Checking system requirements..."
# Install required packages if ! command_exists git; then
REQUIRED_PKGS=(git wget curl python3 python3-pip qemu-system qemu-utils \ echo "Error: git is required but not installed."
uml-utilities virt-manager libguestfs-tools p7zip-full make dmg2img \
tesseract-ocr tesseract-ocr-eng genisoimage vim net-tools screen)
for pkg in "${REQUIRED_PKGS[@]}"; do
install_package "$pkg"
done
echo "✓ All required packages installed"
# Check system commands
for cmd in git qemu-img wget curl python3 make dmg2img; do
if ! command_exists "$cmd"; then
echo "Error: $cmd is required but not installed."
exit 1 exit 1
fi fi
done
echo "✓ System commands verified" if ! command_exists qemu-img; then
echo "Error: qemu-img is required but not installed."
echo "Please install qemu-utils or qemu-system package"
exit 1
fi
# Create installation directory # Check for download capability
if ! command_exists wget && ! command_exists curl; then
echo "Error: Neither wget nor curl found."
echo "Please install wget or curl to continue."
exit 1
fi
echo "✓ System requirements check passed"
# Create installation directory if it doesn't exist
if [ -d "$INSTALL_DIR" ]; then if [ -d "$INSTALL_DIR" ]; then
echo "Warning: $INSTALL_DIR exists. Backing up to ${INSTALL_DIR}.backup" echo "Warning: $INSTALL_DIR already exists. Backing up to ${INSTALL_DIR}.backup"
mv "$INSTALL_DIR" "${INSTALL_DIR}.backup.$(date +%Y%m%d_%H%M%S)" mv "$INSTALL_DIR" "${INSTALL_DIR}.backup.$(date +%Y%m%d_%H%M%S)"
fi fi
# Clone repository # Clone the repository
echo "Cloning OSX-KVM repository..." echo "Cloning OSX-KVM repository..."
git clone https://github.com/kholia/OSX-KVM.git "$INSTALL_DIR" git clone https://github.com/kholia/OSX-KVM.git "$INSTALL_DIR"
cd "$INSTALL_DIR" cd "$INSTALL_DIR"
# Setup KVM # Download macOS recovery image (automatically choose Sonoma - option 7)
sudo modprobe kvm echo "Downloading macOS recovery image (Sonoma - Recommended)..."
echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs >/dev/null || true
[ -f kvm_amd.conf ] && sudo cp kvm_amd.conf /etc/modprobe.d/kvm.conf
sudo usermod -aG kvm "$(whoami)"
sudo usermod -aG libvirt "$(whoami)"
sudo usermod -aG input "$(whoami)"
# Download macOS recovery image
echo "Downloading macOS recovery image..."
if [ -f "fetch-macOS-v2.py" ]; then if [ -f "fetch-macOS-v2.py" ]; then
python3 fetch-macOS-v2.py echo "7" | python3 fetch-macOS-v2.py
else else
echo "Warning: fetch-macOS-v2.py not found, attempting manual download..."
# Fallback download URLs for macOS recovery images
RECOVERY_URL="https://updates.cdn-apple.com/2019FallFCS/fullrestores/061-44998/B5A3E286-1C4A-11EA-99D4-864D6786AB92/BaseSystem.dmg" RECOVERY_URL="https://updates.cdn-apple.com/2019FallFCS/fullrestores/061-44998/B5A3E286-1C4A-11EA-99D4-864D6786AB92/BaseSystem.dmg"
download_file "$RECOVERY_URL" "BaseSystem.dmg" download_file "$RECOVERY_URL" "BaseSystem.dmg"
fi fi
sudo apt-get install qemu-system uml-utilities virt-manager git \
wget libguestfs-tools p7zip-full make dmg2img tesseract-ocr \
tesseract-ocr-eng genisoimage vim net-tools screen -y
sudo modprobe kvm; echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs
sudo cp kvm_amd.conf /etc/modprobe.d/kvm.conf # for amd boxes only
sudo usermod -aG kvm $(whoami)
sudo usermod -aG libvirt $(whoami)
sudo usermod -aG input $(whoami)
# Convert BaseSystem.dmg to raw format # Convert BaseSystem.dmg to raw format
echo "Converting BaseSystem.dmg to raw format..." echo "Converting BaseSystem.dmg to raw format..."
if [ -f "BaseSystem.dmg" ]; then if [ -f "BaseSystem.dmg" ]; then
@ -143,36 +147,78 @@ else
exit 1 exit 1
fi fi
# Create macOS disk image # Create macOS disk image (256GB)
echo "Creating macOS disk image (256GB)..." echo "Creating macOS disk image (256GB)..."
qemu-img create -f qcow2 macOS.qcow2 256G qemu-img create -f qcow2 macOS.qcow2 256G
ln -sf macOS.qcow2 mac_hdd_ng.img echo "✓ macOS.qcow2 created successfully"
echo "✓ Disk image created"
# Set permissions for libvirt # Create symlink for script compatibility
sudo chown libvirt-qemu:libvirt-qemu macOS.qcow2 2>/dev/null || true echo "Creating compatibility symlink..."
sudo chmod 664 macOS.qcow2 2>/dev/null || true ln -sf macOS.qcow2 mac_hdd_ng.img
sudo chmod 755 "$INSTALL_DIR" 2>/dev/null || true
# Fix permissions for libvirt
echo "Setting up permissions for libvirt..."
sudo chown libvirt-qemu:libvirt-qemu macOS.qcow2 2>/dev/null || {
echo "Warning: Could not change ownership to libvirt-qemu. You may need to run this manually:"
echo " sudo chown libvirt-qemu:libvirt-qemu $INSTALL_DIR/macOS.qcow2"
}
sudo chmod 664 macOS.qcow2 2>/dev/null || {
echo "Warning: Could not change permissions. You may need to run this manually:"
echo " sudo chmod 664 $INSTALL_DIR/macOS.qcow2"
}
# Fix directory permissions
sudo chmod 755 "$INSTALL_DIR" 2>/dev/null || {
echo "Warning: Could not change directory permissions. You may need to run this manually:"
echo " sudo chmod 755 $INSTALL_DIR"
}
# Make scripts executable # Make scripts executable
echo "Making scripts executable..."
chmod +x *.sh chmod +x *.sh
# Build OpenCore if missing # Check if OpenCore exists and build if necessary
if [ ! -f "OpenCore/OpenCore.qcow2" ]; then if [ ! -f "OpenCore/OpenCore.qcow2" ]; then
echo "OpenCore not found, attempting to build..." echo "OpenCore not found, attempting to build..."
cd OpenCore || exit cd OpenCore
[ -f "Makefile" ] && make || echo "Warning: Could not build OpenCore" if [ -f "Makefile" ]; then
make
else
echo "Warning: Could not build OpenCore. You may need to build it manually."
fi
cd .. cd ..
fi fi
echo "" echo ""
echo "🎉 Installation completed successfully!" echo "🎉 Installation completed successfully!"
echo ""
echo "Next steps:" echo "Next steps:"
echo "1. Start macOS VM: cd $INSTALL_DIR && sudo ./OpenCore-Boot.sh" echo "1. To start the macOS VM using the script:"
echo "2. Use virt-manager: import XML, start VM" echo " cd $INSTALL_DIR && sudo ./OpenCore-Boot.sh"
echo ""
echo "2. To use with virt-manager:"
echo " - Import the provided libvirt XML configuration"
echo " - Start the VM through virt-manager interface"
echo ""
echo "3. During installation:"
echo " - Select 'macOS Base System' from OpenCore"
echo " - Use Disk Utility to format the 256GB drive"
echo " - Install macOS to the formatted drive"
echo ""
echo "Files created:"
echo " - BaseSystem.img (macOS installer)"
echo " - macOS.qcow2 (256GB virtual disk)"
echo " - mac_hdd_ng.img -> macOS.qcow2 (compatibility symlink)"
echo "" echo ""
# Prompt to start VM # Ask if user wants to start the VM now
read -p "Start macOS VM now? (y/n): " -n 1 -r read -p "Would you like to start the macOS VM now? (y/n): " -n 1 -r
echo echo
[[ $REPLY =~ ^[Yy]$ ]] && sudo ./OpenCore-Boot.sh || echo "VM can be started later" if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Starting macOS VM..."
sudo ./OpenCore-Boot.sh
else
echo "You can start the VM later by running:"
echo " cd $INSTALL_DIR && sudo ./OpenCore-Boot.sh"
fi