Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ sudo xbps-install -Su qemu python3 python3-pip # for Void Linux.
sudo zypper in qemu-tools qemu-kvm qemu-x86 qemu-audio-pa python3-pip # for openSUSE Tumbleweed
sudo dnf install qemu qemu-img python3 python3-pip # for Fedora
sudo emerge -a qemu python:3.4 pip # for Gentoo
nix-shell # for Nix users
```

## Step 1
Expand Down
2 changes: 1 addition & 1 deletion basic.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

OSK="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VMDIR=$PWD
Expand Down
2 changes: 1 addition & 1 deletion headless.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

OSK="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VMDIR=$PWD
Expand Down
18 changes: 13 additions & 5 deletions jumpstart.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# jumpstart.sh: Fetches BaseSystem and converts it to a viable format.
# by Foxlet <[email protected]>
Expand Down Expand Up @@ -26,14 +26,22 @@ case $argument in
print_usage
;;
-s|--high-sierra)
"$TOOLS/FetchMacOS/fetch.sh" -v 10.13 || exit 1;
version=10.13
;;
-m|--mojave)
"$TOOLS/FetchMacOS/fetch.sh" -v 10.14 || exit 1;
version=10.14
;;
-c|--catalina|*)
"$TOOLS/FetchMacOS/fetch.sh" -v 10.15 || exit 1;
version=10.15
;;
esac

"$TOOLS/dmg2img" "$TOOLS/FetchMacOS/BaseSystem/BaseSystem.dmg" "$PWD/BaseSystem.img"
"$TOOLS/FetchMacOS/fetch.sh" -v $version || exit 1

if [ -x "$(command -v dmg2img)" ]; then
dmg2img="dmg2img"
else
dmg2img="$TOOLS/dmg2img"
fi

"$dmg2img" "$TOOLS/FetchMacOS/BaseSystem/BaseSystem.dmg" "$PWD/BaseSystem.img"
12 changes: 10 additions & 2 deletions make.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# make.sh: Generate customized libvirt XML.
# by Foxlet <[email protected]>
Expand All @@ -7,6 +7,14 @@ VMDIR=$PWD
MACHINE="$(qemu-system-x86_64 --machine help | grep q35 | cut -d" " -f1 | grep -Eoe ".*-[0-9.]+" | sort -rV | head -1)"
OUT="template.xml"

NIX_EMULATOR="/run/libvirt/nix-emulators/qemu-system-x86_64"

if [ -e $NIX_EMULATOR ]; then
EMULATOR=$NIX_EMULATOR
else
EMULATOR="/usr/bin/qemu-system-x86_64"
fi

print_usage() {
echo
echo "Usage: $0"
Expand All @@ -21,7 +29,7 @@ error() {
}

generate(){
sed -e "s|VMDIR|$VMDIR|g" -e "s|MACHINE|$MACHINE|g" tools/template.xml.in > $OUT
sed -e "s|VMDIR|$VMDIR|g" -e "s|MACHINE|$MACHINE|g" -e "s|EMULATOR|$EMULATOR|g" tools/template.xml.in > $OUT
echo "$OUT has been generated in $VMDIR"
}

Expand Down
8 changes: 8 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
nativeBuildInputs = with pkgs; [
qemu_kvm
dmg2img
];
}
8 changes: 7 additions & 1 deletion tools/FetchMacOS/fetch.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# fetch.sh: Run fetch-macos.py with safety checks
# by Foxlet <[email protected]>
Expand All @@ -7,6 +7,12 @@ set +x;
SCRIPTDIR="$(dirname "$0")";
cd "$SCRIPTDIR"

if [ -x "$(command -v nix-shell)" ]; then
echo "Nix detected, using nix-shell for dependencies..."
nix-shell --pure --run "python fetch-macos.py $*"
exit
fi

initpip() {
if [ -x "$(command -v easy_install)" ]; then
sudo easy_install pip
Expand Down
9 changes: 9 additions & 0 deletions tools/FetchMacOS/shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
propagatedBuildInputs = with pkgs.python3Packages; [
python
requests
click
];
}
2 changes: 1 addition & 1 deletion tools/debug.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# debug.sh: Checks common virtualization programs and modules.
# by Foxlet <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion tools/template.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<emulator>EMULATOR</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='VMDIR/ESP.qcow2'/>
Expand Down
2 changes: 1 addition & 1 deletion virtio.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

OSK="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VMDIR=$PWD
Expand Down